Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行Nightwatch(selenium)测试(通过Jenkins文件)在Jenkins构建中不起作用_Selenium_Jenkins Pipeline_Jenkins Groovy_Nightwatch.js - Fatal编程技术网

运行Nightwatch(selenium)测试(通过Jenkins文件)在Jenkins构建中不起作用

运行Nightwatch(selenium)测试(通过Jenkins文件)在Jenkins构建中不起作用,selenium,jenkins-pipeline,jenkins-groovy,nightwatch.js,Selenium,Jenkins Pipeline,Jenkins Groovy,Nightwatch.js,我想做的是通过Jenkins构建运行我的夜间监视测试 但是,在运行测试时(在Jenkins构建中),我遇到了一些问题 首先,使用以下Jenkins文件(我认为本案中的代理人是有效的) 我在Jenkins构建中得到以下错误: 〔0〕36m [汽车评论/PAR 4538 ]测试套件[ 0M ] [0;35米= 运行:[0;32mnavigate到哪个轿厢段[0m [1;31mError正在从selenium服务器检索新会话[0m] [0;31M连接被拒绝!selenium服务器已启动吗?[0m[0;

我想做的是通过Jenkins构建运行我的夜间监视测试

但是,在运行测试时(在Jenkins构建中),我遇到了一些问题

首先,使用以下Jenkins文件(我认为本案中的代理人是有效的)

我在Jenkins构建中得到以下错误:

〔0〕36m [汽车评论/PAR 4538 ]测试套件[ 0M ] [0;35米=

运行:[0;32mnavigate到哪个轿厢段[0m

[1;31mError正在从selenium服务器检索新会话[0m]

[0;31M连接被拒绝!selenium服务器已启动吗?[0m[0;90m{ 错误:connect ECONREFUSSED 127.0.0.1:4444 在TCPConnectWrap.afterConnect[as oncomplete](net.js:1107:14)处,错误号为:“econnreference”,代码为:“econnreference”,系统调用为“connect”,
地址:'127.0.0.1',端口:4444}[0m

如果我将Jenkins文件编辑为:

stage('Running the tests...') {
            steps {
                script {
                    dir('Tests/Functional/node_modules/selenium-server-standalone-jar/jar') {
                        sh "java -jar selenium-server-standalone-3.141.59.jar"
                    }
                    dir('Tests/Functional')
                        sh "npm run test:staging -- --tag carReviews"
                    }
                }
            }
        }
在运行测试之前启动Selenium服务器后,构建似乎“挂起”

磨合 /home/jenkins/workspace/Specialist/Parkers/Tests/temporary.stg.selenium-acceptance-testing/Tests/Functional/node_modules/selenium-server-standalone-jar/jar [管道]{[管道]sh

  • java-jar selenium-server-standalone-3.141.59.jar 13:20:21.038信息[GridLauncherV3.parse]-selenium服务器版本:3.141.59,修订版: e82be7d358 13:20:21.254信息[GridLauncherV3.lambda$buildLaunchers$3]
  • 在端口4444 2021-04-28 13:20:21.412上启动独立的Selenium服务器:INFO::main:Logging在1129ms时初始化为 org.seleniumhq.jetty9.util.log.StdErrLog 13:20:22.018信息 [WebDriverServlet.]-初始化WebDriverServlet 13:20:22.241 信息[SeleniumServer.boot]-Selenium服务器已启动并在端口上运行 4444
首先,我认为需要两个命令shell来运行这些测试,一个启动selenium独立服务器jar,另一个运行测试,这是否正确

如果是这样,我还尝试在第一个shell的末尾添加一个
&
,但这并没有打开第二个shell

其次,我甚至需要“手动”启动selenium server standalone jar模块,因为我认为这将在nightwatch设置中自动启动,当我在本地运行测试时它会自动启动(并且工作正常)

任何帮助都将不胜感激。谢谢

stage('Running the tests...') {
            steps {
                script {
                    dir('Tests/Functional/node_modules/selenium-server-standalone-jar/jar') {
                        sh "java -jar selenium-server-standalone-3.141.59.jar"
                    }
                    dir('Tests/Functional')
                        sh "npm run test:staging -- --tag carReviews"
                    }
                }
            }
        }