'VSTest task in Azure devops timing out after 60 minutes

I implemented a test method using MSTest2, the execution of the test code takes about a minute. This test uses DataTestMethod with DynamicData source. The result of expansion of the dynamic data results in more than a 100 tests. When I run the test in Azure Pipeline, the test times out exactly at 60 minutes. I've tried several options

  • Timeout on job
  • customRunTimePerBatchValue on the test input.

Neither works! It makes using DataTestMethod useless. Any suggestions of how to fix this?

Regards.

Previously I had mentioned job above when I actually meant Task as that's what I had tried. Putting the timeout on the job seems to fix it.



Solution 1:[1]

Agree with Daniel,

If your project is private and you are using hosted agent, check this doc: One free parallel job that can run for up to 60 minutes each time, until you've used 1,800 minutes (30 hours) per month. You can pay for additional capacity per parallel job. Paid parallel jobs remove the monthly time limit and allow you to run each job for up to 360 minutes (6 hours). Buy Microsoft-hosted parallel jobs.

Another way is configure self-hosted agent and open build definition->click option tab and change the value of field Build job timeout in minutes to 0, then it should be work. We could check this doc for more details.

enter image description here

Solution 2:[2]

Setting timeoutInMinutes: 0 on the job (not on the VSTest task) seems to remove the 60 minute restriction.

Solution 3:[3]

For self-hosted agents, in case your pipeline is built using 'yaml' file (a CI pipeline), then you may want to set the VSTest@2 as a task under 'jobs' as shown below:

jobs:
- job: myJob
  timeoutInMinutes: 0
  pool:
    name: myTestAgentPool
  steps:
  - task: VSTest@2
    displayName: 'Test run for Test plans'
    inputs:
      testSelector: testPlan
      testPlan: xxxxx
      testSuite: xxxxx

Setting 'timeoutInMinutes' to 0 will remove any timeout limitation for all steps under 'myJob'. You can setup different jobs likewise.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vito Liu
Solution 2 loganwol
Solution 3 Kartik Javali