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

Vigia formmater #5

Closed
nogates opened this Issue Nov 11, 2014 · 6 comments

Comments

Projects
None yet
4 participants
@nogates
Owner

nogates commented Nov 11, 2014

As for now, vigia uses the default RSpec formatter specified on config. It uses a formatter block per each example to provide a more useful information (like the expectations and results), but most of the times, it outputs too much information, making hard to debug which is the real server error.

Vigia uses RSpec contexts as the way to define the variables used on the http requests. Therefore, it seems logical that the better way to output the errors would be using some kind of by context aggregation.

I was thinking in creating a new formatter which will output the information using the context to group the examples results. Although the backtrace of any single error will be still appended to the output, the idea is to reduce the amount of information on the screen per example

This would be an example of a failing context due an invalid http code response

$ bundle exec rake spec:vigia
...............F.......................................................................

Context `default` FAILED:  

- code_match: Failed
- headers:    Passed
- json_body:  Passed

Failed Examples

 - code_match 
     Failure/Error: expect(result.code).to be(expectations.code) }
       expected #<Fixnum:403> => 201
            got #<Fixnum:401> => 200

Context variables:

  - http_options:
    - method: GET
    - url: http://localhost/api/places?sort=name
    - payload: nil
    - headers: { content_type: 'application/json' }
  - expectations:
    - code: 201
    - headers:  { content_type: 'application/json' }
    - body: ' a json blob'
  - result:
    - code: 200
    - headers:  { content_type: 'application/json' }
    - body: ' a json blob'


Groups:
 - resource_group:          Places    [ apib/api.apib:5 ]
 - resource:                Places    [ apib/api.apib:8 ]
 - action:                  GET       [ apib/api.apib:10 ]
 - transactional_example:   0         [ apib/api.apib:12 ]
 - response:                201       [ apib/api.apib:13 ]


Finished in 1.94 seconds (files took 5.2 seconds to load)
88 examples, 1 failure

What do you think? Is there any other information you think it would be useful to have inside the output?

@beaglebot

This comment has been minimized.

Show comment
Hide comment
@beaglebot

beaglebot Nov 11, 2014

I'll give you a million points if you can include the line number of the resource that failed...

beaglebot commented Nov 11, 2014

I'll give you a million points if you can include the line number of the resource that failed...

@beaglebot

This comment has been minimized.

Show comment
Hide comment
@beaglebot

beaglebot Nov 11, 2014

The new error message looks useful though.

beaglebot commented Nov 11, 2014

The new error message looks useful though.

@smcphill

This comment has been minimized.

Show comment
Hide comment
@smcphill

smcphill Nov 11, 2014

Another million for providing that Groups segment 👍

I'd suggest a flag to toggle display of the output... even with a handful of tests, this could create a fair few screens of information to wade through

smcphill commented Nov 11, 2014

Another million for providing that Groups segment 👍

I'd suggest a flag to toggle display of the output... even with a handful of tests, this could create a fair few screens of information to wade through

@petervandoros

This comment has been minimized.

Show comment
Hide comment
@petervandoros

petervandoros Nov 12, 2014

Looks good. I second the request to be able to exclude the amount of data that is displayed. Especially, payload, headers, and body.

petervandoros commented Nov 12, 2014

Looks good. I second the request to be able to exclude the amount of data that is displayed. Especially, payload, headers, and body.

@nogates

This comment has been minimized.

Show comment
Hide comment
@nogates

nogates Dec 16, 2014

Owner

Going to release the formatter finally!

Owner

nogates commented Dec 16, 2014

Going to release the formatter finally!

@nogates

This comment has been minimized.

Show comment
Hide comment
@nogates

nogates Dec 16, 2014

Owner

all done here!

Owner

nogates commented Dec 16, 2014

all done here!

@nogates nogates closed this Dec 16, 2014

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