<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Order in which test methods are executed in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443818#M1740561</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Akshat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I am humbled by your post &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt; There's no age to learning, isn't it? &lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;I don't think I have ever seen one posting a question on SCN&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Spend a few more days on SCN &amp;amp; you'll see that us Mods (atleast me) aren't Mr. Know-it-all &lt;SPAN __jive_emoticon_name="silly" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/silly.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;BR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Suhas&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 May 2013 07:01:16 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2013-05-16T07:01:16Z</dc:date>
    <item>
      <title>Order in which test methods are executed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443813#M1740556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my first hands on experience with ABAP Unit, so please excuse me if the question is a basic one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a class with 1 public instance method (PUB1) which in turn makes call to 3 pvt. instance methods - PVT1, PVT2, PVT3 - in this sequence. &lt;SPAN style="font-size: 10pt;"&gt;But when i execute my local test class (LCT_UNIT_TEST), the sequence PVT1 -&amp;gt; PVT2 -&amp;gt; PVT3 is not maintained &lt;/SPAN&gt;&lt;SPAN __jive_emoticon_name="sad" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/sad.gif" style="font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;SAP states &amp;amp; i quote - &lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-family: arial, sans-serif; background-color: #ffffff;"&gt;The order in which the tests are executed is not specified deterministically.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;ref.: &lt;/SPAN&gt;&lt;A href="http://help.sap.com/saphelp_nw73ehp1/helpdata/en/49/180612005338a1e10000000a421937/content.htm?frameset=%2Fen%2F49%2F18061c005338a1e10000000a421937%2Fframeset.htm" style="font-size: 10pt;" title="http://help.sap.com/saphelp_nw73ehp1/helpdata/en/49/180612005338a1e10000000a421937/content.htm?frameset=%2Fen%2F49%2F18061c005338a1e10000000a421937%2Fframeset.htm"&gt;Executing ABAP Unit Tests - Test and Analysis Tools in ABAP - SAP Library&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If i declare the CUT(Class/Component Under Test) instantiation in the SETUP it works okay, but initially i had declared that in CLASS_SETUP and i was getting test failures!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;BR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Suhas&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 10:41:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443813#M1740556</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2013-05-15T10:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Order in which test methods are executed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443814#M1740557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS_SETUP is run only once, before all tests are run (once per class).&lt;/P&gt;&lt;P&gt;SETUP is run before every test method, so if you have 3 test cases (3 tests methods marked with FOR TESTING addition) it will be run 3 times, before each. That is why you can see difference between putting CREATE OBJECT CUT into CLASS_SETUP or SETUP. It is recommended to have it in SETUP, as each single test method should have clear and fresh instance to work on (not keeping state from previous test run).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We should not rely on order of test methods (methods with addition FOR TESTING). I observe that order of running is close to alphabetical, but I never rely on the order - each single method test case must be individual, independent of other methods. So it is not recommended to rely on tested object state from one method to another - always work on new clear instance. However "randomized" sequence is assumed only for test methods (with FOR TESTING addition) which are run by Unit Test ABAP framework (CTRL + SHIFT + F10). If you have some method, that inside is running method M1, M2, M3 - this order will be kept, as this is your code implementation that cannot randomly change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the other hand, you may be sure that order of test methods and fixtures will be constant as:&lt;/P&gt;&lt;P&gt;CLASS_SETUP&lt;/P&gt;&lt;P&gt;SETUP&lt;/P&gt;&lt;P&gt;TEST_METHOD_1&lt;/P&gt;&lt;P&gt;TEARDOWN&lt;/P&gt;&lt;P&gt;SETUP&lt;/P&gt;&lt;P&gt;TEST_METHOD_2&lt;/P&gt;&lt;P&gt;TEARDOWN&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;CLASS_TEARDOWN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 12:05:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443814#M1740557</guid>
      <dc:creator>adam_krawczyk1</dc:creator>
      <dc:date>2013-05-15T12:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Order in which test methods are executed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443815#M1740558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the difference between CLASS_SETUP &amp;amp; SETUP &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;, they are similar to static (CLASS_CONSTRUCTOR) &amp;amp; instance CONSTRUCTOR!&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt; I observe that order of running is close to alphabetical, but I never rely on the order&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;Me too! But i was hoping they would be called called in some &lt;SPAN style="text-decoration: underline;"&gt;defined&lt;/SPAN&gt; sequence &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;each single method test case must be individual, independent of other methods&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;Learning#1 - that each test method is independent and that i where your DAO injection technique is going to be of some help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;It is recommended to have it in SETUP, as each single test method should have clear and fresh instance to work on (not keeping state from previous test run).&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;Learning#2 - Test methods should be de-coupled &amp;amp; should not be dependent on the previous runs!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I generally develop "singleton"applications (using the CLASS_CONSTRUCTOR), I think you can relate my affinity towards using CLASS_SETUP &lt;SPAN __jive_emoticon_name="silly" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/silly.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 14:32:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443815#M1740558</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2013-05-15T14:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Order in which test methods are executed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443816#M1740559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not writing to provide you an answer to your question but to appreciate your posting a question inspite of being a moderator! I know there's no bar on moderators from asking questions but I don't think I have ever seen one posting a question on SCN. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Akshat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 15:03:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443816#M1740559</guid>
      <dc:creator>kakshat</dc:creator>
      <dc:date>2013-05-15T15:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Order in which test methods are executed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443817#M1740560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good points Suhas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we only know the framework rules, we can set up tests as we want, depending on case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 06:38:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443817#M1740560</guid>
      <dc:creator>adam_krawczyk1</dc:creator>
      <dc:date>2013-05-16T06:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Order in which test methods are executed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443818#M1740561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Akshat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I am humbled by your post &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt; There's no age to learning, isn't it? &lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN style="color: #333333; font-size: 12px; background-color: #ffffff;"&gt;I don't think I have ever seen one posting a question on SCN&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Spend a few more days on SCN &amp;amp; you'll see that us Mods (atleast me) aren't Mr. Know-it-all &lt;SPAN __jive_emoticon_name="silly" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1434/images/emoticons/silly.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;BR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Suhas&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2013 07:01:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-in-which-test-methods-are-executed/m-p/9443818#M1740561</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2013-05-16T07:01:16Z</dc:date>
    </item>
  </channel>
</rss>

