-
Notifications
You must be signed in to change notification settings - Fork 519
Need more information in pretty output #192
Comments
Those were both closed by the user without a response from the developer. I'll keep this open pending a response from the developer. |
While I'm not familiar with RSpec, a quick look suggests that the Your example with @test "foo equals bar" {
expected_result="bar"
run foo
assert_success
assert_output "$expected_result"
} Which would show you this:
I'm assuming You may need to wait quite a while for developer feedback as Bats is severly understaffed (#150). I got positive feedback from the developer during the early development of the I'm not trying to sell anything. Just wanted to give a bit more insight on how this is done in Bats. Use whatever feels right for your task. |
Ah, ok, thanks @ztombol. That really helps to clarify. You may be right about rspec-core and its relationship with the other gems; I've only ever used rspec as one bundle so I'm not sure how the individual gems are divided up. There doesn't seem to be any mention of the other libraries in the bats ecosystem in the README, wiki, or any other documentation I can find, but it sounds like the ones you've developed are what I'm looking for. I'll keep this issue open in case the developer (or, future developer, if the project is transferred to a new dev) wishes to comment. However, it seems likely that the response will be to use bats + bats-assert. |
If a test fails, the output looks like this:
foo.bash
:foo_spec.bash
:bats lets me know which particular assertion failed, but it gives me no useful information about what the expected result was or what the actual result was. This makes it challenging and time-consuming to debug the function or script under test. In order to figure out that bats expected
foo
to outputbar
but receivedbaz
instead, I have to add printf/echo-style debugging statements to my script and/or my bats spec.Compare this to, for instance, rspec:
foo.rb
:foo_spec.rb
:The rspec output clearly prints the expected value and the received value, making it easy to debug the failing function being tested. I can quickly and easily see that there is a typo in the return statement of the
foo
method.The text was updated successfully, but these errors were encountered: