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

-show should have an option to write summarized passes #1002

Open
TravisEz13 opened this issue Feb 27, 2018 · 7 comments
Open

-show should have an option to write summarized passes #1002

TravisEz13 opened this issue Feb 27, 2018 · 7 comments

Comments

@TravisEz13
Copy link
Contributor

1. Provide a general summary of the issue in the Title above

-show should have an option to print only summarize passes. Example only a + per pass

2. Describe Your Environment

Operating System, Pester version and PowerShell version:

Pester version     : 4.1.1 /usr/local/share/powershell/Modules/Pester/4.1.1/Pester.psm1
PowerShell version : 6.0.1
OS version         : Unix 17.4.0.0

3. Expected Behavior

ability to print something per test case to satisfy CI requirement, but not full log

4.Current Behavior

To print something per test case I have to print the full test case information. I would like something smaller.

5. Possible Solution

invoke-pester -Show @([Pester.OutputTypes]::Describe,[Pester.OutputTypes]::Summary,[Pester.OutputTypes]::Failed,[Pester.OutputTypes]::PassedSummary)

Where PassedSummary causes only a + to be printed (no newline) per test case.

6. Context

I'm trying to get output similar to the following without having to do a lot a processing of the output:
image

@dlwyatt
Copy link
Member

dlwyatt commented Feb 27, 2018

If you need to do processing on the output, why not just use -PassThru and get nice objects to work with inestead of the text? PowerShell, man! :)

@johlju
Copy link
Contributor

johlju commented Feb 27, 2018

I like the idea that Travis proposes. It would simplify output when used in a CI pipeline. I think even when using the -PassThru parameter Pester still writes the full testing output to console. Or is there another parameter that can be used to minimize the output?

@nohwnd
Copy link
Member

nohwnd commented Feb 27, 2018

@johlju you can use -Show None to show no output to the console.

@nohwnd
Copy link
Member

nohwnd commented Feb 27, 2018

@TravisEz13 you can change the output with a small hack. You can reach inside of Pester module and replace Write-PesterResult with your custom function, like this:

&(get-module pester) { 
    ${function:Write-PesterResult} = { 
        param($TestResult)
        Write-host "abc"
    } 
}

That way you can work with the "raw data" directly, but you will also rely on internal details of the implementation. What I don't get is how you will understand which test has failed from that output. You will have to go back and run it again, or inspect the -PassThru. So personally I would use -Show Fails or -Show Failed, Summary to see short version of the test run.

@TravisEz13
Copy link
Contributor Author

@dlwyatt travis-ci requires that we output something periodically. -passthru doesn't meet our needs. Also, suppressing the logs was the opposite of my ask.
@nohwnd We have been able to do this without rewriting a pester function, I'm just proposing moving the functionality to Pester.

@nohwnd
Copy link
Member

nohwnd commented Feb 28, 2018

@TravisEz13 I am sorry, but to me this seems too niche to warrant adding another form of output to Pester. Hopefully we will have a general "plugin" solution some day, that would allow this kind of extension (or in this case reduction :D).

@TravisEz13
Copy link
Contributor Author

@nohwnd Without some solution, the logs become unreadable in our CI system. I hope we have enough usage of PowerShell that other projects face the same problem. Granted we have a solution but I think in the long run the solution needs to be moved into Pester.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants