PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • This lesson will teach you the following concepts
  • What is an audit?
  • Static audit
  • Procedure not run
  • Orphan element
  • Cleaning the project
  • Dynamic audit
Lesson 10.2. Project audits
This lesson will teach you the following concepts
  • What is an audit and what is its purpose?
  • Starting and studying the static audit.
  • Starting and studying the dynamic audit.

Estimated time: 20 mn
Previous LessonTable of contentsNext Lesson
What is an audit?
The audits provide a set of features used to automatically improve the project quality and performances, and to follow the conditions in which it is implemented.
Two types of audits are available:
  • The static audit. The static audit performs a detailed analysis of a project and elements. This audit is performed from the project editor.
  • The dynamic audit. The dynamic audit analyzes the behavior of a project during its execution. This audit can be performed in test mode or in the production environment.
We are going to test these audits on the "WW_Optimization" project.
Static audit
The static audit is an environment feature used to study the source codes of a project in order to detect different problems and to propose improvements.
  • To start the static audit on the "WW_Optimization" project:
    1. In the ribbon, on the "Project" pane, in the "Audit and performance" group, expand "Edition audit" and select "Trigger the edition audit".
    2. The wizard starts. We are going to define the target of static audit.
    3. Select "Run the static audit on the entire project".
    4. Validate the wizard.

      Note

      The static audit of project can also be started from the project dashboard, via the "Static audit and Compilation" widget.
      Simply:
      • display the Widget if necessary:
        • Switch the dashboard to modification mode (right mouse click, "Modification mode" option).
        • Add the Widget (right mouse click, "Add .. Static audit" option).
        • Close the modification mode (right mouse click, "Modification mode" option).
      • click the arrow.
    5. The audit report is displayed:
      The static audit includes:
      • The static audit of project.
      • The audit for the content of application library.
  • Let's study the topics presented by this report.

Procedure not run

In our project, the audit indicates that a procedure is never run.
In huge projects, you may want to create one or more procedures to perform a process then, further to a code reorganization, the procedure is no longer used but it remains in the project.
The presence of unused procedures unnecessarily consumes the resources distributed to the end users.
  • To fix this problem:
    1. Click the [...] button to get more details. The window that lists the dead codes is displayed.
    2. The "ObsoleteProcedure" procedure is never called. This window is used to:
      • specify that the procedure is still used ("Flag as useful" button). In this case, the procedure will not be taken into account anymore during the audit.
      • delete the procedure if it is actually unused ("Delete" button).
      • see the procedure ("View" button).
      • find the use cases in the strings for example ("Search" button).
    3. In our case, this procedure is actually unused, click "Delete".
    4. A window is displayed, asking you to confirm the deletion. Click the "Delete" button to confirm the deletion.
    5. Close the window of dead code (click the cross in the top right corner).
  • In the window of static audit, click the "Refresh" button to update the audit report.

Orphan element

The audit indicates that our project contains an orphan element.
As for the procedures run, you may create windows or reports in order to run a quick test, save them and forget everything about them. The presence of orphan elements in the executable unnecessarily consumes the resources distributed to the end users.
  • To fix this problem:
    1. Click the [...] button to get more details. The window used to list the orphan elements is displayed.
    2. The "PAGE_Unused_Page" page is never called. The window that lists the orphan elements is used to:
      • specify that the element is still used ("Flag as useful" button). In this case, the page will not be taken into account anymore during the audit. This option can be interesting when using a test page specific to the development for example.
      • delete the page if it is actually unused ("Delete" button).
      • see the page ("View" button).
      • find the use cases in the strings for example ("Search" button).
    3. In our case, this "PAGE_Unused_Page" page is actually unused, click "Delete".
    4. Close the window of orphan elements (click the cross in the top right corner).
  • In the window of static audit, click the "Refresh" button to update the audit report.

Cleaning the project

Our project contains several unused files. You have the ability to clean the project in order to keep the necessary elements only. The client setup is not weighted with images, external files, ... not used.
  • To fix this problem:
    1. Click the [...] button to get more details.
    2. The wizard for cleaning a project starts. This wizard indicates the unused files that can be deleted.
    3. Go to the next step.
    4. Select the type of cleaning to perform. You can:
      • create a zip file with the useless files.
      • move the useless files into a specific directory.
    5. Validate the option proposed by default and go to the next step.
    6. End the wizard.
  • Our project was optimized according to the tips given by the static audit. The static audit is used to get an overall status on the source code of your project. Our advice: run it on a regular basis!
Let's see what happens at run time by starting the dynamic audit.
Dynamic audit
The dynamic audit is used to study the application execution. The audit is used to detect problems such as:
  • Excessive memory consumption,
  • Slowness of algorithms used,
  • Errors "hidden" at run time,
  • ...
A dynamic audit can be performed in a test environment or on a live application.
The "WW_Optimization" project contains a specific page triggering errors that can be detected by the dynamic audit.
The dynamic audit and the project test will be started at the same time.
  • To start the dynamic audit on the "WW_Optimization" project:
    1. In the ribbon, on the "Project" pane, in the "Test mode" group, expand "Test mode" and select "Debug the project while the audit is enabled". The project test is run.

      Note

      The dynamic audit of project can also be started from the project dashboard, via the "Dynamic audit" widget. You must:
      • enable the Widget if necessary (click the link "Click here to re-enable").
      • expand the arrow and select "Detailed Go of project".
      Note: The dynamic audit is automatically run whenever a project GO is performed. A status report is automatically displayed in the dashboard:
    2. Click the "Test page of dynamic audit" button.
    3. Click the different buttons found in the page.
      • At the end of each process, a toast message is displayed to specify that the process is over.
        Note: Wait for the toast to be displayed before clicking another button.
      • For the "Assertion and Exception" option, an assertion is displayed: click "Continue" in order for the message to appear in toast format.
    4. Stop the site test.
    5. The report window of dynamic audit is displayed.
  • Let's study this window:
    • The top section of this window is used to choose the display mode of data. You can:
      • choose a chronological display (respecting the order in which the events occurred) or an overall display, used to group the different types of problems. During a chronological display, a chronological border allows you to see the position and importance of problems.
      • choose the type of problem to display (error, assertion, ...). This allows you for example to concentrate on the major errors, ...
    • The bottom section displays the different events that occurred and that may cause problems in the application.
  • In this example, the dynamic audit detects several problems:
    • A SWITCH statement for which no CASE is run,
    • A triggered assertion,
    • A triggered exception,
    • The assignment of a nonexistent image file to an Image control.
    For each problem, a "..." button is used to access the event details. If the event is linked to a specific line of code, the button allows you to open the code editor directly at the corresponding location in order to fix the problem.
  • Close the window of dynamic audit.

Note

The dynamic audit of a project can also be performed when the site is deployed.
All you have to do is call dbgEnableAudit to trigger the dynamic audit. The audit generates a ".wdaudit" file, this file must be loaded in the development environment in order to study the result.
See Dynamic audit for more details.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 24
Comments
Click [Add] to post a comment