<?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: ABAP Unit Test Problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589758#M265550</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; Open SE80 or SE24 and implement your class ZCL_MAIN.&lt;/P&gt;&lt;P&gt;&amp;gt; While this class is opened, choose &amp;lt;i&amp;gt;Goto-&amp;gt;Class-local types-&amp;gt;Local Class Definitions/Types&amp;lt;/i&amp;gt; from the menu. An editor for local classes is opened on the right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I followed the above menu path and put my test class there but it did not work. Then I moved my test class to menu path  &lt;EM&gt;Goto-&amp;gt;Local Test ClasseS&lt;/EM&gt; and it worked. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Dec 2007 06:04:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-25T06:04:46Z</dc:date>
    <item>
      <title>ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589749#M265541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here we go again on questions regarding ABAPUnit.  We are trying to use Abap unit within a Class object.  All the examples we have seen have to do with Classes and Methods within a Report program.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What we have created: &lt;/P&gt;&lt;P&gt;Class: ZCL_MAIN &lt;/P&gt;&lt;P&gt;Type: General Class&lt;/P&gt;&lt;P&gt;Method:  test_abapunit &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Class: ZCL_MAIN_TEST &lt;/P&gt;&lt;P&gt;Class type: Abap Unit &lt;/P&gt;&lt;P&gt;Sub Class of ZCL_MAIN&lt;/P&gt;&lt;P&gt;Method: Test_abapunit_test  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We try and run the Abap Unit Test from the Test Class and it says it is complete but does not execute our code.  I know we are doing something wrong but are stumped as to what it is. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Glenn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 13:26:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589749#M265541</guid>
      <dc:creator>former_member82844</dc:creator>
      <dc:date>2006-09-26T13:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589750#M265542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Glenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at the following WebLog on&lt;/P&gt;&lt;P&gt;&amp;lt;a href="/people/thomas.weiss/blog/2004/12/17/a-spotlight-on-abap-unit-part-1 Unit Test&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you define your testing class (and methods for testing) like that?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS test DEFINITION FOR TESTING.
  PRIVATE SECTION.
        METHODS test_minus_ten_percent FOR TESTING.
ENDCLASS.                   
CLASS test IMPLEMENTATION.
    METHOD test_minus_ten_percent.
        DATA: testprice type p value 200.
        PERFORM minus_ten_percent CHANGING testprice.
        cl_aunit_assert=&amp;gt;assert_equals( act = testprice exp = 180
        msg = 'ninety percent not calculated correctly').
    ENDMETHOD.                    
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not forget the FOR TESTING option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 14:00:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589750#M265542</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-09-26T14:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589751#M265543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The example you have given is for Report Based code.  I am trying to run the ABAP unit within the Class Builder.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 14:04:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589751#M265543</guid>
      <dc:creator>former_member82844</dc:creator>
      <dc:date>2006-09-26T14:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589752#M265544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Glenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is the difference whether you are testing report or class methods? In the SETUP( ) method you create your instance, set appropriate starting value that should yield defined results when calling methods of the class and then you call the methods and check the results using CL_AUNIT_ASSERT methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Sep 2006 20:09:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589752#M265544</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-09-26T20:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589753#M265545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Glenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's assume we have a class with a static method MINUS_TEN_PERCENT. Now you define within the global class a private testing class like shown below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS test DEFINITION FOR TESTING.
  PRIVATE SECTION.
        METHODS test_minus_ten_percent FOR TESTING.
ENDCLASS.                   
CLASS test IMPLEMENTATION.
    METHOD test_minus_ten_percent.
        DATA: testprice type p value 200.
        CALL METHOD ZCL_MYCLASS=&amp;gt;minus_ten_percent CHANGING testprice.
        cl_aunit_assert=&amp;gt;assert_equals( act = testprice exp = 180
        msg = 'ninety percent not calculated correctly').
    ENDMETHOD.                    
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As already said, if you need to test instances then create them within the pre-defined method SETUP( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 04:02:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589753#M265545</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-09-27T04:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589754#M265546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Glenn,&lt;/P&gt;&lt;P&gt;as Uwe already told there is no big difference using ABAP Unit in reports or class-pools. In order to test a class-pool just add your local test class definition and implementation in the implementation include of the class-pool.&lt;/P&gt;&lt;P&gt;In release 7.00 (Netweaver 2004s) onwards there is also a wizard. When you enter the class builder in edit mode the menu of the basic screen offers you a generator option. This generator produces the basic skeleton of a  test class.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;  Klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Sep 2006 04:38:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589754#M265546</guid>
      <dc:creator>former_member183804</dc:creator>
      <dc:date>2006-09-27T04:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589755#M265547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Glenn,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;although Uwe and Klaus actually provided for the relevant information we too faced some difficulties at first understanding 'where' you actually put the test classes. So here are the mechanics:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open SE80 or SE24 and implement your class ZCL_MAIN.&lt;/P&gt;&lt;P&gt;While this class is opened, choose &amp;lt;i&amp;gt;Goto-&amp;gt;Class-local types-&amp;gt;Local Class Definitions/Types&amp;lt;/i&amp;gt; from the menu. An editor for local classes is opened on the right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Type in your class definition ZCL_MAIN_TEST like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS lcl_main_test DEFINITION FOR TESTING.
  "#AU Risk_Level Harmless
  PRIVATE SECTION.
    CONSTANTS: some_initial_test_value TYPE i VALUE 5.

    DATA: main_class TYPE REF TO zcl_main.

    METHODS setup     FOR TESTING.
    METHODS teardown  FOR TESTING.
    METHODS check_get_my_int FOR TESTING.
    METHODS check_.. FOR TESTING.
ENDCLASS.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is btw a 'normal' local class, no subclass of cl_abap_unit.. whatsoever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go back (menu &amp;lt;i&amp;gt;Goto-&amp;gt;Class Definition&amp;lt;/i&amp;gt;).&lt;/P&gt;&lt;P&gt;Choose &amp;lt;i&amp;gt;Goto-&amp;gt;Class-local types-&amp;gt;local class implementations&amp;lt;/i&amp;gt; from the menu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Type in your class implementation for ZCL_MAIN_TEST, i.e. implement especially the setup()-method for the test fixture and the various test-methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Compile/activate your class ZCL_MAIN.&lt;/P&gt;&lt;P&gt;Run the test by choosing &amp;lt;i&amp;gt;Test-&amp;gt;Unit Test&amp;lt;/i&amp;gt; from the context menu of the class ZCL_MAIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps, regards,&lt;/P&gt;&lt;P&gt;Sebastian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 13:27:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589755#M265547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-04T13:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589756#M265548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Klaus, Uwe, thanks for your explanations. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have implemented some local test classes and it works fine. However, unfortunately, we cannot get the wizard Klaus mentions to start. Whenever one chooses &amp;lt;i&amp;gt;Goto-&amp;gt;Local Test Classes&amp;lt;/i&amp;gt; from the main menu it says something like 'class is not inactive' (!?) in the message bar and nothing happens (regardless of the activation state of the class).&lt;/P&gt;&lt;P&gt;Since writing the actual 'test-frame' as such is a mechanical and tedious work we would very much like to get this wizard to run. Do you have any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sebastian Kamp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jan 2007 13:47:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589756#M265548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-04T13:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589757#M265549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sebastian,&lt;/P&gt;&lt;P&gt;may this is a usability issue. From my experience the navigation to the special test class include (7.00 onwards) issues such a message in case no test class include exists. The wizard however can be started at SE24 entry screen after one is in edit mode.&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;  klaus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 12:29:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589757#M265549</guid>
      <dc:creator>former_member183804</dc:creator>
      <dc:date>2007-08-06T12:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Unit Test Problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589758#M265550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; Open SE80 or SE24 and implement your class ZCL_MAIN.&lt;/P&gt;&lt;P&gt;&amp;gt; While this class is opened, choose &amp;lt;i&amp;gt;Goto-&amp;gt;Class-local types-&amp;gt;Local Class Definitions/Types&amp;lt;/i&amp;gt; from the menu. An editor for local classes is opened on the right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I followed the above menu path and put my test class there but it did not work. Then I moved my test class to menu path  &lt;EM&gt;Goto-&amp;gt;Local Test ClasseS&lt;/EM&gt; and it worked. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Dec 2007 06:04:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-unit-test-problem/m-p/1589758#M265550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-25T06:04:46Z</dc:date>
    </item>
  </channel>
</rss>

