51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1958|回复: 1
打印 上一主题 下一主题

Jenkins maven调用webdriver报错

[复制链接]
  • TA的每日心情
    慵懒
    2016-3-23 10:29
  • 签到天数: 6 天

    连续签到: 1 天

    [LV.2]测试排长

    跳转到指定楼层
    1#
    发表于 2017-2-13 18:08:23 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

    最近在研究自动化测试selenium+eclipse+testng+maven+Jenkins
    创建了一个maven项目,用testng框架写了一个类,调用webdriver,chromedriver访问百度,功能很简单
    右键testng.xml选择 run as testng可以成功执行
    在maven里面配置pom.xml来调用testng.xml,run as  maven test  也可以成功调用chromedriver访问百度
    我把功能集成在Jenkins里面,配置项一共有两个,
    一个是从svn下载代码,
    还有一个就是maven  
    Root POM  pom.xml

    Goals and options

    执行构建,报错如下,代码应该下载成功了,但是调用chromedriver的时候报这个错,希望有大神来解决

    Started by user adminBuilding in workspace C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4Updating svn://172.17.184.50/DM/QMC/05.测试/cyh/SeleniumMvn2 at revision '2017-02-13T16:41:31.696 +0800'At revision 4208No changes for svn://172.17.184.50/DM/QMC/05.%E6%B5%8B%E8%AF%95/cyh/SeleniumMvn2 since the previous buildParsing POMsEstablished TCP socket on 13753[SeleniumMaven4] $ "C:\Program Files\Java\jdk1.8.0_40/bin/java" -cp C:\windows\system32\config\systemprofile\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-1.8.1.jar;F:\autotest\maven\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;F:\autotest\maven\apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main F:\autotest\maven\apache-maven-3.3.3 "C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\jenkins\WEB-INF\lib\remoting-3.4.1.jar" C:\windows\system32\config\systemprofile\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-1.8.1.jar C:\windows\system32\config\systemprofile\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.8.1.jar 13753<===[JENKINS REMOTING CAPACITY]===>channel startedExecuting Maven:  -B -f C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\pom.xml test -Dmaven.repo.local=C:/Users/Administrator/.m2/repository[INFO] Scanning for projects...[INFO]                                                                         [INFO] ------------------------------------------------------------------------[INFO] Building SeleniumMvn2 0.0.1-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SeleniumMvn2 ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] skip non existing resourceDirectory C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\src\main\resources[INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ SeleniumMvn2 ---[INFO] Nothing to compile - all classes are up to date[INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ SeleniumMvn2 ---[INFO] Using 'UTF-8' encoding to copy filtered resources.[INFO] skip non existing resourceDirectory C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\src\test\resources[INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ SeleniumMvn2 ---[INFO] Nothing to compile - all classes are up to date[INFO] [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ SeleniumMvn2 ---[INFO] Surefire report directory: C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\target\surefire-reports------------------------------------------------------- T E S T S-------------------------------------------------------Running TestSuiteStarting ChromeDriver 2.20.366854 (5ec7646c06c3266f27ae291db023e006190cc1cc) on port 45482Only local connections are allowed.二月 13, 2017 4:41:36 下午 org.openqa.selenium.remote.ProtocolHandshake createSession信息: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end二月 13, 2017 4:41:36 下午 org.openqa.selenium.remote.ProtocolHandshake createSession信息: Detected dialect: OSSTests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.247 sec <<< FAILURE! - in TestSuitef(SeleniumMvn2.testmvn1)  Time elapsed: 0.964 sec  <<< FAILURE!org.openqa.selenium.NoSuchSessionException: no such session  (Driver info: chromedriver=2.20.366854 (5ec7646c06c3266f27ae291db023e006190cc1cc),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 43 millisecondsBuild info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'System info: host: 'PC-201604071707', ip: '192.168.202.10', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_40'Driver info: org.openqa.selenium.chrome.ChromeDriverCapabilities [{message=unknown error: cannot find Chrome binary  (Driver info: chromedriver=2.20.366854 (5ec7646c06c3266f27ae291db023e006190cc1cc),platform=Windows NT 6.1 SP1 x86_64), platform=ANY}]Session ID: 4f2e96fa4547f1461c05f08b3038c98e        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)        at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:322)        at SeleniumMvn2.testmvn1.f(testmvn1.java:24)Results :Failed tests:   testmvn1.f:24 ? NoSuchSession no such session  (Driver info: chromedriver=2.2...Tests run: 1, Failures: 1, Errors: 0, Skipped: 0[ERROR] There are test failures.Please refer to C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\target\surefire-reports for the individual test results.[JENKINS] Recording test results[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 4.759 s[INFO] Finished at: 2017-02-13T16:41:38+08:00[INFO] Final Memory: 16M/316M[INFO] ------------------------------------------------------------------------[JENKINS] Archiving C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\pom.xml to org.test/SeleniumMvn2/0.0.1-SNAPSHOT/SeleniumMvn2-0.0.1-SNAPSHOT.pomchannel stoppedFinished: UNSTABLE
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-15 18:38 , Processed in 0.064873 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表