1

I am trying to implement re-run logic for my scenario outline

@DOC-136 @DOC-137 @DOC-138 @DOC-139 @Browser:Chrome Scenario Outline: AT01.01 - Test Workflow - Create a case When I open Create New Case And I fill the required fields with Zirconia, Monolithic, E2E Test CaseItems | Field | Value | | Items | <CaseItems> | Examples: | Name | CaseItems | Teeth | Jama doc | | Removable | Test Partial denture | 17-31 | DOC-136 | | Implant Studio | Surgical guide | 10-15 | DOC-137 | | Full Denture | Full denture | 2 | DOC-138 | | Copy Denture | Copy denture | 2 | DOC-139 | | Appliance | Splints 

I need to re-run only one example DOC-136, so I am trying to use such logic

First to take failed test name

 if ($failedTests) { $failedTestNames = $failedTests | ForEach-Object { $_.testName } } else { Write-Host "No failed tests found." } if ($failedTestNames.Count -gt 0) { $testNameFilter = $failedTestNames -join '|' Write-Host "Generated Test Name Filter: $testNameFilter" "testNameFilter=$testNameFilter" >> $env:GITHUB_OUTPUT } 

And than to build a filter to re-run

$currentRerun = 1 $testFilter = $env:FAILED_TEST_FILTER $folderName = "${{ steps.run-tests.outputs.folderName }}" Write-Host "Oroginal Test Filter: $testFilter" $escapedTestFilter = $testFilter.Replace('"', "'") Write-Host "Escaped test filter for command line: $escapedTestFilter" $finalFilter = "(FullyQualifiedName~$escapedTestFilter) & ${{ inputs.Browser }}" Write-Host "Final filter being passed to dotnet: $finalFilter" if('${{inputs.Environment}}' -eq 'Linux') { xvfb-run dotnet test ` --no-build ` --verbosity normal ` --configuration Release ` --filter "(FullyQualifiedName~$escapedTestFilter) & ${{ inputs.Browser }}" ` --results-directory TestResults/$folderName ` --logger "trx;LogFileName=TestResults_Rerun_$currentRerun.trx" } 

My --filter is look like this

(FullyQualifiedName~AT01_01_TestWorkflow_CreateACase('Removable','Test Partial denture','17-31','DOC-136',null)) & Category=Browser:Chrome 

But I have such error

An exception occurred while invoking executor 'executor://nunit3testexecutor/': Incorrect format for TestCaseFilter Missing Operator '|' or '&'. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed. 
1
  • Some relevant info, but I'm not sure if it answers your question: Retry flaky tests with dotnet test and PowerShell. Azure DevOps pipelines has a task that retries tests, but it doesn't look like dotnet test supports this, so you'll need a workaround. Commented Jul 22 at 15:14

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.