microsoft / vstest

Visual Studio Test Platform is the runner and engine that powers test explorer and vstest.console.
MIT License
898 stars 323 forks source link

DotNet Test returns non-zero without any output from Process #2766

Closed dansiegel closed 2 years ago

dansiegel commented 3 years ago

Description

Working from within the context of a custom dotnet cli tool that does a build and some customization prior to running tests, the tool fails when it invokes dotnet test from

Steps to reproduce

Assuming that you would have a CLI command like the following:

dotnet test <ProjectPath>/TestApp.UITests/TestApp.UITests.csproj --output= <ProjectPath>/UITest/bin/uitest/ --configuration=Release --no-build --results-directory= <ProjectPath>/UITest/Results --logger=trx

Within a custom CLI tool start a new process using the dotnet exe Pass the arguments to the ProcessInfo

Start the process

The process almost immediately returns with a non zero exit code

Expected behavior

The Tests should run like it does when manually invoked from a custom CLI tool

mycommand -p <ProjectPath>

Actual behavior

dotnet test immediately returns with an exit code 1 and no Standard or Error output.

Diagnostic logs

test.log

Environment

macOS 11.2.1 DotNet SDK 3.1.406

nohwnd commented 3 years ago

The syntax looks a bit broken in your example. There are some extra spaces after =, is that just a copy paste error?

I would start by adding --diag=<ProjectPath>/logs/log.txt to the command line to enable diagnostic logging. Please upload the log here if you are willing to share it.

dansiegel commented 3 years ago

@nohwnd It seems that there was some strange error being caused from having it use the working directory of the output directory even though we were specifying --no-build... I've removed that and dotnet test now runs as expected. I would still say there is probably an issue with it needing to have some sort of error output if we're getting a non-zero exit code.