JavaScript: Configure the runtime engine and HTML report
This topic describes how to customize OpenText Functional Testing for Developers settings if you are running JavaScript tests.
Configure the runtime engine and HTML report
The LFT.init() method provides a default configuration for the OpenText Functional Testing for Developers runtime engine address and the HTML report of the test run's results.
You can customize these settings.
OpenText Functional Testing for Developers runtime engine address |
In the command line, add the address, address, using the format used by the framework you are testing on. For example, in Jasmine, use the following format:
|
Report fields |
In the command line, add the report field and the value using the format used by the framework you are testing on. For example, in Jasmine, use the following format: jasmine --<report field>=<value> Examples: jasmine --title="Run Results" jasmine --reportFolder=RunResults For the report fields and descriptions, see the Report Settings section in Customize test settings. Note for Mocha users: Use mochaReporter.js to generate the report, as follows:
For example:
|
OpenText Functional Testing for Developers runtime engine autolaunch |
Indicates whether the runtime engine is launched when the OpenText Functional Testing for Developers SDK is initialized. Default: true Example: jasmine --autoLaunch=false This is relevant only for local test runs. When running tests remotely (that is, the runtime engine and the AUT are on a different machine than the tests), this value must be set to false. Note: autolaunch is not supported in LFT.SDK.init(). For more details, see Run tests. |
-
Create a text file for JavaScript configurations. Call it, for example, JSconfig.json. If you already have one, open it.
-
Copy in the following code:
{ "address":"ws://localhost:5095", "autoLaunch": "true", "report":{ "enabled":"true", "reportFolder":"RunResults", "title":"Run Results", "description":"", "targetDirectory":".", "overrideExisting":"true", "reportLevel":"All", "snapshotsLevel":0 } }
-
Use this code as is, or modify the field values.
Tip:
- For report field descriptions, see the Report Settings section in Customize test settings
-
reportLevel can be "All", "Warning", "Error", "Off"
-
snapshotsLevel can be "All" or 0, "onError" or 1; "Off" or 2
For example: snapshotsLevel:"All" or snapshotsLevel:0
- Save the file.
- In your computer's environment variables, add a user variable called LFT_TEST_CONFIG. For the value, enter the name of your configuration file, for example <path>\JSconfig.json.
In the LFT.init() method, add the following code:
LFT.init({ address:'ws://localhost:5095', autoLaunch: true, report:{ reportFolder:"RunResults", title:"Run Results", description:"", targetDirectory: ".", overrideExisting:true, reportLevel:LFT.Reporter.ReportLevel.All, snapshotsLevel:LFT.Reporter.CaptureLevel.All } });
Tip:
- For report field descriptions, see the Report Settings section in Customize test settings
-
reportLevel can be "All", "Warning", "Error", "Off"
-
snapshotsLevel can be "All" or 0, "onError" or 1; "Off" or 2
For example: snapshotsLevel:LFT.Reporter.CaptureLevel.All or snapshotsLevel:0
Override the default report settings during runtime
You can configure report settings in your test script so that, during runtime, these settings override your project's default report settings.
You can configure the following settings:
- title
- description
- reportLevel
- snapshotsLevel
For example, to configure the report so that test object replay errors do not appear in the report, you can include the following in your test script:
LFT.Reporter.config().reportLevel = LFT.Reporter.ReportLevel.Off;
Note:
Make sure to add LFT.init() to your code before you configure the report settings.
The reportFolder, targetDirectory, and overrideExisting settings cannot be configured to override the default report settings. Attempting to configure these settings throws an exception.
See also: