1. Kumar Rahul
  2. PowerBuilder
  3. Thursday, 13 January 2022 05:04 AM UTC

 

Is there any way by which we can get the code coverage in unit test process.

What I need is, say I call a function and then I can get no of lines executed in our process, and some statistics with line of code executed/not-executed, percentage covered in Unit test. 

 

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 19 January 2022 15:27 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Kumar;

  My latest STD framework (2022R1 beta for PB 2021 build 1311) now has a new DEBUG Trace App feature that traces the PBVM (yes, you read that correctly, the actual PB runtime). Note that this PB feature is not documented but has been in the PB product since PB 5.0.   ;-)

For example:

  1. Open the DEBUG dialog
  2. Select TRACING CB
  3. Select Tracing options (any combination of 130 options - yep, just a few ... LOL)
  4. Turn the Tracing ON and a DOS command window will appear
  5. Run your App unit tests and watch the PBVM overhead

 

FYI:  https://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry/Beta

 

Regards ... Chris

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 19 January 2022 15:07 PM UTC
  2. PowerBuilder
  3. # 1

Hi Kumar;

  Yes, your PB App can read the profile trace file in "real time" by using the BuildModel command.

https://docs.appeon.com/pb2019/powerscript_reference/ch10s45.html

  My STD framework uses this. For example:

  1. Turn on Profiling as I posted earlier in this thread
  2. Run your App unit test(s)
  3. Turn profiling off
  4. Select the Model CB in the "Debug" dialogue.
  5. Select the PBP profile trace file that was just generated.
  6. The Framework will now build the execution model ... as follows:

HTH
Regards ... Chris

Comment
There are no comments made yet.
Kumar Rahul Accepted Answer Pending Moderation
  1. Wednesday, 19 January 2022 12:36 PM UTC
  2. PowerBuilder
  3. # 2

Thank you for response, This was informative for me.

On top of this I also want to read trace file from powerscript, so that I don't have to go to Powerbuilder and manually read the trace file.

I am not trying to use this for debug, I wish to use it as some reporting and know my code coverage for my unit tests.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 13 January 2022 17:37 PM UTC
  2. PowerBuilder
  3. # 3

Hi Kumar;

   My suggestion would be to use the TRACExxxx() commands. For example, say I want to know this overhead in my App when I press & run the "Search" picture button. In my STD Framework, I would start an App trace just before the "Search" CB as follows:

 The "Profile On" CB then starts the trace as follows:

After running the Search CB, I would return to the Profiler and set the TraceOFF, as follows ...

Next, I use the PB IDE "Profiler Viewers" to review the trace file for what I need. For example:

 

There was a great presentation by John Strano at the Elevate 2021 conference about this technique.

FYI: https://www.appeon.com/conference/elevate-2021/live?id=333

 

HTH

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.