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

(PDK-674) UX Improvement for listing unit test files. #349

Merged
merged 3 commits into from
Nov 14, 2017

Conversation

bmjen
Copy link
Contributor

@bmjen bmjen commented Nov 14, 2017

This PR Improves how pdk test unit --list outputs unit test list. It will display a list of test files that contain examples. This output should contain file paths that can then be passed into --tests= as a comma-separated list.

This PR also adds a --verbose or -v option to display more information about the examples in each test file.

[~/proj/sdk/test_modules/testmod]$ pdk test unit -h
NAME
    unit - Run unit tests.
USAGE
    pdk test unit [options]
OPTIONS
       --list                     List all available unit test files.
       --tests=<value>            Specify a comma-separated list of test
                                  files to run.
    -v --verbose                  Outputs more detail.
OPTIONS FOR TEST
    -d --debug                    Enable debug output.
    -f --format=<value>           Specify desired output format. Valid
                                  formats are 'junit', 'text'. You may also
                                  specify a file to which the formatted
                                  output is sent, for example:
                                  '--format=junit:report.xml'. This option
                                  may be specified multiple times if each
                                  option specifies a distinct target file.
    -h --help                     Show help for this command.
       --version                  Show version of pdk.
[~/proj/sdk/test_modules/testmod]$ pdk test unit --list
Test Files:
./spec/classes/testmod_spec.rb
./spec/defines/foo_spec.rb
[~/proj/sdk/test_modules/testmod]$ pdk test unit --list -v
Test Files:
./spec/classes/testmod_spec.rb
        ./spec/classes/testmod_spec.rb[1:1:1]   testmod on centos-7-x86_64
        ./spec/classes/testmod_spec.rb[1:2:1]   testmod on debian-8-x86_64
        ./spec/classes/testmod_spec.rb[1:3:1]   testmod on oraclelinux-7-x86_64
        ./spec/classes/testmod_spec.rb[1:4:1]   testmod on redhat-7-x86_64
        ./spec/classes/testmod_spec.rb[1:5:1]   testmod on scientific-7-x86_64
        ./spec/classes/testmod_spec.rb[1:6:1]   testmod on ubuntu-16.04-x86_64
        ./spec/classes/testmod_spec.rb[1:7:1]   testmod on windows-10-x64
        ./spec/classes/testmod_spec.rb[1:8:1]   testmod on windows-2008 R2-x64
        ./spec/classes/testmod_spec.rb[1:9:1]   testmod on windows-2008-x64
        ./spec/classes/testmod_spec.rb[1:10:1]  testmod on windows-2012 R2-x64
        ./spec/classes/testmod_spec.rb[1:11:1]  testmod on windows-2012-x64
./spec/defines/foo_spec.rb
        ./spec/defines/foo_spec.rb[1:1:1]       testmod::foo on centos-7-x86_64
        ./spec/defines/foo_spec.rb[1:2:1]       testmod::foo on debian-8-x86_64
        ./spec/defines/foo_spec.rb[1:3:1]       testmod::foo on oraclelinux-7-x86_64
        ./spec/defines/foo_spec.rb[1:4:1]       testmod::foo on redhat-7-x86_64
        ./spec/defines/foo_spec.rb[1:5:1]       testmod::foo on scientific-7-x86_64
        ./spec/defines/foo_spec.rb[1:6:1]       testmod::foo on ubuntu-16.04-x86_64
        ./spec/defines/foo_spec.rb[1:7:1]       testmod::foo on windows-10-x64
        ./spec/defines/foo_spec.rb[1:8:1]       testmod::foo on windows-2008 R2-x64
        ./spec/defines/foo_spec.rb[1:9:1]       testmod::foo on windows-2008-x64
        ./spec/defines/foo_spec.rb[1:10:1]      testmod::foo on windows-2012 R2-x64
        ./spec/defines/foo_spec.rb[1:11:1]      testmod::foo on windows-2012-x64
[~/proj/sdk/test_modules/testmod]$

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 92.479% when pulling ca6f5ff on bmjen:pdk-674 into fe340a8 on puppetlabs:master.

@@ -29,17 +29,53 @@
expect(PDK::Test::Unit).to receive(:list).with(no_args).once.and_return([])
end

it { expect { test_unit_cmd.run_this(args) }.to output(%r{No examples found}m).to_stdout }
it { expect { test_unit_cmd.run_this(args) }.to output(%r{No test files with examples found}m).to_stdout }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the 'm' do in these expects?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The m allows the regex to be matched across multiple lines.

Copy link
Contributor

@HelenCampbell HelenCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from me, output looks much better 👍

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 92.479% when pulling 9499d28 on bmjen:pdk-674 into fe340a8 on puppetlabs:master.

Pinning the license_finder gem dep to 3.0.4, because the newer versions
depend on blankslate which doesn't pass the license_finder scan for
approved licenses.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 92.479% when pulling 7a81596 on bmjen:pdk-674 into fe340a8 on puppetlabs:master.

@bmjen bmjen merged commit 43b4d08 into puppetlabs:master Nov 14, 2017
@bmjen bmjen deleted the pdk-674 branch November 14, 2017 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants