Testing Automation with CI/CD and Jenkins: A Guide

Hüseyin Solmaz
Beyn Technology
Published in
7 min readSep 25, 2023

What is CI/CD?

Continuous Integration and Continuous Deployment, or CI/CD, is an acronym. It is a collection of guidelines and practices for software development that tries to speed up and automate the procedures for integrating code updates into a shared repository, executing automated tests, and releasing the software into production. CI/CD enables development teams to produce software more quickly and at a higher standard.

How is CI/CD used in the testing process?

Continuous Integration and Continuous Deployment/Delivery (CI/CD) refers to the tools and processes to automate the testing, building, and delivery of software changes in It is vital that any changes made to the code are tested exhaustively, and deployed to production as soon as possible but with as little manual interaction as necessary, and CI/CD is key to this.In the field of testing, it mostly deals with the CI part, not CD. Here’s how CI/CD is typically used in the testing process:

Code Integration: Developers push their new code changes to a version control system (e.g., Git) often. CI/CD systems are notified by these repositories of any changes.

Automated Builds: The CI/CD pipeline runs the build process when code changes are detected. This process compiles the code, package the application, and creates deployable artifacts.

Unit Testing: After a successful build automated unit tests run. In unit tests individual pieces of the code are tested to ensure they are working correctly in isolation. If any unit tests do, then your pipeline can stop deploying, and developers can be notified.

Integration Testing: After unit tests have passed, integration tests may be run in the pipeline. Integration tests ensure the pieces of the application interact as you expect they will. This phase allows for sniffing up problems which are not visible in unit testing.

Code Analysis and Quality Checks: They also typically involve code analysis and a check for quality. Code reviews, for example, are automated checks that can verify code style, code complexity, security issues, and compliance with coding standards.

Automated Testing Environments: CIE CD can generate and maintain testing environments which accurately reflect the production environment. That way, tests are performed where the software will be executed later on.

Automated Regression Testing: CI/CD Pipelines incorporate regression tests, which verify if the latest code modifications cause any new issues and/or break the system in place. Regression issues would be caught using automated test runs.

User Acceptance Testing (UAT): For example, the code changes being put through this pipeline could be deployed to a staging/pre-prod environment where UAT can be done by stakeholders and/or the QA team.

Deployment to Production: When all test are green — code changes are auto-deployed to the production environment. It can be done manually or automatically, depending on the policy and the level of confidence they have in the test process.

Monitoring and Alerting: Post deployment, CI/CD pipelines can also include monitoring and alerting systems to identify problems in production and take the necessary actions immediately. This is useful for easily identifying and resolving any outstanding issues that may emerge post-deployment.

Rollbacks: Since problems can arise in production, CI/CD pipelines frequently have ways to easily revert to a prior version of the software which is known to function correctly.

Continuous Feedback: Because of CI/CD, Developers, QA teams and other parties have continuous feedback. Teams have all the test results at hand, as are the code quality metrics, and details about the deployment status, to take the right decision.

CI/CD significantly increases the efficiency and reliability of the testing process eliminating manual errors and fast delivery of new features and bug fixes to the end-users. It fosters a Test-Driven-Development culture where continuous testing and integration are key principles of modern software development.

What is Jenkins?

An open-source automation server called Jenkins is frequently used for developing, testing, and distributing software. It offers a framework for automating a number of software development tasks, such as writing and packaging code, running tests, and deploying applications. Jenkins is extremely flexible and can be tailored to various processes because to the large number of plugins and integrations it supports.

How to install Jenkins?

To install Jenkins, you can typically follow these steps:

  • Download the Jenkins war file or installer suitable for your operating system.
  • Install Jenkins setup file downloaded
  • Select service Logon Credentials
  • Install any required dependencies (e.g., Java).
  • Access the Jenkins web interface in your browser and complete the setup process by unlocking Jenkins and installing any necessary plugins. (http://localhost:8080/)
  • Select Plugins
  • Wait To installation
  • Create Admin User
  • User Can Change Instance
  • Jenkins Installed You can use Jenkins right now…

How does Robot Framework work with a Jenkins job?

To use Robot Framework within a Jenkins job, you can create a Jenkins job or pipeline and configure it to execute the Robot Framework tests. This involves the following steps:
Ensure that Jenkins is installed and configured correctly.

  • Make that Jenkins is set up and configured properly.
  • Install relevant plugins, such as “Workspace Cleanup” and “Robot Framework” plugins.
  • Set up a Jenkins process to clone the source code repository that contains the Robot Framework tests.
  • Using the “robot” command, add build steps or pipeline stages to execute the Robot Framework tests.
  • To facilitate reporting and analysis, publish test results and artifacts to Jenkins.

Jenkins may be set up to automatically start these jobs in response to code pushes or on a predetermined schedule, enabling continuous integration and testing for your Robot Framework-based test suite.

How to configure Robotframework Job at Jenkins step by step

Step 1: Install Required Jenkins Plugins:

  • Launch Jenkins and go to “Manage Jenkins” > “Manage Plugins.”
  • In the “Available” tab, search for and install the following plugins:
  • “Robot Framework” plugin: This plugin provides support for Robot Framework in Jenkins.
  • “Workspace Cleanup” plugin: Optional but helpful for cleaning up workspace after a build.

Step 2: Create or Configure a Jenkins Job:

  • Click on “New Item” to create a new Jenkins job.
  • Enter a name for your job and select the type of job (typically “Freestyle project” or “Pipeline” based on your preference).
  • Click “OK” to create the job.

Step 3: Configure the Source Code Repository:

  • In the job configuration, under the “Source Code Management” section, choose your version control system (e.g., Git, SVN) and provide the repository URL.
  • Configure credentials if necessary.

Step 5: Configure the Build Steps:

  • Under the “Build” section, add a build step to execute your Robot Framework tests. This can be done using a “Shell Command” or “Execute Windows batch command,” depending on your platform.
  • Use the robot command to run your tests. For example:
robot --outputdir results/ path/to/your/tests/
  • You can also specify additional options, such as test tags or output formats.

Step 6: Post-Build Actions:

  • In the job configuration, under the “Post-build Actions” section, add a post-build action to archive the Robot Framework test results. Use the “Publish Robot Framework test results” option.
  • Specify the path to the test result XML files. For example, results/*.xml.

Step 7: Save and Build:

  • Save your job configuration.
  • Trigger a build manually to test the configuration.

Step 8: Schedule Automated Builds (Optional):

  • If desired, configure the job to trigger automatically on code commits by setting up webhooks or using polling mechanisms.

Step 9: View Test Results:

  • After running a build, you can view the test results and Robot Framework reports in the Jenkins job’s build history. Jenkins will provide a summary of test pass/fail status and generate detailed reports.

That’s it! Now that you’ve set up a Jenkins job to execute Robot Framework tests. Your Jenkins job can be further customized based on the testing and reporting requirements you have.

--

--