This topic describes how to configure Bamboo to work with Sauce for a Python-based project. It includes a set of demo tests you can use to test your configuration and see how Sauce interacts with Bamboo.
Pytest Library
For illustration purposes, this topic assumes that you are using Pytest to execute tests, and that this library has already been installed in your testing environment. For more information about Nose, check out the Pytest official documentation.
Create a Plan
- In Bamboo, click Create Plan.
- Click Create New Plan.
- For Project, select New Project.
- For Project Name, enter
Sauce Demo
. - For Project Key, enter
Sauce
. - For Plan Name, enter
Python
. - For Plan Key, enter
Demo
. - Under Source Repositories, in the Source Repository menu, select Git.
- For Repository URL, enter https://github.com/saucelabs-sample-test-frameworks/Python-Pytest-Selenium
- For Branch, enter m
aster
. - For Authentication Type, select None.
- Select Use shallow clones.
Configure Tasks
- Click Configure Tasks.
- Click Add Task.
- Click Command.
- In the Command Configuration dialog, for Task Description, enter
Run task
. - Next to Executable, click Add Executable.
- In the New Executable dialog, for Executable Label, enter
pytest
. - For Path, enter the path to your nose library.
- Click Save.
- In the Command Configuration dialog, for Argument, enter
--junitxml=results.xml
. - Click Save.
Click Create.
Don't Enable the Plan Yet!
You'll need to enter the Sauce configuration after you configure the plan, so don't select Enable this plan until after you've completed the plan configuration steps.
Configure the Plan
- Under Plan Configuration > Stages and Jobs > Default Stage, select Default Job.
- Click Miscellaneous.
- For Job Name, enter
Default Job
. - Select Job Enabled.
- Click Save.
Enable the Sauce Plugin
- Select Enable Sauce OnDemand.
- In General Settings, select the Selenium Version you want to use for your tests.
- Select the Browser you want to run your tests against.
- Enter the Max Duration, Idle Timeout, and Starting Browser URL settings for your test.
Click Save.
Sauce Connect Automatically Enabled
In the General Settings you will see that Enable Sauce Connect is selected by default, which will launch an instance of Sauce Connect prior to the running of your Job. This instance will close when the Job completes.
Run the Example Tests
- Go the Bamboo dashboard.
- Click the Enable icon.
- Click the Run icon.
- After the tests complete, click Sauce Jobs.
- Click the Job ID of any job to see the steps performed by the test as well as a test video.