Code Coverage

coolned
Member Posts: 30
Hey everyone!
I need to know why and how to use Debugger-->>Code Coverage step by step????
I have a little bit knowledge of it.
I need to know why and how to use Debugger-->>Code Coverage step by step????
I have a little bit knowledge of it.
0
Comments
-
May i know why this highlighted in pink..?
Did you read the terms and conditions before posting to forum...?0 -
It is very urgent to me to get the answer of it.
I didn't read the required documents before posting into this forum.
please answer of my question if you know except commenting on it.0 -
Logging Code Coverage
The Code Coverage tool enables you to check how much of the code is used by any given function. This tool works in the same way as the debugger and therefore reflects any limitations that may exist in the debugger.
Programmers can use the tool to log code coverage when they customize Navision. Code logging gives you an overview of the code that is executed in a usage scenario.
The Code Coverage tool can often be used instead of or in combination with the C/AL Debugger. Code logging can give programmers a quick overview, while step by step debugging can take a long time. You can read about the C/AL Debugger in the Application Designer's Guide.
The Code Coverage window lists the objects that have been used in a usage scenario.
To Log Code Coverage:
Click Tools, Code Coverage to open the Code Coverage window.
Click Start to clear the contents of the Code Coverage window and begin logging the code.
Perform the operations that you want to monitor.
When you are finished, go back to the Code Coverage window. It now contains a list of the tables, forms, reports, dataports and codeunits that were used in the operations that you just performed.
Click Stop when you are finished logging the code.
Select the object for which you want to see the code that was used. You can also select an object without first clicking Stop.
Click Code and the Code Overview window opens.
The Code Overview window displays the code that is contained in this specific object. The lines of code that have been executed are colored black. The lines of code that have not been executed are colored red.
The Code Overview window displays the lines of code in the same way as the debugger:
Bullets are shown on each line that contains executable code.
The lines that are marked with a bullet are the only ones for which the information displayed is correct.
The lines of code that are not marked with a bullet are simply displayed in the same colors as the lines of code that surround them.
The information displayed in the Code Overview window is similar to the information shown in the debugger. The main difference is that in the debugger you see the code being executed, while the Code Overview window shows you which lines of code have been executed.
Running the Code Coverage tool when you are using Navision can generate an extremely large log file.
Note
You must not modify objects and log code coverage at the same time, because this will give inconsistent results.0 -
Thanks Mohana.
I understand it now completely.
Thanks again!0 -
Welcome :thumbsup:0
-
Hey Mohana,
I do have a doubt in code coverage.
I would request you to check the code coverage in Warehouse-->>Planning and Execution-->>Transfer Order
It shows only 4 to 5 records. However I know that Codeunit 22 is used in Transfer Order when we post an order of that item which is not an inventory then it shows the error "Item is not in inventory".
While Codeunit 22 is not in the code coverage of Transfer Order. Why?0 -
Hope you have followed below steps.
1. Start Code coverage
2. Create TO and Post (ship)
3. Stop Code coverage
Check the Objects hit.
I found the below list of objects while posting TOObject Type Object ID Object Name Coverage Ratio Table 14 Location 0.06 Table 83 Item Journal Line 0.01 Table 309 No. Series Line 0.09 Table 5740 Transfer Header 0.04 Table 5741 Transfer Line 0.07 Table 5744 Transfer Shipment Header 0 Table 5765 Warehouse Request 1 Table 5814 Inventory Period 0.18 Form 565 Code Coverage 0.82 Form 5740 Transfer Order 0.08 Form 5741 Transfer Order Subform 0.02 Codeunit 1 ApplicationManagement 0.01 Codeunit 21 Item Jnl.-Check Line 0.43 Codeunit 22 Item Jnl.-Post Line 0.14 Codeunit 396 NoSeriesManagement 0.18 Codeunit 408 DimensionManagement 0.04 Codeunit 411 Dimension Buffer Management 0.04 Codeunit 423 Change Log Management 0.04 Codeunit 5150 Integration Management 0.03 Codeunit 5704 TransferOrder-Post Shipment 0.37 Codeunit 5706 TransferOrder-Post (Yes/No) 0.61 Codeunit 5708 Release Transfer Document 0.61 Codeunit 5773 Whse.-Transfer Release 0.53 Codeunit 5775 Whse. Management 0.07 Codeunit 5777 Whse. Validate Source Line 0.1 Codeunit 6500 Item Tracking Management 0.02 Codeunit 99000831 Reservation Engine Mgt. 0.01 Codeunit 99000835 Item Jnl. Line-Reserve 0.04 Codeunit 99000836 Transfer Line-Reserve 0.11 Codeunit 99000845 Reservation Management 0.03 Codeunit 99000855 Planning-Get Parameters 0.57
0 -
A tip if you want to reduce the clutter a code coverage session gives you: You can use CODECOVERAGELOG(TRUE) to turn it on at the specific moment you want ( replace the TRUE wit FALSE to turn it off again )0
-
Hey Mohana!
Thank you very much!
Hey Berger--
Would you please explain where should I use this property CodeCoverage(True/False) to check on a specific moment.
Ex-
If I post an TO with 1000000 quantity, it will give an error "Item is not on inventory". I want to check which codeunit is using this error or coding.I want to check it at the last when it gives the error.
Thanks for the prompt reply.0 -
MBerger wrote:A tip if you want to reduce the clutter a code coverage session gives you: You can use CODECOVERAGELOG(TRUE) to turn it on at the specific moment you want ( replace the TRUE wit FALSE to turn it off again )
Very helpful tip. Thanks.David Singleton0 -
Hey --
Would you please explain where should I use this property CodeCoverage(True/False) to check on a specific moment.
Ex-
If I post an TO with 1000000 quantity, it will give an error "Item is not on inventory". I want to check which codeunit is using this error or coding.I want to check it at the last when it gives the error.
I copy the CodeCoverage function in the code unit, it shows the warning that is obsolete. How?0 -
Well, if you want to know where the error occurs, you don't need the codecoverage, just turn uon the debugger and it'll break at the error.0
-
Running Code Coverage from code
You can also turn on Code Coverage from within your own code.CodeCoverage.DELETEALL; CODECOVERAGELOG := TRUE; CODECOVERAGELOG := FALSE; FORM.RUN(FORM::"Code Coverage");
You will first need to define a record variable named CodeCoverage of subtype Code Coverage and delete all records from it.
You can then turn Code Coverage on/off using the CODECOVERAGELOG function. To see what was logged, run the Code Coverage form (565).0 -
Hey vijay_g
thank you for your replies.
I do have a single doubt that when I post the sales order then a form opens then I click the code button then I see --
FORM.RUN(FORM::"Code Coverage"); is in RED COLOR while it has been executed. Thats the reason we see the form after posting any sales order.
I understand that it should be in the black color. Why is it in the red?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions