html tool

2015年2月3日星期二

maven+selenium I---juint using

1.maven 下载地址
http://maven.apache.org/download.cgi
2.配置
1>将下载回来的包解压到任意地址,我的路径是D:\Program Files\apache-maven-3.0.3
2>新建环境变量M2_HOME 指向D:\Program Files\apache-maven-3.0.3
3>在path尾部添加%M2_HOME%\bin
4>检查是否安装成功

打开cmd
echo %M2_HOME%
mnv –v

3.pom.xml配置导入
http://docs.seleniumhq.org/docs/03_webdriver.jsp#setting-up-a-selenium-webdriver-project
mvn clean install


4.导入到eclipse
http://docs.seleniumhq.org/docs/appendix_installing_java_driver_Sel20_via_maven.jsp#importing-maven-into-eclipse-reference
mvn eclipse:eclipse

5.添加测试代码,运行
http://my.oschina.net/dyhunter/blog/94090
问题:
eclipse提示editor does not contain a main type
解决方式:[add:http://stackoverflow.com/questions/1113729/editor-does-not-contain-a-main-type]
You have to make sure that your .java files are in the .src folder in eclipse. I had the same exact problem until I got it figured out.
[popexizhi:创建了src文件夹,将包和.java导入就好了。:)]

6.在cmd环境中直接运行maven
mvn test
问题:如何使用junit
解决:在pom.xml添加如下

junit
junit
4.10

问题:没有运行结果why?
解决:http://stackoverflow.com/questions/22462181/how-do-i-run-a-selenium-test-using-maven-from-the-command-line
--------------------------------------------------

You have to make sure that the class file names you are creating are ending with "Test" string. e.g. AppTest, TempTest are all valid class file names, but AppCheck, TempTest1 are invalid name; maven will not detect these files for execution.
--------------------------------------------------
1.Update your pom to something like:


  src/java
  src/test
  ...


Abide by Maven convention and put your test sources under src/test/java
--------------------------------------------------------------
[popexizhi]在配置文件中添加build节点后开始运行对应的类了
[next]
7.问题:提示编码问题utf8不识别
8.问题:如果不是用junit框架如何运行呢?

没有评论:

发表评论