Jenkins is an open source automation server that helps to automate the non-manual part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery.
Sauce Labs is one of the largest continuous testing clouds of web and mobile applications that access web browsers, mobile emulators and simulators, and real mobile devices.
Why integrate Jenkins with Sauce Labs?
- Environment details can be provided by Jenkins. It is not required to pass details or update in Test Scripts.
- The report can be published on Jenkins Environment, where you can view SauceLabs execution log and videos can be download from Jenkins Environment.
- Jenkins build number can be mapped with Sauce Labs test execution and we will get build number in Sauce Labs and can easily identify execution.
- For parallel execution, we parameterize all os and browsers combination from Jenkins environment.
Install Sauce Lab plugin in Jenkins CI tool
- Go to “Manage” Jenkins
- Click on “Manage” Plugin
- Search “Sauce OnDemand Plugin” and install
- Below plugins will be installed, other plugins which are listed are dependent plugins
Configuring Project to Use Sauce Connect
- Created Jenkins Project
- Go to Build environment and select “Sauce Labs Support”
- You will get Sauce Lab Options and Sauce Connect Advance Option
- Add Credential of your Sauce Lab account by providing username and API key
- Select added credentials
- Select web driver browses details like below details:
- Integrated your automation suite with Build section.
Setting Desired Capabilities for Jenkins Projects in Automation code
The Sauce plugin for Jenkins provides an easy way for you to populate the desired capabilities for the operating system and browser combinations for your tests as environment variables. It doesn’t require the need to hardcode them into your tests.
After setting up Desire capabilities in Jenkins Sauce Labs we need to integrate below desire capabilities in code:
desiredCapabilities.setBrowserName(System.getenv(“SELENIUM_BROWSER”)); desiredCapabilities.setVersion (System.getenv (“SELENIUM_VERSION”)); desiredCapabilities.setCapability(CapabilityType.PLATFORM, System.getenv(“SELENIUM_PLATFORM”));
You may also like: How to Install and Execute Java and then Configure Maven on Windows Machine?