airframe icon indicating copy to clipboard operation
airframe copied to clipboard

airspec: Report failed test names at the end

Open xerial opened this issue 3 years ago • 3 comments

It's often difficult to find failed test cases when a lot of debug messages are reported to the terminal. Reporting the failed test names when test finishes would be helpful.

xerial avatar Dec 17 '22 10:12 xerial

Inspiration

MUnit 1.0.9

Same as AirSpec. Class name only (sbt handles this?)

[error] Failed: Total 618, Failed 1, Errors 0, Passed 617
[error] Failed tests:
[error]         org.scalasteward.core.buildtool.BuildToolDispatcherTest
[error] (core / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 70 s (01:10), completed Dec 17, 2022 10:19:37 PM

ScalaTest 3.2.14

Some extra info, but still class name only.

[info] Run completed in 5 seconds, 336 milliseconds.
[info] Total number of tests run: 88
[info] Suites: completed 10, aborted 0
[info] Tests: succeeded 86, failed 2, canceled 1, ignored 2, pending 0
[info] *** 2 TESTS FAILED ***
[error] Failed tests:
[error]         better.files.ScannerSpec
[error]         better.files.DisposeSpec
[error] (core / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 26 s, completed Dec 17, 2022 10:24:54 PM

Ruby's RSpec

File path, line number and test name.

Finished in 0.26446 seconds (files took 0.85656 seconds to load)
117 examples, 2 failures

Failed examples:

rspec ./spec/foo/bar/my_class_spec.rb:4 # Foo::Bar::MyClass has a string representation
rspec ./spec/foo/buz_spec.rb:62 # Foo::Buz does something cool

Rust's cargo test

Test names, no file path or line number.

failures:
    test_serialized_as_tuple::go
    use_correct_decoded_variable_name::scala

test result: FAILED. 192 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

error: test failed, to rerun pass `-p typeshare-core --test snapshot_tests`

exoego avatar Dec 17 '22 13:12 exoego

Personally, I preferr RSpec's way (full set: file path, line number and test name). Since one can spot the exact line easily. But maybe it is noisy. Test class and test name may be enough.

exoego avatar Dec 17 '22 13:12 exoego

Rspec-like reporting looks good.

xerial avatar Dec 17 '22 21:12 xerial