Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--explore - output to stdout/allow format option to be specified without specifying output file #130

Open
Osipion opened this issue Nov 8, 2016 · 4 comments
Labels
Enhancement V4 All issues related to V4 - use -label:V4 to get non-V4 issues
Milestone

Comments

@Osipion
Copy link

Osipion commented Nov 8, 2016

Currently the --explore option with no arguments will list the tests available in the assembly in a flat text list:

>nunit3-console SomeTests.dll --explore
NUnit Console Runner 3.5.0
Copyright (C) 2016 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 10.0.10586.0
  CLR Version: 4.0.30319.42000

Test Files
    SomeTests.dll

SomeTests.Class1.Test1

I want this list in the NUnit3 xml format, but when I try this

nunit3-console MHR.Test.Recruitment.Features.dll --explore;format=nunit3

An exception message is displayed.

I would prefer not to have to dump the results to a file to read them. Is there anyway I can get XML output from stdout using --explore?

@CharliePoole
Copy link
Member

Your command-line is in error. The message indicates that "--explore;format" is not a valid option. That's because a semicolon has no special meaning where you are using it - it's just another character. Only space, colon or equal function to separate an option from it's value. IOW, you are trying to set "explore;format" equal to "nunit3".

Using, for example, "--explore:format=nunit3" (with a colon) works in a fairly perverse way: it saves the output in nunit3 format (the default) in a file named "format=nunit3"!

So you are correct: there is no way to cause the nunit3 format XML output to go to the console.

We will need to discuss this to decide whether to accept it as a possible enhancement of NUnit. Can you explain the use case? Why do you want the XML to go to the console?

@Osipion
Copy link
Author

Osipion commented Nov 8, 2016

@CharliePoole - thanks for the quick response. I agree the command line is incorrect, it was an attempt at an example of what I wanted. I indeed ended up with quite a few files called "nunit3" or "=nunit3" etc, and I couldn't see any test cases in the console source code covering this use case.

The reason I'd like it is that I have a test execution script that reads the test fixtures available in an assembly and allocates them to available execution environments. At the moment I'm spewing a bunch of temp files into my build server's %TEMP% directory. It would be much nicer to simply read the info from stdout and act on it, without having to worry about managing temp files.

@CharliePoole
Copy link
Member

@Osipion I figured you wanted to pipe the output... that makes sense.

@nunit/core-team What do you think?

@pavzaj
Copy link

pavzaj commented Jan 31, 2017

I also would like to have option to print formatted output to cosnole to avoid creating temp files.
What do you think about such change:
pavzaj@88f4338

?

It has a drawback, because it is not clear where nunit technical headers end and where output starts, but it suits my needs.

@CharliePoole CharliePoole added this to the 4.0 milestone Mar 8, 2022
@CharliePoole CharliePoole modified the milestones: 4.0, 4.1 Sep 15, 2022
@CharliePoole CharliePoole added the V4 All issues related to V4 - use -label:V4 to get non-V4 issues label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement V4 All issues related to V4 - use -label:V4 to get non-V4 issues
Projects
None yet
Development

No branches or pull requests

3 participants