0

I am currently working on a UI project for my team. After building a project on Jenkins, we want to trigger acceptance tests to run. On my local machine, I am able to do so by activating a server.py with the command:

python server.py

After the server is up and running, I can run the acceptance test folder that I have written with the command:

pybot acceptance_tests

I am now trying to migrate my tests from my local machine to Jenkins. What I cannot figure out is how I am able to run the server (server.py) on Jenkins. I am relatively new to Jenkins, so any details will be great!

darkBlastorise
  • 314
  • 2
  • 3
  • 10

1 Answers1

0

Instead of starting the server via jenkins, have the test start and stop the server. This will give you the same behavior regardless of how you run your tests (ie: via jenkins for manually from the command line).

Robot has a library named Process which you can use for starting and stopping processes. You can use the Start Process and Terminate Process keywords to start and stop the webserver via a suite setup and suite teardown. It would look something like this:

*** Settings ***
| Library | Process
| Suite Setup | Start the webserver
| Suite Teardown | Stop the webserver

*** Keywords ***
| Start the webserver
| | ${server process}= | Start process | python | server.py
| | Set suite variable | ${server process}

| Stop the webserver
| | Terminate Process | ${server process}

Of course, you'll want to add some bullet proofing such as making sure the server actually starts, and possibly catching errors if it doesn't exit cleanly. You may need to give an explicit path to server.py, but hopefully this gives the general idea.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685