soft-assert: Ruby Gem
Popular Ruby testing frameworks, including Minitest and Test::Unit, lack a built-in soft-assert feature. To address this limitation, developers typically implement custom solutions. We have come up with the Soft-Assert gem, bridges this gap, providing flexible assertion methods that elevate Ruby's testing capabilities.
The Soft Assert gem enhances testing capabilities with flexible assertion methods.Unlike traditional assertions, Soft Assert does not interrupt test execution on failure. Instead, it logs errors and continues testing, allowing you to identify and review all failures simultaneously.
This gem integrates smoothly with leading testing frameworks, including Minitest and Test::Unit, making comprehensive testing more efficient. To utilize Soft Assert effectively, simply use its assertion methods during testing. Then, conclude with SoftAssert.assert_all to review and fail the test if any failures were captured.
Install
gem install soft-assert
Gem file need to update as
gem 'soft-assert', require: 'soft_assert'
e.g.
SoftAssert.assert_equal(actual, expected, message to be logged for failure)
SoftAssert.true(flag, message to be logged for failure)
SoftAssert.assert_all
All other supported methods
Gem Link: https://rubygems.org/gems/soft-assert
This looks extremely useful, but I haven't been able to get it working. Do you have a pointer to some example code? Thanks!