<?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: Unit tests for local class in function group in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938559#M1692976</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's not so much a pity if you use exits only as hooks for your own code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a good design idea anyway, since&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;the exit represents the &lt;EM&gt;event &lt;/EM&gt;on which you want to react&lt;/LI&gt;&lt;LI&gt;the coding in the exit represents the &lt;EM&gt;task &lt;/EM&gt;which you want to perform.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is good to keep 1) and 2) separated. This makes it easy to couple the task to another event if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And delegating code into separate units, extracting methods from it, refactoring it, renaming it so that the name expresses in the best way what it does, organizing it, belongs to our main activities as developers anyway. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rüdiger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Aug 2012 09:06:46 GMT</pubDate>
    <dc:creator>Ruediger_Plantiko</dc:creator>
    <dc:date>2012-08-15T09:06:46Z</dc:date>
    <item>
      <title>Unit tests for local class in function group</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938554#M1692971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have problem with running unit tests from local class as I want to test another local class within the function group. There is no program or global class in given function group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In function group XWOC I have created new includes which contains local classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ZXWOC_CLD_PM_ORDER_SAVE - contains local class definition:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;CLASS &lt;/SPAN&gt;lcl_pm_order_save &lt;SPAN class="L0S52"&gt;DEFINITION&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;... class details ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;ENDCLASS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ZXWOC_CLI_PM_ORDER_SAVE - contains local class implementation:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;CLASS &lt;/SPAN&gt;lcl_pm_order_save &lt;SPAN class="L0S52"&gt;IMPLEMENTATION&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;... class implementation details ...&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have one local class lcl_pm_order_save. Now I would like to test it with unit tests and another local class. &lt;/P&gt;&lt;P&gt;I extended ZXWOC_CLD_PM_ORDER_SAVE with new class definition for testing, appended at the end of include testing class definition:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;CLASS &lt;/SPAN&gt;lcl_test_pm_order_save &lt;SPAN class="L0S52"&gt;DEFINITION &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;FOR &lt;/SPAN&gt;TESTING&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;PUBLIC &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;SECTION&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;METHODS&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;: &lt;/SPAN&gt;test_local_class_1 &lt;SPAN class="L0S52"&gt;FOR &lt;/SPAN&gt;TESTING&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN class="L0S52"&gt;ENDCLASS&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;Also implementation of test class has been added at the end of include ZXWOC_CLI_PM_ORDER_SAVE:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;CLASS &lt;/SPAN&gt;lcl_test_pm_order_save &lt;SPAN class="L0S52"&gt;IMPLEMENTATION&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;METHODtest_local_class_1&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cl_abap_unit_assert&lt;SPAN class="L0S70"&gt;=&amp;gt;&lt;/SPAN&gt;assert_equals&lt;SPAN class="L0S55"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;exp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;= 'test example'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; act&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S55"&gt;= 'test example'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S55"&gt;)&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;ENDMETHOD&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when I open these includes, or any local class to editor and try to exectue Unit Tests I have message: &lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;H3&gt;Program FUGR XWOC is not known in table TADIR&lt;/H3&gt;&lt;P&gt;Message no. SABP_UNIT202&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And no tests run. It looks like this is caused because I have no global class in the function group, only my own local classes in includes. Is there a way to execute unit tests and test my local class?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 07:37:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938554#M1692971</guid>
      <dc:creator>adam_krawczyk1</dc:creator>
      <dc:date>2012-08-09T07:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Unit tests for local class in function group</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938555#M1692972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is the function group XWOC a customer-exit? &lt;/P&gt;&lt;P&gt;That might be the reason.&lt;/P&gt;&lt;P&gt;Function groups for customer exits don't have an entry R3TR FUGR ... but R3TR FUGS ... in TADIR.&lt;/P&gt;&lt;P&gt;And for FUGS unit tests are not supported.&lt;/P&gt;&lt;P&gt;One workaround is to convert your local class into a global one. Then you can write the unit tests for the global class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dirk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 08:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938555#M1692972</guid>
      <dc:creator>dirk_wittenberg</dc:creator>
      <dc:date>2012-08-09T08:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Unit tests for local class in function group</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938556#M1692973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dirk,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes you are right, the function group is customer exit:&lt;/P&gt;&lt;P&gt;XWOC - Customer Exits Notifications&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for so quick and valid response. That explains everything.&lt;/P&gt;&lt;P&gt;It is only a pity that it is not possible to test local class there and it forces to have global class in place that is actually locally needed. But it is anyhow a solution &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/910/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 08:08:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938556#M1692973</guid>
      <dc:creator>adam_krawczyk1</dc:creator>
      <dc:date>2012-08-09T08:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Unit tests for local class in function group</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938557#M1692974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes it's a pity. It's the same with BOR-Objects ( transaction SWO1 ). They also don't support unit tests. Somehow SAP wants to push us towards global classes &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/910/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case an alternative would be to include the includes containing the class under test also in a separate report which then contains the unit-test classes. The &lt;SPAN class="short_text" id="result_box" lang="en"&gt;&lt;SPAN class="hps"&gt;inconvenience&lt;/SPAN&gt;&lt;/SPAN&gt; would be that the tests always have to be executed in these separate report and not from within the function group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dirk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 10:03:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938557#M1692974</guid>
      <dc:creator>dirk_wittenberg</dc:creator>
      <dc:date>2012-08-09T10:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Unit tests for local class in function group</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938558#M1692975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dirk,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, you are right with that separate report. That is another alternative and good hint, we only need to keep tests "report runner" separated in another place. I like idea of unit tests in ABAP very much but sometimes it is surprising how many tricks we need to do &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/910/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for great support! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2012 10:53:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938558#M1692975</guid>
      <dc:creator>adam_krawczyk1</dc:creator>
      <dc:date>2012-08-09T10:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unit tests for local class in function group</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938559#M1692976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's not so much a pity if you use exits only as hooks for your own code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a good design idea anyway, since&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;the exit represents the &lt;EM&gt;event &lt;/EM&gt;on which you want to react&lt;/LI&gt;&lt;LI&gt;the coding in the exit represents the &lt;EM&gt;task &lt;/EM&gt;which you want to perform.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is good to keep 1) and 2) separated. This makes it easy to couple the task to another event if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And delegating code into separate units, extracting methods from it, refactoring it, renaming it so that the name expresses in the best way what it does, organizing it, belongs to our main activities as developers anyway. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rüdiger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Aug 2012 09:06:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unit-tests-for-local-class-in-function-group/m-p/8938559#M1692976</guid>
      <dc:creator>Ruediger_Plantiko</dc:creator>
      <dc:date>2012-08-15T09:06:46Z</dc:date>
    </item>
  </channel>
</rss>

