Grails点滴(一)
在运行 时出现这样的错误信息: 1
grails test-app
经过搜索,发现是因为将application.properties里的app.name的配置去掉了导致的,将app.name=“xxx”添加上就不会出现这种错误了;1
java.lang.IllegalArgumentException: Property source name must contain at least one character
另外一个问题是为了方便调试在一些测试代码中插入了一些临时性的println语句,但是在运行测试时却发现println语句输出的信息看不到,搜索后在StackOverflow上找到了答案,需要在运行测试代码的命令行
上添加-echoOut参数: 1
grails test-app -echoOut
最后一个问题是运行grails test-app时出现下列错误信息:
这个错误信息很奇怪,好在直接将这个错误信息google之后在StackOverflow上找到了答案,原来是因为没有加入hibernate插件的缘故,这个可是从错误信息一点都看不出来的:-(1
Fatal error running tests: Method on class [xx.xx.xx.Role] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
参考资料