我正在尝试在项目构建期间通过jasmine运行SAP-UI5单元测试使用phantomjs-maven-plugin:
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.3</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<webDriverCapabilities>
<capability>
<name>phantomjs.binary.path</name>
<value>
${basedir}/src/main/webapp/test/resources/phantomjsDriver/phantomjs/phantomjs.exe
</value>
</capability>
<phantomjs.binary.path>${basedir}/src/main/webapp/test/resources/phantomjsDriver/phantomjs/phantomjs.exe</phantomjs.binary.path>
</webDriverCapabilities>
<preloadSources>
<preloadSource>src/test/vi/desktop/share/print/initSpec/InitSpecRunner.js</preloadSource>
</preloadSources>
<sourceIncludes>
<include>${basedir}/lib</include>
</sourceIncludes>
<jsSrcDir>${basedir}/src/main/webapp/ags_gal_app/Views</jsSrcDir>
<jsSrcDir>${basedir}/src/main/webapp/ags_gal_app/Controllers</jsSrcDir>
<jsTestSrcDir>${basedir}/src/main/webapp/test</jsTestSrcDir>
<sourceIncludes>
<include>${basedir}/lib</include>
</sourceIncludes>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
<customRunnerTemplate>${basedir}/src/main/webapp/test/resources/Test.html.template</customRunnerTemplate>
</configuration>
</plugin>
当我运行mvn build时,我收到以下错误:
(anonymous function) (http://localhost:61473/:1818)
(anonymous function) (http://localhost:61473/spec/lib/jasmine-1.0.0/jasmine.js:2385)
delayedCall (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:117)
d (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:117)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:117)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:141)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:141)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:141)
l (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:77)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:77)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:141)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:18)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:18)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:18)
(anonymous function) (https://sapui5.hana.ondemand.com/resources/sap-ui-core.js:18)
[ERROR - 2014-02-17T12:05:13.646Z] Session [b471d0c0-97cb-11e3-9750-6782144f2727] - page.onError - msg: ReferenceError: Can't find variable: phantom
[ERROR - 2014-02-17T12:05:13.646Z] Session [b471d0c0-97cb-11e3-9750-6782144f2727] - page.onError - stack:
(anonymous function) (http://localhost:61473/spec/resources/phantomjsDriver/phantomjs/examples/ipgeocode.coffee:12)
(anonymous function) (http://freegeoip.net/json/?callback=window.cb:1)
[ERROR - 2014-02-17T12:05:13.647Z] Session [b471d0c0-97cb-11e3-9750-6782144f2727] - page.onError - msg: TypeError: 'null' is not an object (evaluating 'data.query.results.results')
[ERROR - 2014-02-17T12:05:13.647Z] Session [b471d0c0-97cb-11e3-9750-6782144f2727] - page.onError - stack:
(anonymous function) (http://localhost:61473/spec/resources/phantomjsDriver/phantomjs/examples/seasonfood.coffee:6)
(anonymous function) (http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20movies.kids-in-mind&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=window.cbfunc:1)
[ERROR - 2014-02-17T12:05:13.910Z] Session [b471d0c0-97cb-11e3-9750-6782144f2727] - page.onError - msg: TypeError: 'null' is not an object (evaluating 'data.query.results.results.result')
[ERROR - 2014-02-17T12:05:13.910Z] Session [b471d0c0-97cb-11e3-9750-6782144f2727] - page.onError - stack:
(anonymous function) (http://localhost:61473/spec/resources/phantomjsDriver/phantomjs/examples/seasonfood.coffee:6)
(anonymous function) (http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20bbc.goodfood.seasonal%3B&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=window.cbfunc:1)
[INFO - 2014-02-17T12:05:14.110Z] ShutdownReqHand - _handle - About to shutdown
[INFO]
-------------------------------------------------------
J A S M I N E S P E C S
-------------------------------------------------------
[INFO]
Results: 0 specs, 0 failures
2014-02-17 13:05:15.177:INFO:oejsh.ContextHandler:stopped o.e.j.s.h.ContextHandler{/,file:/C:/Users/C5168279/git/com.sap.solman.graphical.component.setup/SMGC/}
2014-02-17 13:05:15.177:INFO:oejsh.ContextHandler:stopped o.e.j.s.h.ContextHandler{/spec,file:/C:/Users/C5168279/git/com.sap.solman.graphical.component.setup/SMGC/}
2014-02-17 13:05:15.177:INFO:oejsh.ContextHandler:stopped o.e.j.s.h.ContextHandler{/src,file:/C:/Users/C5168279/git/com.sap.solman.graphical.component.setup/SMGC/}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 46.105s
[INFO] Finished at: Mon Feb 17 13:05:15 CET 2014
[INFO] Final Memory: 24M/150M
[INFO] ------------------------------------------------------------------------
我正在使用phantomjs 1.9.2。 有没有人有想法,请帮忙。