Dynamics AX Testing Tools: Code Profiler
The code profile is a tool which has the history of code execution for duration when code profiler is running. The code profiler can be used for following purposes:
· Measuring Execution time for each line, method, object, etc
· Code coverage analysis during unit testing.
· Identifying performance bottlenecks
The code profiler can be not only invoked through graphical user interface but also through X++ code. We will not discuss invoking it through X++. The use of code profiler consists of two stages,
1. Gathering data, and
2. Viewing / analyzing data.
Gathering Data
To gather execution data, code profiler needs to be invoked and then the user should traverse through each feature / function under review. Following are the steps to follow:
1. Open the code profiler tool by going to Toolsà Development Tools à Code Profiler.
2. Limit the check depth by checking the ‘Trace Depth Enabled’ checkbox and then selecting number of levels.
3. Navigate in application till the point of test start.
4. Click start in code profiler window,
5. Use the functionality in different scenario / conditions so that each of the line of code can be executed at least once.
6. When all functionality (to be tested) is used, Click Stop button in code profiler window.
7. Write a description (for reference) of code profile in ‘Summary’ dialog.
Do not select the ‘Calculate line total’ checkbox here.
8. Click ‘OK’ button and it will be a start of second stage ‘viewing / analyzing data’ when ‘Profiler runs’ form opens to view data.
View / Analyze Data
The data view for a particular run may have different objectives such as performance analysis, code coverage analysis etc. The code profiler has four different forms to view data in different format:
Every form shows time count in TICKS, which depends upon pressure speed. To calculate these data into any unit such as milliseconds, or seconds etc; multiply the data by ‘Ticks / second’, which is available on ‘Profiler run’ form.
You can view gathered data in three different presentations which are
- Call Tree Form
- Profile Lines Form
- Traverse Form
You can refer refer my bookQuality Assurance for Dynamics AX based ERP solution' (ISBN: 1847192912) which is available athttps://www.packtpub.com/quality-assurance-for-dynamics-ax-based-erp-solutions/book to view details about the various presentation forms in this tool and how to make analysis.
Totals
The 'Totals' forms are used to displays aggregated data. Various 'Totals' forms can be accessible from Tools | Development tools | Code profiler | Profiler runs | Totals |
Line total Form: Displays aggregated data about total amount of time spent on executing each line of code for a code profiler run.
Method total Form: Displays aggregated data about total amount of time spent on executing each method for a code profiler run.
Object total Form: Displays aggregated data about total amount of time spent on executing each object for a code profiler run.
Following are the button summary available on each of three forms
Button name & Function
|
Line total Form
|
Method total Form
|
Object total Form
|
Profile lines: Opens Profile lines Form.
|
Y
|
Y
|
N
|
Line total: Opens Line total Form
|
N
|
Y
|
Y
|
Method total: Opens Method total Form
|
N
|
N
|
Y
|
Profile Summary Form
This form is used to calculate the total execution time for each line of code, each method, and each object for a code profiler run. This form is used when ‘Calculate line total’ checkbox is cleared at Code profiler form while creating a run else total calculation is automatically done.
The code profiler tool will be soon replaced by ‘Trace Parser’ trace parser.
For details about Dynamics AX Testing tools, refer my bookQuality Assurance for Dynamics AX based ERP solution' (ISBN: 1847192912) which is available athttps://www.packtpub.com/quality-assurance-for-dynamics-ax-based-erp-solutions/book
Comments
Post a Comment