Business Central

Wednesday, 11 January 2017

How to use code coverage tool (How it differs from debugger)

Code coverage is one of the interesting topic while testing and debugging. It is very useful when you want to test your work.

I can start this explanation with a very good example.

Suppose you have a sound recorder in your mobile, you will go to the app folder, you will open the sound recorder, start the sound recorder, hum a tune and will record it for some time. Once you are done with humming a tune/song. You will stop recording and start listening to the tune/song which you've recorded.

Well, Exactly in the same way even code coverage tool works.
Firstly to open a code coverage tool in RTC(Role Tailored Client) Go to the following path in RTC.

If you are on Company Cronus USA,
Then in the menusuite go to,
  • CRONUS USA, Inc./Departments/Administration/Application Tools/
  • Click on Code Coverage in application tools. 
  • Click on Start button.


Now continue with your actions which you are supposed to do on RTC.
Example: I clicked on release sales order and did some processing of some random action.

Now, when you come back to code coverage and click stop.

It displays where all the flow passed through internally when you clicked on action button. You can just have a quick look at the flow of actions during your test activity.


So where all you see the Coverage% as 100. At those places the code as been hit internally when you clicked on particular action button. However, you cant see the values here directly. This gives a quick flow of code but doesn't give data i.e updating. If you need to know the complete flow internally along with values updating internally then you need to go with Debugger in NAV.

Click on Tools in NAV IDE -> Debugger -> Debug Session
Assign a break point in a code and start debugging each and every lines of code. 

Hope this helps for many beginners :)

No comments:

Post a Comment