Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do my tests in an Azure DevOps Build Pipeline run twice?

Tags:

azure-devops

I'm studying automation in Azure DevOps. My tests are OK, but I can not understand some things. I have two questions ...

  1. In my project there is only one test, only one test method. Why does the azure run this test twice? As marked in red on the print.

  2. Is there a way to name the tests? Or will they always appear as TheUntitledTestCaseTest?

Here is the screenshot

like image 658
Carlos Messias Avatar asked Dec 22 '22 22:12

Carlos Messias


2 Answers

We ran across the same issue on our pipelines and the way we could resolve it was Advanced execution options -> Batch tests-> is selected by default "based on number of tests and agents". When we changed it to "Based on test assemblies" - it works fine. Might help.

Select Based on test assemblies

like image 168
Sourabh Massey Avatar answered Feb 25 '23 11:02

Sourabh Massey


I had this issue only with some tests. After digging a bit I noticed that I have the tests present in different classes in the agent working folder only, they were not present in the source code. The cause was that I have renamed some test classes with those tests, but I was not properly cleaned the workspace on getting latest source step.

So setting in my first step "Get sources" Clean to true and clean options to "All build directories" solved the issue.

like image 31
K. B. Avatar answered Feb 25 '23 09:02

K. B.