Ruby测试:在测试用例中打印
我是Ruby测试的新手,Google帮不了我 使用Test/Unit,如何打印实例变量,如Ruby测试:在测试用例中打印,ruby,unit-testing,Ruby,Unit Testing,我是Ruby测试的新手,Google帮不了我 使用Test/Unit,如何打印实例变量,如 test "thing to happen" do do_stuff assert_equal "foo", @variable p @varible end Ruby可以将消息输出到test runner控制台: test "thing to happen" do do_stuff assert_equal "foo", @variable, "@variable is #{@va
test "thing to happen" do
do_stuff
assert_equal "foo", @variable
p @varible
end
Ruby可以将消息输出到test runner控制台:
test "thing to happen" do
do_stuff
assert_equal "foo", @variable, "@variable is #{@variable} when: things to happen"
p @varible
end
该代码应该将@variable输出到控制台,除非断言失败。您的问题到底是什么?实例变量是在测试用例中还是在被测试对象中?