在 Ruby 的 test/unit 和其他此类 nunit 风格框架中,什么才是好的失败消息?
失败消息是否应该仅仅描述预期值与预期值不匹配的情况?
assert_match("hey", "hey this is a test", "The word does not exist in the string")
它应该描述您期望发生的情况吗?
assert_match("hey", "hey this is a test", "I expected hey to be in the string")
它应该描述为什么你希望这种行为发生吗?
assert_match("hey", "hey this is a test", "Program should provide a greeting")
它应该描述您认为测试可能失败的原因吗?
assert_match("konnichiwa", "konnichiwa this is a test",
"Program failed to use supplied i18n configuration")
有关测试的信息是否也应该存在于测试方法的名称和测试用例的名称中?
这是基于Ruby“test/unit”,如何在断言中显示消息 https://stackoverflow.com/questions/8450708/ruby-test-unit-how-do-i-display-the-messages-in-asserts/8468287#8468287