Susanta Adhikary
Susanta Adhikary

Reputation: 287

How to start appium server and emulators from jenkins and then run the selenium test cases?

How to start appium server and emulators from jenkins and then run the selenium test cases?

Need to run the Maven project I have created for Mobile Automation from Jenkins but without the manual Intervention.. Start the Appium server and Emulator.

Upvotes: 3

Views: 5704

Answers (3)

Ardesco
Ardesco

Reputation: 7441

You could have a look at this appium maven plugin:

https://github.com/Ardesco/appium-maven-plugin

It will start Appium up before the tests run, and then shut it down afterwards. You can also use Maven profile's so it doesn't happen all the time.

<plugin>
<groupId>com.lazerycode.appium</groupId>
<artifactId>appium-maven-plugin</artifactId>
<version>0.2.0</version>
<configuration>
    <nodeDefaultLocation>${project.basedir}/src/test/node</nodeDefaultLocation>
    <appiumLocation>${project.basedir}/src/test/node_modules/appium</appiumLocation>
</configuration>
<executions>
    <execution>
        <id>start appium</id>
        <phase>pre-integration-test</phase>
        <goals>
            <goal>start</goal>
        </goals>
    </execution>
    <execution>
        <id>stop appium</id>
        <phase>post-integration-test</phase>
        <goals>
            <goal>stop</goal>
        </goals>
    </execution>
</executions>

You can use the frontend-maven-plugin to download Appium if you don't have it installed locally (more info at the link above)

Upvotes: 0

olyv
olyv

Reputation: 3817

Not so many details in your question but shortly:

  1. Create Jenkins job.
  2. Point tests source code location to build and run
  3. Add build step to start Appium (command depends on your environment)
  4. Add build step to run emulator (emulator -avd your_emulator_name or use Genymotion)
  5. Add build step to invoke maven command (clean test)

Do not forget to make start Appium and run emulator as background processes otherwise it will block job execution. Format of commands depends on your environment (Linux or Win). You may need to insert time delay to let emulator initialize (and again format of command depends on your OS). Hopefully it makes sense for you.

Upvotes: 3

matt_roo
matt_roo

Reputation: 415

Make a Jenkins Job which will check out the project on the target environment, build it and then run a script which will call the appium command which points to the built application and then run the selenium command to kick off the tests.

Upvotes: 0

Related Questions