CircleCI Integration With TestGrid
CircleCI stands out as a widely recognized CI/CD tool recognized for its user-friendly interface, straightforward setup, and extensive compatibility with various libraries and services. By subjecting each code commit to an automated pipeline before integrating it into the designated feature branch, CircleCI ensures the delivery of high-quality code in an efficient manner.
This preemptive approach offers the advantage of swift issue identification, allowing for timely troubleshooting and the prevention of major disruptions. Such proactive measures contribute to the avoidance of significant bottlenecks during the development process. Furthermore, CircleCI enables the significant scale, rapid deployment of efficient solutions.
Excitingly, the integration of CircleCI and TestGrid offers a chance to improve your go-to-market plan. By using TestGrid for automated cross-browser testing, you can ensure that your code will render correctly in a wide variety of real browsers. The Selenium grid of TestGrid, which utilizes the capabilities of over 3000 browsers running on cloud-based machines, makes this possible. You can drastically shorten your testing cycles using parallel automation testing with TestGrid, enabling a streamlined and effective development workflow.
Learn how to run your Selenium and Appium tests using CircleCI and the TestGrid Device Cloud.
Prerequisites
- A Git or GitHub repository
- CircleCI uses .circleci/config.yml for configuration, which can be used to integrate your tests with TestGrid by setting specific variables such as user_token, application_token, version_token, process_type, s_device, test_website_url, verion_module_id etc.
Note: Check out how to set environment variables in the CircleCI documentation.
In this guide, you will learn how to:
- Integrate CircleCI with your existing Selenium and Appium test suites.
- Add CircleCI to your integration to test your locally hosted code as well.
Note: This document assumes that you have already integrated GitHub or BitBucket as a git repository hosting service.
Integrating TestGrid With CircleCI
To integrate CircleCI with TestGrid, you need to make minor tweaks in the .circleci/config., which is the configuration file for your CircleCI instance. The changes you need to make will revolve around environment variables such as user_token, ,application_token, version_token, process_type, s_device, test_website_url, verion_module_id etc., and so on. Refer to the CircleCI documentation for more information regarding the setting of environment variables.
Below is a sample configuration file for integrating CircleCI with TestGrid. You can use the sample file to test your own automation test suite by replacing the environment variables according to your needs. All the code used for the demonstration of this topic can be found in our GitHub repository.
- Log in to CircleCI.
- Choose the desired repository and click Set Up Project.
- Select Add Config (or Use Existing Config). This creates a new branch in your project called circleci-project-setup.
- The .circleci/config.yml file will be created in the project’s root directory. To create the YML file, you can refer to the CircleCI Language Guide.
- You can update your config.yml as per your needs. Here is an example configuration for your reference that can be used to run your Selenium and Appium tests using the TestGrid Selenium and Appium CLI: You don’t have to install Selenium, Appium, or any of the “npm” packages on your CI machine. We automatically install them on our machines before running the test.
Edit your .circleci/config.yml
file.
version: 2.1 jobs: build: docker: - image: cimg/node:14.11.0 working_directory: ~/app steps: - checkout - run: name: "Install Dependencies" command: sudo npm install -g TestGrid-Selenium and Appium-cli - run: name: "Run the test on TestGrid" command: " <TestGrid Run> " workflows: build: jobs: - build
Below is the List of configuration references:
Determine the user’s capabilities.
a. Go to the Dashboard and then click on the Created “Test Runs Application”. After that, click on “Test Case Writer” and then click on “Versions.” On the same screen, look for the “i” button in the upper right corner.
b. Select the “i” button icon, and from there, obtain the user token.
Change ‘process_type’ as appropriate for your web or mobile
Selenium Web With Website URL
- Syntax:
curl --location 'https://{your_domain}.testgrid.io/ci/app_build_run' \ --form 'application_token='a46e4ad3e18e880a4bcss50c05df66ef3c'' \ --form 'user_token='ochskrxwei4ujsssverxb8w5jfxj1bgnlsw'' \ --form 'version_token='34c4511734ed6a1bf7fe1a642deass0115'' \ --form 'version_module_id='15'' \ --form 's_device='QF37N5A'' \ --form 'process_type='ow'' \ --form 'test_website_url='https://www.google.com''
Appium With Mobile Application File and Bundle Identifier
1. process_type (Android – Appium) –> oaa
2. process_type (Web) –> ow
3. process_type (iOS- Appium). –> oia
- Syntax with Build_id:
curl --location 'https://{your_domain}.testgrid.io/ci/app_build_run' \ --form 'application_token='a46e4ad3se18e880a4bc50aac05df66ef3c'' \ --form 'user_token='ochskrxwei4ujssverxb8w5jfxj1bgnlsw'' \ --form 'version_token='34sc4511734ed6a1bf7fe1ass642dea0115'' \ --form 'version_module_id='16'' \ --form 's_device='QF38N5U'' \ --form 'process_type='oaa'' \ --form 'app_build_id='27'' \
- Syntax with Bundle Identifier:
curl --location 'https://{your_domain}.testgrid.io/ci/app_build_run' \ --form 'application_token='a46e4ad3se18e880a4bc50aac05df66ef3c'' \ --form 'user_token='ochskrxwei4ujssverxb8w5jfxj1bgnlsw'' \ --form 'version_token='34sc4511734ed6a1bf7fe1ass642dea0115'' \ --form 'version_module_id='16'' \ --form 's_device='QF38N5U'' \ --form 'process_type='oaa'' \ --form 'bundle_identifier='Your_Bundle_id''
The location of the configuration command is referenced.
View the completed CI jobs by selecting the branch.
Once you have the build_id, you must check the execution of our platform.
Ex: https://{your_domain}.testgrid.io/build/apps/907
On the TestGrid Automation Dashboard, keep an eye on and analyze your test results.
In order to give all of your visitors a seamless user experience, deploy your code in a dependable way at scale using CircleCI integration with TestGrid and make sure it looks robust across all browsers and devices.
Happy Testing! 😁