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 6.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: 15 mn
Previous LessonTable of contentsNext Lesson
What is an audit?
Audits provide a set of features that allow you to:
  • automatically improve the quality and performance of a project.
  • monitor the conditions in which it operates more precisely.
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 check these audits on the "WD 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 "WD Optimization" project:
    1. On the "Project" pane, in the "Audit and performance" group, expand "Edition audit" and select "Trigger the edition audit".

      Note

      The static audit of project can also be started from the project dashboard, via the "Static audit and Compilation" widget.
      You must:
      • enable the Widget if necessary (click the link "Click here to re-enable").
      • click the arrow.
    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.
    5. The audit report is displayed:
The static audit includes:
  • The static audit of project.
  • The audit for the content of application library.
  • The audit of setup content.
  • 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 that lists the orphan elements is displayed.
    2. The "WIN_UnusedWindow" window 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 window will not be taken into account anymore during the audit. This option can be interesting when using a test window specific to the development for example.
      • delete the element if it is actually unused ("Delete" button).
      • see the element ("View" button).
      • find the use cases in the strings for example ("Search" button).
    3. In our case, this "WIN_UnusedWindow" window 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 executable and 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 "WD Optimization" project contains a specific window 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 "WD Optimization" project:
    1. 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 the project can also be started from the project dashboard, via the "Execution" 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 the application is started by a project GO. A status report is automatically displayed in the dashboard:
    2. Click the "Test window of dynamic audit" button.
    3. Click the different buttons found in the window. At the end of each process, a toast message is displayed to specify that the process is over. 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 application 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. In this case, the 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 of this window displays the different events that occurred and that may cause problems in the application.
  • In this example, the dynamic audit detects several problems:
    • An excessively long caption that is assigned by programming,
    • A SWITCH loop for which no CASE is run,
    • An assertion is triggered instead of an exception,
    • The opening of a file that does not exist,
    • 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 an application is deployed on the user computers.
You can:
  • modify the application and use dbgEnableAudit to start the audit.
  • use a text file in the application directory. This solution allows you not to modify the executable. All you have to do is create, in the directory of the executable, a file named like the executable and whose extension is ".WX".
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