Closed vbamagician closed 1 year ago
After investigating the issue and referring to the official SpecFlow+LivingDoc documentation and support website here, a solution has been found to resolve the problem of the SpecFlow+LivingDoc report generation being skipped when the Run tests task fails or if any feature or scenario fails during the test execution.
The solution involves adding the following Non-LivingDoc Specific Parameters to the SpecFlowPlus@0
task configuration:
- task: SpecFlowPlus@0
displayName: 'LivingDoc'
inputs:
generatorSource: 'FeatureFolder'
projectFilePath: '$(SpecFlowReportFilePath)'
testExecutionJson: '$(TestExecutionJsonFilePath)'
projectLanguage: 'en'
continueOnError: true
condition: always()
timeoutInMinutes: 10
By including these parameters, the SpecFlow+LivingDoc report generation will no longer be dependent on the success or failure of the preceding Run tests task. The key parameters to note are:
Implementing these modifications to the YAML pipeline configuration allows the SpecFlow+LivingDoc report to be generated even in cases where failures occur during the test execution. Consequently, comprehensive test documentation will be available, enabling effective analysis, collaboration, and communication among team members and stakeholders.
It is recommended to verify the changes in your environment and ensure that all required dependencies and environment variables are correctly set up for the SpecFlow+LivingDoc task.
Please let us know if you encounter any further issues or require additional assistance.
Issue Description
Current Behavior:
Currently, when running a YAML pipeline in Azure DevOps to execute Playwright+SpecFlow .NET tests, the generation of the SpecFlow+LivingDoc report is being skipped if the preceding task, Run tests, fails or if any feature or scenario fails during the test execution.
Expected Behavior:
The SpecFlow+LivingDoc report generation should not be skipped even if the Run tests task fails or if any feature or scenario fails during the test execution. It is crucial to capture and document the test results and provide visibility into the test execution, regardless of the test outcome.
Steps to Reproduce:
trigger:
pool: vmImage: windows-latest
variables: ProjectPath: 'Sources/CPQUIPROD/*.csproj' SpecFlowReportFilePath: 'Sources/CPQUIPROD/' TestExecutionJsonFilePath: 'Sources/CPQUIPROD/bin/Debug/net6.0/TestExecution.json'
steps:
script: | echo Add other tasks to build, test, and deploy your project. echo See https://aka.ms/yaml displayName: 'Run a multi-line script'
task: UseDotNet@2 inputs: packageType: 'sdk' version: '6.0.x'
task: DotNetCoreCLI@2 displayName: New Manifest for tool inputs: command: custom custom: 'new ' arguments: tool-manifest
task: DotNetCoreCLI@2 displayName: Install Playwright CLI inputs: command: custom custom: 'tool ' arguments: install Microsoft.Playwright.CLI
task: DotNetCoreCLI@2 displayName: 'Build test project' inputs: command: 'build' projects: $(ProjectPath)
task: DotNetCoreCLI@2 displayName: 'Run tests' inputs: command: 'test' projects: $(ProjectPath) arguments: '-e BROWSER=chromium' testRunTitle: 'Chrome results' buildProperties: env:
very veyr important step. We have to set masked variables as environment variable
within a task from which it will be used.
CPQUI_PROD_PASSWORD: $(prod_password)
task: SpecFlowPlus@0 displayName: 'LivingDoc' inputs: generatorSource: 'FeatureFolder' projectFilePath: '$(SpecFlowReportFilePath)' testExecutionJson: '$(TestExecutionJsonFilePath)' projectLanguage: 'en'
Expected Result:
The SpecFlow+LivingDoc report generation should not be skipped and should execute regardless of the test outcome. This ensures that comprehensive test results and documentation are available for analysis and collaboration.
Additional Information:
It is essential to address this issue promptly as it hampers the ability to capture and present accurate test results when failures occur. The SpecFlow+LivingDoc report plays a crucial role in providing detailed test documentation and facilitating effective communication among team members and stakeholders.
Environment Information:
Possible Solutions:
Please feel free to provide any additional information, screenshots, or code snippets that may assist in resolving this issue effectively.