<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7849</bug_id>
          
          <creation_ts>2015-06-05 03:46:30 +0000</creation_ts>
          <short_desc>Filter proper test cases from the test case manifest file and run the filtered ones</short_desc>
          <delta_ts>2015-09-14 11:22:56 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Runtime Testing</product>
          <component>general</component>
          <version>1.8.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.9 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Cathy Shen">cathy.shen</reporter>
          <assigned_to name="Costin">costin.c.constantin</assigned_to>
          <cc>alexandru.c.georgescu</cc>
    
    <cc>junhuix.zhang</cc>
          
          <qa_contact name="Cathy Shen">cathy.shen</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>51518</commentid>
    <comment_count>0</comment_count>
    <who name="Cathy Shen">cathy.shen</who>
    <bug_when>2015-06-05 03:46:30 +0000</bug_when>
    <thetext>There is request to run specific test cases at runtime based on user input, since for different test cycle, test set is different. E.g. run priority 1 cases only, run cases in a specific component only , run cases with specific tag, etc.

We&apos;ll have patch to Yocto to support this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>51988</commentid>
    <comment_count>1</comment_count>
    <who name="zjh">junhuix.zhang</who>
    <bug_when>2015-06-29 08:30:59 +0000</bug_when>
    <thetext>Test runner can provide a decorator: addtag. when a case was decorated by this decorator, a tag will be added to this case. then test runner will filter by these tags to run specific cases:
for example:
#foo.py
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.decorators import addtag

@addtag(&quot;class&quot;)
class TestClass(oeRuntimeTest):
    @addtag(&quot;foo&quot;)
    def testfoo(self):
	    print &quot;testfoo&quot;

	@addtag(&quot;bar1&quot;,&quot;bar2&quot;)
	def testbar(self):
	    print &quot;testbar&quot;

	@addtag(&quot;bar1&quot;)
	def testbaz(self):
	    print &quot;testbaz&quot;

If user use a tag into conf/local.conf: TEST_SUITES_TAGS = &quot;class&quot;, runner will run all test cases: testfoo, testbar, testbaz.
If user use a tag: TEST_SUITES_TAGS = &quot;foo&quot;, runner will run test cases: testfoo.
If user use a tag: TEST_SUITES_TAGS = &quot;foo bar1&quot;, runner will run two test cases: testfoo,testbar,testbaz.
If user use a tag: TEST_SUITES_TAGS = &quot;bar1&amp;bar2&quot;, runner will run test case: testbar.
A test case can add many tags, and user also can use many tags to filter test cases.
If run testcases by an exported test, use -a or --tag to add filter tag(e.g. -a &quot;foo bar1&amp;bar2&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52232</commentid>
    <comment_count>2</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-07-09 10:54:31 +0000</bug_when>
    <thetext>Hi Junhui,

The idea looks good.

Costin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53405</commentid>
    <comment_count>3</comment_count>
    <who name="zjh">junhuix.zhang</who>
    <bug_when>2015-08-26 09:31:22 +0000</bug_when>
    <thetext>To support complicated situation, we change TEST_SUITES_TAGS is a python expression, It means that multiple tags like &quot;foo bar1&quot; should be &quot;foo or bar1&quot;, or is a python keyword.
details:
Test runner provides a decorator: tag. when a case was decorated by this decorator, tags will be added to this case. then test runner will filter cases by these tags. Runner follows below rules:
1. tags can be added to a test class or a test method, test method will inherit tags form its class, also can overwrite those tags.
2. tags can be valued, if not valued, the runner will give it a default value: True
3. test runner follows python expression, when this expression&apos;s result is True for a test case, this case will be executed.
4. If the case doesn&apos;t have a specific tag, this variable is None.

Some examples:
#foo.py
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import tag
@tag(TestType=&quot;Functional Positive&quot;)
class TestClass(oeRuntimeTest):
    @tag(&quot;foo&quot;, TestType=&quot;Stability&quot;, FeatureID=&quot;IOTOS-211&quot;, debug=5)
    def testfoo(self):
         print &quot;testfoo&quot;
    @tag(&quot;bar&quot;, FeatureID=&quot;IOTOS-212&quot;, debug=10)
    def testbar(self):
         print &quot;testbar&quot;
    @tag(&quot;baz&quot;, FeatureID=&quot;IOTOS-213&quot;, debug=15)
    def testbaz(self):
         print &quot;testbaz&quot;
If user use a tag into conf/local.conf: TEST_SUITES_TAGS = &quot;TestType == &apos;Functional Positive&apos;&quot;, runner will run two test cases: testbar, testbaz.
If user use a tag: TEST_SUITES_TAGS = &quot;foo&quot;, runner will run test cases: testfoo.
If user use a tag: TEST_SUITES_TAGS = &quot;debug &lt; 11&quot;, runner will run two test cases: testfoo,testbar.
If user use a tag: TEST_SUITES_TAGS = &quot;TestType == &apos;Functional Positive&apos; and debug &lt;= 10&quot;, runner will run test cases: testbar.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53857</commentid>
    <comment_count>4</comment_count>
    <who name="zjh">junhuix.zhang</who>
    <bug_when>2015-09-09 07:26:45 +0000</bug_when>
    <thetext>This patch is merged on poky.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54010</commentid>
    <comment_count>5</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-09-14 11:22:20 +0000</bug_when>
    <thetext>Hello,

Verified with 75bad1b64bd485a50af69ed1f8663a0dadbb5f9e
patch was merged with: 	fac0d67ec25f357684bcd0c80be282e1bca3adef</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54011</commentid>
    <comment_count>6</comment_count>
    <who name="Costin">costin.c.constantin</who>
    <bug_when>2015-09-14 11:22:56 +0000</bug_when>
    <thetext>marking as verified</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>