0
如何测试用黄瓜和阿鲁巴如何用黄瓜和阿鲁巴
一个交互式的Java应用程序来测试一个交互的Java应用程序,我有这样的黄瓜/阿鲁巴场景:
Scenario: Simple echo
Given I run `java -cp /bin Echo` interactively
When I type "something\n"
Then the output should contain "something"
为了测试这个简单的Java程序:
import java.util.*;
class Echo {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
System.out.println(stdin.next());
}
}
当我运行测试失败,我得到以下错误:
Then the output should contain "something"
expected "" to include "something" (RSpec::Expectations::ExpectationNotMetError)
features/cli.feature:15:in `Then the output should contain "something"'
当我试着使用这个Ruby程序相同的测试:
puts gets
全部是绿色......
难道我做错了什么吗?
是否必须使用另一种方法从标准输入读取? System.in仅用于键盘吗?
都尝试的事情,仍然没有工作:( – victrnava 2011-03-29 12:21:27
所以的System.out.println(“东西”)仍然没有得到回升并让你的测试通过?听起来像aruba没有拿起Java输出,它是否从System.err.println(“Something”)中获取内容? – Clinton 2011-03-30 00:27:53