Java SpringMaven项目中的Jasmine测试:规范中未识别expect jQueryUI自动完成
我最近在我的项目中设置了jasmine测试,并尝试在我的报告中实现和测试自动完成功能 我正在使用jQueryUIAutoComplete函数,并试图测试我的规范中是否进行了方法调用。但测试失败,表示无法识别autocomplete函数 在fixture中,我包含了javascript文件,因为我的autocomplete函数调用位于document.ready函数中,并且还包含了所需的jquery、jquery UI js文件 我认为这可能是maven依赖项的问题,所以除了fixture文件之外,我还包括了依赖项文件 XML(只是依赖项和plulgin)Java SpringMaven项目中的Jasmine测试:规范中未识别expect jQueryUI自动完成,java,maven,jquery-ui,jasmine,Java,Maven,Jquery Ui,Jasmine,我最近在我的项目中设置了jasmine测试,并尝试在我的报告中实现和测试自动完成功能 我正在使用jQueryUIAutoComplete函数,并试图测试我的规范中是否进行了方法调用。但测试失败,表示无法识别autocomplete函数 在fixture中,我包含了javascript文件,因为我的autocomplete函数调用位于document.ready函数中,并且还包含了所需的jquery、jquery UI js文件 我认为这可能是maven依赖项的问题,所以除了fixture文件之外
org.webjars
jasmine jquery
2.0.3
测试
com.github.searls
jasmine maven插件
2
测试
webjars/jquery.js
webjars/jasmine-jquery.js
http://davidstutz.github.io/bootstrap-multiselect/dist/js/bootstrap-multiselect.js
src/main/webapp/resources/js
src/test/javascript
org.openqa.selenium.phantomjs.PhantomJSDriver
夹具文件:
自动完成的夹具文件
fixture中的脚本标记似乎没有出现在post中。但是我已经在fixture中包括了js文件和jquery-ui.js文件
您认为问题可能是什么以及如何解决它???我修改了pom.xml,如下所示:
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<preloadSources>
<source>webjars/jquery.js</source>
<source>webjars/jasmine-jquery.js</source>
<source>${project.basedir}/src/main/webapp/resources/js/lib/jquery-ui.min.js</source>
<source>http://davidstutz.github.io/bootstrap-multiselect/dist/js/bootstrap-multiselect.js</source>
</preloadSources>
<jsSrcDir>src/main/webapp/resources/js</jsSrcDir>
<jsTestSrcDir>src/test/javascript</jsTestSrcDir>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
</configuration>
</plugin>
</plugins>
</pluginManagement>
com.github.searls
jasmine maven插件
2
测试
webjars/jquery.js
webjars/jasmine-jquery.js
${project.basedir}/src/main/webapp/resources/js/lib/jquery-ui.min.js
http://davidstutz.github.io/bootstrap-multiselect/dist/js/bootstrap-multiselect.js
src/main/webapp/resources/js
src/test/javascript
org.openqa.selenium.phantomjs.PhantomJSDriver
我已经将jquery-min.js添加到项目库中,并将路径包含在pom.xml中。
因此它可以工作。我修改了pom.xml,如下所示:
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<preloadSources>
<source>webjars/jquery.js</source>
<source>webjars/jasmine-jquery.js</source>
<source>${project.basedir}/src/main/webapp/resources/js/lib/jquery-ui.min.js</source>
<source>http://davidstutz.github.io/bootstrap-multiselect/dist/js/bootstrap-multiselect.js</source>
</preloadSources>
<jsSrcDir>src/main/webapp/resources/js</jsSrcDir>
<jsTestSrcDir>src/test/javascript</jsTestSrcDir>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
</configuration>
</plugin>
</plugins>
</pluginManagement>
com.github.searls
jasmine maven插件
2
测试
webjars/jquery.js
webjars/jasmine-jquery.js
${project.basedir}/src/main/webapp/resources/js/lib/jquery-ui.min.js
http://davidstutz.github.io/bootstrap-multiselect/dist/js/bootstrap-multiselect.js
src/main/webapp/resources/js
src/test/javascript
org.openqa.selenium.phantomjs.PhantomJSDriver
我已经将jquery-min.js添加到项目库中,并将路径包含在pom.xml中。
因此它是有效的
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<preloadSources>
<source>webjars/jquery.js</source>
<source>webjars/jasmine-jquery.js</source>
<source>${project.basedir}/src/main/webapp/resources/js/lib/jquery-ui.min.js</source>
<source>http://davidstutz.github.io/bootstrap-multiselect/dist/js/bootstrap-multiselect.js</source>
</preloadSources>
<jsSrcDir>src/main/webapp/resources/js</jsSrcDir>
<jsTestSrcDir>src/test/javascript</jsTestSrcDir>
<webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
</configuration>
</plugin>
</plugins>
</pluginManagement>