Does abap unit testclass can get acces to private methods of classes to tes

Hi,
I want to do a abap unit test inside a user program. the program calls my class and i want some of the methods there to be tested (i.e. db layer, some business logic etc).
My problem is, that I can define unit test very goog on program level or even for public methods of the class.
But what should I do if I want the maybe 3 private methods called by the public method to be tested standalone?
Does anyone have a idea for that?
THX
regards,
Jens

Hello Jens,
you may test private methods with the help of the FRIEND statement. For sample you place a local testclass in the class pool. In order to get friendship you may than use the following sequence of statements.
  class ltc_Repository definition deferred.
  class cl_Global definition local friends ltc_Repository.
  class ltc_Repository                     "#AU Risk Level Harmless
    definition for testing.
    private section.
      methods:
        retrieve_Fails_For_Bad_Key   for testing,
        update_Fails_For_Dup_Key     for testing.
endclass.
or
  interface lif_Unit_Test.
  endinterface.
  class cl_Global definition local friends lif_Unit_Test.
  class ltc_Repository                     "#AU Risk Level Harmless
    definition for testing.
    public section.
      interfaces: lif_Unit_Test.
    private section.
      methods:
        retrieve_Fails_For_Bad_Key   for testing,
        update_Fails_For_Dup_Key     for testing.
endclass.
By this technique you can grant access to private members of the global class to any local class. Without exposing something to the outside world! This code can be placed in the local implementation include of the class pool, or in test class include from release 7.02 onwards.
Using transaction /nABAPHELP provides all details on the FRIEND statement.
Testing private methods can be useful but also tends to result in [fragile tests|http://xunitpatterns.com/Fragile%20Test.html]. That means changes to the implementation may make your test turn red without any violation of the outside contract.
Ciao
  Klaus

Similar Messages

  • My I-pod screen is cracked and my account says 'Repairs and Service Coverage: Active' does that mean I can get it fixed for free or replaced?

    My I-pod screen is cracked and my account says 'Repairs and Service Coverage: Active' does that mean I can get it fixed for free or replaced? the ipod is very usefull to me as it keeps my three younger brothers entertained for a few minutes or hours and yes I understand that the Ipod is not indestructible but when in my pocket with two euro coins, it should not break when I sit down.

    That kind of damage is accidental and is not covered by warranty.  You can get the unit replaced for a flat fee:
    Replace broken screen on i-device - https://discussions.apple.com/thread/3869709 - lllaass post.  Similar one at https://discussions.apple.com/thread/3925666
    Apple - Support - iPod - Repair pricing - http://www.apple.com/support/ipod/service/prices/

  • My iPod Touch power button is stuck and will not pop back up. My iPod Touch Repairs and Service Coverage is still active, Does that mean I can get a new iPod Touch?

    My iPod Touch power button is stuck and will not pop back up. My iPod Touch Repairs and Service Coverage is still active, Does that mean I can get a new iPod Touch?

    Apple will most likely exchange it. The one you receive will be refurbished.
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • ABAP Unite : how to get the generated log

    Hi all,
    I'm looking for a way to get the log of the execution of a program linked abap unit tests.
    Imagine that I'm using se38 transaction, I launch Program >> test >> Unit Test.
    It give me a result screen with the result of defined assert.
    What I need is a way to do my own program that can access to this result in order to export them to a specific extarnal test management tool.
    So, I would like  to know the transaction code of the abap unit transation, the table filled by the log and so on ...
    Thanks  for help,
    Kind Regards
    Morgan

    Hello Morgan,
    there is no API to access ABAP Unit results in release 6.40 und 7.00. You will have to wait for 7.10.
    Sorry
      Klaus
    PS: You may try to access Code Inspector Results meanwhile.

  • HT4009 I purchased one app from them once that was the original app I did not authorize them to continue to charge my account every tim I played the game I have since deleted the game and I worry that they can get into my private Paypal account Thank you

    I purchased the game Price is right that is why you see a charge in my Paypal I never authorized any other charges to them how they got into my Paypal I don't know and that scares me there are multiple charges I have since deleted the game please help me with Any future charges

    Contact the app developer for the game "Price is Right".
    The developer for for this game should have a website for contacting customer or technical support.

  • ABAP UNIT TEST

    Hi ,
    I am new to oops concept but i am able to understand.
    Now i have to create some Unit test plans in ABAP.We are using SAP Netwever 7.1 and WEB AS 6.0
    I tried from SE24 but i couldn't get the correct path.
    Can you please explain me: if i have a Z program then where and how to write number of Unit test classes. And how it will integrate to with our actual program/FM/any object
    Thanks
    Umashankar.

    You can create the ABAP Unit class as a local class in your program, FM, or class which will test the functionality of that individual code lines. Once you implement the ABAP Unit, you can then run the Unit Test by main menu > Execute > Unit Test. E.g. from Program, Program > Execute > Unit Test.
    Check this previous discussions:
    ABAP Unit, how to use
    Unit Testing concept
    Regards,
    Naimesh Patel

  • How to get information back to a UI class

    Hello
    I have two class files, one User Interface class and another class file.
    UserInterfaceUI(); //The user interface file
    MainProgram(); //The actual file that does the work
    I have a third file, with the main() method,
    which creates an instances of the two above said files. So the user interface file runs first.
    The user interface file takes a value, I would like to pass this value to the second class file so it can compile and give the result back to another User Interface file OutputUI.
    Thankyou
    Prince Rozario

    Try this when calling the 2 files from your third file with the main method:
    UserInterfaceUI gui = new UserInterfaceUI();
    MainProgram prog = new MainProgram(gui);Then modify your MainProgram class constructor like this:
    UserInterfaceUI gui
    public MainProgram(UserInterfaceUI gui) {
       this.gui = gui;
    }What you did here is that you created a "pointer" to your UserInterface in the third main() class. And that pointer is the UserInterfaceUI gui in your MainProgram class. So then you can get all public objects, methods, etc in you UserInterfaceUI in your MainProgram class. You can call them like this:
    int intTmp = gui.intVariable;
    gui.method();

  • Have loaded lion and now cant access office for mac or apple works as it says it does not support power pc applications, how can I acces them or better still reinstate them please

    Have loaded lion and now can't access office for mac or apple works as it says it does not support power pc applications, how can I acces them or better still reinstate them please?

    MS-Office for Mac versions 2004 and older do not run in Lion since these are PPC-apps for which Apple has dropped support.
    Free alternatives to open Word and Excel files:
    NeoOffice http://www.neooffice.org/neojava/en/index.php
    OpenOffice http://www.openoffice.org/
    Or get the 2011 MS-Office

  • My Start Up Disk is Full and I can get no acces to anything when the computer starts

    The computer turns on and I can get no acces to anything. It display a message "Your Start Up Disk is Full" and comes to a white screen. I can only move the mouse but there is nowhere to click.
    How can I delete any files, so the computer can come back to life?? Is there any way I can acces those files??
    I'm using 250GB and this Mac has 500GB total memory.

    Supposedly one can hold the Shift key down while booting (Safe Mode) and that's supposed to allow one to boot the machine when the startup disk is full.
    Step by Step to fix your Mac
    If that works, then use a storage drive (not TimeMachine) to move excessive files too likely starting with Movies (large and easy) or iTunes supscirptions downloads which have gotten out of control.
    Most commonly used backup methods
    Another method is to create a boot drive on a external drive, this then will allow one to option key boot the computer and remove files off of the internal drive, allowing the free space needed for OS X to swap stuff to the drive and operate.
    Create a data recovery, undelete boot drive
    Now for some reason it takes rebooting the original drive to get OS X to recognize there is free space available again, so reboot the machine normally (no Shift key). Just saying that because you may be wondering how come it does't register when you delete stuff later.

  • After I reset my Ipod (deleted all data and settings) windows 7 doesn't recognize by ipod touch, and it doesn't appear in the itunes library or in the device menu, but it does charge. How can I get my computer to recognize it again?

    After I reset my Ipod (deleted all data and settings) windows 7 doesn't recognize by ipod touch, and it doesn't appear in the itunes library or in the device menu, but it does charge. How can I get my computer to recognize it again?

    Refer to this article:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538

  • HT1688 Hi, just bought my daughter an Iphone 4s and I can't get it to let her on youtube, Facebook etc., keeps saying no internet connection. My husband and I have 3G smartphones and we can get on them on ours, so I'm not sure what I'm doing wrong. Also,

    Hi, just bought my daughter an Iphone 4s and I can't get it to let her on youtube, Facebook etc., keeps saying no internet connection. My husband and I have 3G smartphones and we can get on them on ours, so I'm not sure what I'm doing wrong. Also, my other daughter has the same phone and has no trouble getting on these sites either. Any information to help is greatly appreciated. Thanks

    Well, did you activate this new phone?

  • I keep getting this error message: ITunes was unable to load data class information from Synch Services. Reconnect or try again later. What does that mean? Can I fix it? or do I have to wait for the next update?

    I keep getting this error message: ITunes was unable to load data class information from Synch Services. Reconnect or try again later. What does that mean? Can I fix it? or do I have to wait for the next update?

    See TS2690: iTunes for Windows: "Unable to load data class" or "Unable to load provider data" sync services alert.
    tt2

  • I have backed up my old phone to itunes, however, when I try to restore data to new phone it is saying the password is incorrect but I can get into my itunes account with my password so I am doing something wrong?

    I have backed up my old phone to itunes, however, when I try to restore data to my new phone it is saying the password is incorrect but I can get into my itunes account with my password so I am doing something wrong?

    I'm having this EXACT same problem with my iPhone 4, and I have the same computer stats (I have a Samsung Series 7)

  • I just purchased the apple tv, i have an older tv that does not have an HDMI input.   is there a converter i can get because the itv only have an HDMI output ?  help.

    i just purchased the apple tv, i have an older tv that does not have an HDMI input.   is there a converter i can get because the itv only have an HDMI output ?  help.

    Welcome to the Apple Community.
    There are hardware converters that will convert HDMI to various other types of output, however there are some issues with doing so that you should be aware of.
    HDCP
    HDCP compliant converters will not allow you to watch HDCP protected content such as that from the iTunes Store. Non compliant converters exist but we cannot discuss them under the Terms of Use for these communities.
    Resolution and aspect ratio
    I'm not aware of any converters that will scale the output from the Apple TV, any TV or projector which is used will need to be widescreen and support resolutions of 720p.

  • I know my Game Center username and password, but I don't know the email (or maybe apple id) that is for my account. It is not my normal one. I can't log in with just my username, so does anyone know how I can get my email?

    I know my Game Center username and password, but I don't know the email (or maybe apple id) that is for my account. It is not my normal one. I can't log in with just my username, so does anyone know how I can get my email?
    Can you help me please

    Dear
    I have worked renovation of the device and have an account, but I forgot my email
    I do not know E-mail has been linked in game center
    I have a name defined in game center
    Do I have the possibility of knowing E-mail has been linked in game center

Maybe you are looking for

  • Acrobat Pro Extended 9.3.1 - Can't use "Send for Shared Review"

    After the last update for Acrobat Pro Extended, I cannot send RoboHelp PDF generated documents for shared reivew. I used to be able to send draft reviews of the help (in PDF) using our public shared drive. The error indicates: "The filename you speci

  • Runtime error in MIR7

    Hello All We had used transaction MIR7, to park an invoice. Now when we go back to retreive the document system is prompting the following error "Relative node for insert not found, LastError node key: 5.". & then goes into the runtime error screen.

  • Adobe illustrator CS6 won't open on MacBook Pro with OS 10.6.8

    I just installed CS6 Design and Web Premium on my MacBook Pro running OS10.6.8. InDesign opened fine, but in the dock Illustrator and Photoshop have diagonal lines through them. I tried opening Illustrator and got this message: "You can't open the ap

  • HP 2509b Monitor starts out and goes black.

    OP  Windows 7  64-bit My HP 2509b monitor flickered on and off ... I restarted my machine ... the monitor came on, then slowly went black.   It does this on my husbands computer also.  The spare monitor I have hooked up works great ... but it's not m

  • Image in data tables

    Hello, Maybe some body can help me here. I have a data table and the headers are links where I can sorted the data I have the sort working but what I like to do is besides the column header link inser a image like an arrow pointing up for sort ascend