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

print controls, then tests; print header of describe, then individual test results #946

Merged
merged 2 commits into from
Aug 26, 2016

Conversation

vjeffrey
Copy link

@vjeffrey vjeffrey commented Aug 21, 2016

print indiv tests
@arlimus @chris-rock does this look right??

fixes #918

just pushed a commit to attempt to fix part of #899
899

i marked this as a wip just because i want to make sure that i have the right idea of what this should look like :) please let me know!! (also, I don't have any tests on them yet)

@vjeffrey vjeffrey changed the title print individual tests when in describe block wip: print individual tests when in describe block Aug 21, 2016
@vjeffrey
Copy link
Author

hmmm. wondering if the describe block should have the same kind of summary line as in the control. so it would say Users vjeffrey (1 failed) and then have the test cases below and tabbed in just as it is now. it would make it more clear.....and it would fit with what we do for controls. i might try to throw up another commit to see what that looks like

@arlimus
Copy link
Contributor

arlimus commented Aug 22, 2016

Desired output:

RSpec'y reporting

describe something do
   it { should do_sth }
   it { should be_sth }
end

We want what users already know from RSpec in the output:

Something
    it should do_sth
    it should be_sth

Mixing Controls and describe's

Given a file with:

control 1 ...
describe sth ...
control 2 ...
describe sth_else ...
...

we want the default output to be:

Profile: ...
Version: ...

v control-1: This is something in a control that passed ...
x control-2: This is something in the control that failed ...
...

sth
   should look_like this
   and also this
sth_else
   should be indented like RSpec 
....
  • Group controls and group describe contents in the output
  • 1-2 lines of whitespace between both groups

@vjeffrey
Copy link
Author

vjeffrey commented Aug 22, 2016

print indiv tests

@vjeffrey vjeffrey changed the title wip: print individual tests when in describe block print individual tests when in describe block Aug 22, 2016
@@ -344,43 +347,67 @@ def format_lines(lines, indentation)
lines.gsub(/\n/, "\n" + indentation)
end

def print_fails_and_skips(all, color)
def print_fails_and_skips(all, _color)
Copy link
Author

@vjeffrey vjeffrey Aug 22, 2016

Choose a reason for hiding this comment

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

no reason to take in color anymore, i'm not using it, i should remove it. also, the name of this should change, since we're printing fails skips and passes

@arlimus
Copy link
Contributor

arlimus commented Aug 23, 2016

@vjeffrey This looks great!! Could you add integration tests?

afaics: describe-only, controls should be covered, and the mixed output. See test/functional/inspec_exec_test.rb

@vjeffrey
Copy link
Author

my tests are being annoying. i'll fix them in a bit

@vjeffrey vjeffrey changed the title print individual tests when in describe block wip cuz i have to work on the tests: print individual tests when in describe block Aug 24, 2016
@vjeffrey vjeffrey changed the title wip cuz i have to work on the tests: print individual tests when in describe block print individual tests when in describe block; print controls, then tests; print header of describe, then test result Aug 25, 2016
@vjeffrey vjeffrey changed the title print individual tests when in describe block; print controls, then tests; print header of describe, then test result print controls, then tests; print header of describe, then individual test results Aug 25, 2016
@vjeffrey
Copy link
Author

vjeffrey commented Aug 25, 2016

oh shoot there's a couple tests that seem to be failing due to my change. not sure why though....i'll look.

so the tests that are failing here for me are failing for me on master too. hmmmm

@vjeffrey
Copy link
Author

updated
i decided to push an extra commit up real quick to fix up the spacing and stuff like you mentioned @chris-rock

@chris-rock
Copy link
Contributor

Thanks @vjeffrey for this great improvement. I would some edge cases and will track those in a followup ticket #984

@chris-rock chris-rock merged commit 9468007 into master Aug 26, 2016
@chris-rock chris-rock deleted the vj/print-indiv-tests branch August 26, 2016 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grouping multiple it blocks in one describe blocks ruins console output during test runs
4 participants