junit.testlogger icon indicating copy to clipboard operation
junit.testlogger copied to clipboard

Run tests from VS TestExplorer

Open maximusmp opened this issue 3 years ago • 4 comments

Hello!

I'm using your library via a .runsettings file in VS 2022 to specify the Logger. If I run the Unit Tests by using command "dotnet vstest" and specifying the settings file everything runs perfectly, but if I use TestExplorer to run the same tests (after setting the same runsettings file from menu "Test->Configure Run Settings") I have some problems with the report, e.g.: the timestamp is always "0001-01-01T00:00:00"; the {assembly} attribute for the log file name does not work; etc.

Thank You

maximusmp avatar Jul 08 '22 08:07 maximusmp

Just adding a note: the same issue also happens if I specify the "Tests" parameter from the command line.

Examples: "dotnet vstest .\UnitTestProject1.dll /Settings:test.runsettings" works "dotnet vstest .\UnitTestProject1.dll /Tests:TestMethod2 /Settings:test.runsettings" does not work.

maximusmp avatar Jul 08 '22 08:07 maximusmp

@maximusmp thank your for reporting this! What is the test framework (mstest/xunit etc.) used for UnitTestProject1.dll?

@Siphonophora IIRC the /tests argument might be invoking a different execution path for the unit tests, this is adapter specific. It may be a good idea to repro this in testlogger first.

codito avatar Jul 10 '22 17:07 codito

Hi,

the test framework for the project is MSTest, but I tried with a test which uses xUnit and the result was the same.

maximusmp avatar Jul 11 '22 07:07 maximusmp

Did a quick repo on one of my own projects to start. I was able to repo these using both the test.runsettings and command line.

  • Only when including the /Tests filter do these happen:
    • I see the timestamp issue when running dotnet vstest .\TestLib.dll --logger:"junit;" /Tests:Load.
    • No logged file dotnet vstest .\TestLib.dll --logger:"junit;LogFilePath=TestResults/{assembly}.{framework}.results.xml" /Tests:Load. Using the {framework} tag by itself fails to produce a file.
    • dotnet vstest .\TestLib.dll --logger:"junit;LogFilePath=TestResults/{assembly}.results.xml" /Tests:Load logged file name wrong: TestResults/.results.xml

@maximusmp Are there any other issues you are seeing? Nothing else jumps out at me from testing so far.

Siphonophora avatar Jul 14 '22 14:07 Siphonophora

Closing as inactive

Siphonophora avatar Nov 30 '22 01:11 Siphonophora