简体   繁体   English

使Jenkins,Appium,Cucumber-Jvm和Android Emulator一起工作

[英]Make Jenkins, Appium, Cucumber-Jvm and Android Emulator working together

I'm trying to make all this stuff work together. 我正在尝试使所有这些东西一起工作。 Created a jenkins job with this configuration: 使用以下配置创建了一个詹金斯工作:

Environment Build: android-19 emulator spawned by the andorid emulator jenkins plugin 环境构建:andorid模拟器jenkins插件产生的android-19 emulator

Build steps: Appium starting in this way: 构建步骤:Appium以这种方式启动:

appium --full-reset --udid $ANDROID_AVD_DEVICE

Invoke Gradle script with on a cucumber task: 在黄瓜任务上调用Gradle脚本:

    sourceSets {

    test {
        java {
            srcDir 'src/java'
        }
        resources {
            srcDir 'src/resources'
        }
    }
}


task cucumber() {
    dependsOn assemble, compileTestJava
    doLast {
        javaexec {
            main = "cucumber.api.cli.Main"
            classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
            args = ['-f', 'pretty', '--glue', 'gradle.cucumber', 'src/resources']
        }
    }
}

I created an android studio project with two modules: one with the android app sources and one cucumber-jvm "test" module with all the cucumber tests. 我创建了一个包含两个模块的android studio项目:一个包含android应用程序源,一个包含所有黄瓜测试的cucumber-jvm“ test”模块。

The problem is that, when i try to start a jenkins job that make this steps: 问题是,当我尝试开始执行以下步骤的詹金斯工作时:

Compile android studio project --> Start Emulator --> Start Appium server --> compile cucumber test --> execute test 编译android studio项目->启动模拟器->启动Appium服务器->编译黄瓜测试->执行测试

The build fail everytime and these are the logs: 每次构建都会失败,这些是日志:

https://gist.github.com/redirect11/9273079 https://gist.github.com/redirect11/9273079

and

https://gist.github.com/redirect11/9273043 https://gist.github.com/redirect11/9273043

These are the 200th job try.... and i don't remember what are the differences... but the error it's the same... 这些是第200个工作尝试...。我不记得有什么区别...但是错误是相同的...

Appium server and jenkins started by the same user on the same machine... can some on help me pointing me in the right way? Appium服务器和jenkins是由同一用户在同一台​​计算机上启动的...可以帮助我以正确的方式指出我吗?

Looking at: 看着:

[31mMessage: [0m[31morg.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

I think I have seen that when the connection to Appium is failing. 我想我已经看到,当与Appium的连接失败时。 Try to just leave appium running without jenkins kicking it off to see if that solves the problem. 尝试仅让appium运行,而不会让jenkins踢开它,看看是否能解决问题。 With so many working parts try to isolate which is giving the issue. 有这么多的工作部件,试图找出导致问题的原因。 Please comment on the next issue if you have one. 如果有的话,请对下一个问题发表评论。

If you want appium to run when a test is triggered try to run it within the test itself. 如果您希望在触发测试时运行appium,请尝试在测试本身中运行它。 Then have it close the connection when the test finishes. 测试完成后,请关闭连接。 Just make sure your tests waits a couple seconds before trying to connect since appium has a slight boot time 只需确保您的测试在尝试连接之前要等待几秒钟,因为appium的启动时间很短

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM