Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Generating Silk Test Workbench HTML result file

Generating Silk Test Workbench HTML result file

This article provides steps to setup Silk Test Workbench tests to generate a single html pass or fail result file with execution times for both Visual Tests or VB.NET scripts.

The solution provided in this article is a VB.NET solution. By default the generated html result file is stored in "C:\ResultsFiles", if you wish to change the path to the result directory, you can do so in line 3 of CreateHTMLRes VB.NET script.  In addition,  the solution takes an additional argument of the Silk Test Workbench logged-in user, which you can specify in your test, if this information is not provided, then the domain user is used.  You should not require any further modifications to the provided scripts unless you wish to add additional functionality to the solution.

In order for the solution to function correctly, please ensure that you have disabled the Silk Test Workbench general playback option 'Catch Exceptions when Thrown' and set its value to 'No'.  This option was introduced in Silk Test Workbench 13.0.

Solution details:

You will find attached to this article STWB_Res2HTML.zip.  This archive contains the required VB.NET scripts to generate the HTML result file at the end of the test execution.

The following VB.NET scripts are included:
    - Common.CreateHTMLRes
    - Common.GetStartTime
    - Common.Res2HTML
    - Common.CloseHTMLRes

Below are the list of input / output variables of the above scripts:
    - Common.CreateHTMLRes
        Input variables:
            - script_name
            - user_name
        Output variables:
            - start_time
            - res_file
    
    - Common.GetStartTime
        Input variables:
            - none
        Output variables:
            - start_time

    - Common.Res2HTML
        Input variables:
            - start_time
            - script_name
            - last_error
            - res_file
        Output variables:
            - none

    - Common.CloseHTMLRes
        Input variables:
            - start_time
            - res_file
        Output variables:
            - none


The article also provides an example project, STWB_Res2HTML_ProjectExample.zip, which provides templates on how to setup your existing Visual Tests or VB.NET scripts to use the solution.

The following project template files are included:

    Visual Test Templates:
        - Res2HTML.Driver_VisualTest
        - Res2HTML.Test1_VT
        - Res2HTML.Test2_VT
        - Res2HTML.Standalone_VisualTest

Res2HTML.Driver_VisualTest example HTML result


    VB.NET Script Templates:
        - Res2HTML.Driver_TestScript
        - Res2HTML.Test1_TS
        - Res2HTML.Test2_TS
        - Res2HTML.Standalone_Script

Res2HTML.Standalone_Script example HTML result


Below are the variable / parameter requirements for each script type.

Visual Tests:

    Driver Visual Tests:

    1) Must contain the local variables (of Text)
        - res_file
        - start_time

    Visual Tests to be called by the Driver Visual Test:

    1) Must contain the parameter (of Text)
        - res_file

    2) Must contain the local variables (of Text)
        - last_error
        - start_time

    Standalone Visual Test:

    1) Must contain the local variables (of Text)
        - last_error
        - res_file
        - start_time

VB.NET Script:

There is no requirement to create input or output parameters from the UI for the provided VB.NET script templates, but instead they have been created for you in the scripts.  Therefore, review the script templates and follow the same structure in your scripts.  Comments have been provided in the script templates to show where you should insert your scripts.


Key Points:

1) In order for the solution to function correctly, please ensure that you have disabled the Silk Test Workbench general playback option 'Catch Exceptions when Thrown' and set its value to 'No'.  This option was introduced in Silk Test Workbench 13.0.  This is to allow the ErrorHandler statements used in the example project templates to produce expected results.

2) This solution also requires that you maintain the use of the ErrorHandler statements shown in the Visual Test and VB.NET script templates when creating your own tests.  The ErrorHandler statements allow the solution to capture the error text to the HTML result.

    a) For a Visual Test, the error text is stored in the reserve variable st_LastError.
    Use the Expression designer to store the error text to the last_error local variable of the script.

    b) For a VB.NET script, the error text is stored in the description method of the ErrorHandler variable Err.
    You can retrieve the error text by calling Err.Description and storing this data to the last_error variable.



Attachments:

6888.STWB_Res2HTML.zip

0882.STWB_Res2HTML_ProjectExample.zip

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Comments

I am trying to import 0882.STWB_Res2HTML_ProjectExample.xml file, but keep on getting "No assets were retrieved from the specified media." Please reply

sumit04, that XML file is exported from 13.5.5.6149, are you using an earlier version of Silk Test?  You can only import XML files that were generated from the current or previous versions of Silk Test.

eggbox, thanks for for your quick reply. I am having 14.0.3.6531 version of Silk Test. but still I am facing the issue.

The article refers to the situation where the XML file is corrupt and needs to be regenerated.  I opened both these files and put them through an XML validator, both files are fine (syntactically correct).  I also imported the files into the latest version of Silk Test (15.x) and they imported fine.

Can you open the files in something line IE, if this shows the file correctly then you know that there is something else going on with your machine.  Also, have you tried exporting one of your own assets (Visual test or .Net script) and reimporting it (possibly to a new database) to see whether you can actually export/import correctly.

Good luck.

Hello, everybody,

I'm looking for a solution to generate an HTML report for my Silk4j tests. DO you have any suggestion?

Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-07-08 10:50
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.