A simple pipeline with a HelloWorld Node.js application that runs tests via Sauce Labs. This is an easy way to get a pre-configured pipeline with all the environment variables set and ready to go! The Sauce Labs username and API key fields will need to be filled in with valid information before the stage will run correctly.
Click the links below to see a project running in Bluemix!
##Pipeline with a Build stage -> Deploy/Test stage:
Helloworld node application
- Build
- Pulls in code from the Git repo and builds it.
- Deploy
- Deploys the HelloWorld Node.js app to Bluemix and exports the app name for use in the testing job.
- Runs a suite of tests via Sauce Labs against the deployed app. All the needed environment variables have been set.
##Pipeline with a Build stage -> Deploy stage - > Test stage:
Helloworld node application
- Build
- Pulls in code from the Git repo and builds it.
- Deploy
- Deploys the HelloWorld Node.js app to Bluemix.
- Test
- Runs a suite of tests via Sauce Labs against the deployed app. All the needed environment variables have been set.
##Adding Sauce Labs to an existing stage:
- Click the "Add Job" button inside the desired stage and select "Test"
- Name the new Test Job accordingly and select "Sauce Labs" from the Tester Type dropdown
- Enter your Sauce Labs username and access key in the provided input fields
- Select the execution command that best fits your code configuration or enter a custom command
- Select whether to download the videos and Selenium logs for the Sauce Labs jobs
- Select whether or not to enable test reporting. For best results, use the
mocha-jenkins-reporter
in JavaScript - Click on the "Environment Properties" tab at the top, hit "Add Property" and select "Text Property"
- Add the property
CF_APP_NAME
and delete the prefilled value - Do the same for
APP_URL
- Ensure that the following code is included in the deploy stage script box:
export CF_APP_NAME="$CF_APP"
- Hit the "Save" button and the stage is complete!
##Adding a Sauce Labs test job to its own, new stage:
- Click the "Add Stage" button in the Pipeline
- Name the new stage accordingly and click on the "Jobs" tab
- Click the "Add Job" button again and select "Test"
- Name the new Test Job accordingly and select "Sauce Labs" from the Tester Type dropdown
- Enter your Sauce Labs username and access key in the provided input fields
- Select the execution command that best fits your code configuration or enter a custom command
- Select whether to download the videos and Selenium logs for the Sauce Labs jobs
- Select whether or not to enable test reporting. For best results, use the
mocha-jenkins-reporter
in JavaScript - Click on the "Environment Properties" tab at the top, hit "Add Property" and select "Text Property"
- Add the property
APP_URL
with the URL for the application as the value. - Hit the "Save" button and the stage is complete!
###References:
See Sauce Labs extension for the extension.