vbamagician / IdeasAndIssues

This repository is dedicated to curating and maintaining a list of ideas and issues. Every idea and issue will be considered for implementation at some point.
0 stars 0 forks source link

Generation of SpecFlow+LivingDoc Report skipped when `Run Tests` task fails #3

Closed vbamagician closed 1 year ago

vbamagician commented 1 year ago

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:

  1. Deploy Playwright+SpecFlow .NET tests to Azure DevOps and set up the YAML pipeline.
  2. Include the following code snippet in the pipeline configuration:
    
    # Starter pipeline
    # Start with a minimal pipeline that you can customize to build and deploy your code.
    # Add steps that build, run tests, deploy, and more:
    # https://aka.ms/yaml

trigger:

pool: vmImage: windows-latest

variables: ProjectPath: 'Sources/CPQUIPROD/*.csproj' SpecFlowReportFilePath: 'Sources/CPQUIPROD/' TestExecutionJsonFilePath: 'Sources/CPQUIPROD/bin/Debug/net6.0/TestExecution.json'

steps:

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:

  1. Review the YAML pipeline configuration and ensure that the SpecFlow+LivingDoc task is not dependent on the success or failure of the preceding Run tests task.
  2. Check for any conditional statements or control flow settings that may be causing the skipping behavior and modify them accordingly.
  3. Consider implementing error-handling mechanisms within the pipeline to capture and handle failures appropriately while still allowing the SpecFlow+LivingDoc report generation to proceed.
  4. Validate that all required dependencies and environment variables are correctly set up for the SpecFlow+LivingDoc task.

Please feel free to provide any additional information, screenshots, or code snippets that may assist in resolving this issue effectively.

vbamagician commented 1 year ago

Issue Solution

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.