Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change test run timeout?

Some of my test classes take longer than a minute to run and I can't complete them because it cancels it saying:

Canceling test run: test run timeout of 60000 milliseconds exceeded.

Is this configurable somewhere? I'm using the latest versions of:

  • Visual Studio for Mac
  • xunit
  • xunit.runner.visualstudio
  • Microsoft.NET.Test.Sdk
like image 808
Karl Green Avatar asked Dec 14 '17 11:12

Karl Green


People also ask

How will you set the timeout in test cases?

To specify the timeout period of a certain test case, “timeout” attribute is mentioned on the annotation @Test . Note that the timeout time is specified in milliseconds. In the above test, execution will be timed out after 500ms with the below message.

How do I increase my mocha timeout?

Whenever you run Mocha at the command line, it will read this file and set a timeout of 5 seconds by default. Another way which may be better depending on your situation is to set it like this in a top level describe call in your test file: describe("something", function () { this. timeout(5000); // tests... });


1 Answers

VS Test, which is used by Visual Studio for Mac to run the .NET Core Test project tests, supports passing a run settings file on the command line. This allows you to set a timeout.

Looking at the Visual Studio for Mac source code it seems this value of 60 seconds is unfortunately hard coded.

Visual Studio for Mac generates its own run settings which it passes to the VS Test runner.

You may want to report this on the Visual Studio for Mac developer community forum or open a GitHub issue so you can be notified when it gets fixed.

like image 191
Matt Ward Avatar answered Oct 10 '22 07:10

Matt Ward