Custom Specflow Report
This guide provides step-by-step instructions on how to generate a custom SpecFlow report in LambdaTest HyperExecute. By following the specified changes in the YAML file and modifying the test script, users can receive detailed test reports via email.
Prerequisites
- A valid LambdaTest account.
- A configured HyperExecute environment.
- A SpecFlow-based test suite.
Configuration Changes
To enable custom SpecFlow reporting, make the following changes to your YAML configuration file and test script.
Step 1: Modify the YAML Configuration File
Add the following settings in your YAML file to enable reporting and configure partial reports:
report: true
partialReports:
location: YOUR_REPORTS_LOCATION
type: xml
frameworkName: specflow-custom
email:
to: [YOUR_EMAIL_ID]
metaInfo: [ "project-name:YOUR_CUSTOM_PROJECT_NAME", "project-env: YOUR_CUSTOM_PROJECT_ENV" ]
Explanation:
report: true
→ Enables the reporting feature.partialReports.location
→ Specifies the directory where the partial reports will be stored.partialReports.type: xml
→ Configures the report format as XML.partialReports.frameworkName: specflow-custom
→ Sets the framework name.email.to
→ Defines the recipient email address where the reports will be sent.email.metaInfo
→ Adds metadata, including project name and environment details, to the report.
Step 2: Modify the Test Script
Add the following capability in your test script to ensure the correct execution status is recorded:
((IJavaScriptExecutor)driver).ExecuteScript($"lambda-info=suitename:YOUR_SUITE_NAME:passed");
Explanation:
- This script sends test execution information (suite name and status) to LambdaTest.
- Replace
YOUR_SUITE_NAME
with the appropriate suite name. - The passed status can be dynamically changed based on the test result.
Step 3: Report Generation and Email Notification
Once the tests are executed, the custom SpecFlow report will be generated and sent to the configured email address. The report will include:
- Tag-based test summaries and details.
- Suite-based test summaries and details.
- Number of tests passed, failed, skipped, or with other statuses.
- Meta information such as project name and environment.
