Howto resolve .net test hangs on “Starting test execution, please wait…”

前端 未结 4 907
感情败类
感情败类 2021-02-15 14:31

I am trying to execute dotnet test from the command line on our Jenkins build server, but it just hangs on:

Starting test execution, please wait...

4条回答
  •  后悔当初
    2021-02-15 15:36

    The versioning was a red herring and it turned out to be much simpler problem. My tests were testing Async controller methods, and my non-async tests were doing:

    var result = controller.PostAsync(request).Result;

    as soon as I changed the tests themselves to use the async/await pattern they worked fine:

    var result = await controller.PostAsync(request);

    Something that helped me diagnose the issue was using the dotnet test --verbosity d argument. When using this it was outputting some tests that were passing rather than just "Starting test execution, please wait". Interestingly every time I run the command it would execute a different number of tests before appearing to get stuck. This suggested there was perhaps some sort of thread deadlock issue which led me to the solution. I'm still unsure why the command ran fine on my local machine but not our Jenkins slave.

提交回复
热议问题