我正在使用 Riot ( https://github.com/thumblemonks/riot ) 进行测试,尽管我们可以使用其他东西。
我得到这样的测试输出:
> ruby my_test_file.rb
Running a test
+ something works
+ something else works
- something failed
我想以编程方式访问这些信息。就像是:
test = TestClass.load("my_test_file.rb")
result = test.run
result.errors # some array