VST

Test Automation

Continuous Integration and Delivery with Jenkins and GitHub

Summary:

Testing and deployment-related operations can be automated with Jenkins, an open-source, self-contained automation server. Jenkins and UI test automation work together to improve productivity, simplify the testing procedure, and provide reliable continuous integration and continuous delivery (CI/CD) pipelines. This paper explores the features, usage, structure, quirks, test reporting, CI/CD integration, supplements, and a conclusion that highlights the main points of UI test automation integration with Jenkins.

Automating CI/CD Pipelines by Integrating Jenkins with GitHub for Scheduled Builds

Features:

  1. Jenkins makes it easier to automate UI tests and increases the frequency of testing.
  2. Enables parallel test execution, allowing tests to be done simultaneously for different environments.
  3. Automated test execution for code commits is possible by effortless integration with version control systems like Git.
  4. Jenkins allows for a great deal of customization via scripts and plugins, enabling specialized test automation workflows.
  5. Teams can check real-time test findings and failures by sending automated alerts through email, Slack, or other channels.
  6. Provides an easy-to-use, web-based interface.
  7. Capable of distributing tests and builds throughout several computers for quicker processing.

Usage:

  • Moving code into production
  • Allowing task automation
  • Supporting continuous integration
  • Reducing time for reviewing the code.

Framework Structure:

  • Test Scripts: UI test scripts written in tools like Selenium, Cypress, or Puppeteer.

Example of UI test script developed using selenium with python:

UI test script developed using selenium with python
  • Page Object Model (POM): Structure the test framework using the POM design pattern to enhance code reusability and maintainability.

Example of project structure developed using selenium python with pytest:

Project structure developed using selenium python with pytest
  • Configuration Files: Maintain configuration files for different environments and settings.

Example of configuration file containing system and project related information: –

Configuration file containing system and project related information
  • Test Data: Organize test data separately to facilitate data-driven testing.
  • Utility Functions: Common utility functions to handle repetitive tasks, enhancing code efficiency.

Integration of allure report plugin in Jenkins

To install the plugin from the internet directly

  • In the Jenkins web interface, go to Manage Jenkins → Manage Plugins → Available plugins.
Jenkins web interface
  • Using the search box, find the Allure plugin. Check the checkbox next to the plugin.
  • Click Install without restart.
  • On the Download progress page, wait until each status is Success.

Executing project located in your system: –

Jenkins Login page
  • Click on new item from LHS menu in Jenkins
  • Enter project name, click on freestyle project and select ok you will be redirected to configuration page
  • In configuration add description of your project
  • In advance tab give custom workspace directory where your project is located
  • In build steps section select execute windows batch command (for windows system) and add project execution command
  • To add post bill action, select post bill action add allure report and inside path section add allure report path directory and select save.
  • Once your configuration is saved click on build now.
  • Once you click on build now execution will start in Jenkins console output and allure report are generated with allure report in Jenkins project section
  • To see the allure report go to your project build section and click on allure report
  • We can see the allure report with its execution details

Building a pipeline and executing project from GitHub

  1. Select new item
  2. Enter project name, select pipeline and click on ok

3. Enter general description of your project

  • Build pipeline script as per project configuration
  • We can use pipeline syntax to build your script

For example, if we want to run a project from git hub with branch name and add allure report post execution, we can use following pipeline syntax

Steps:

  1. Click on pipeline syntax
  2. Add checkout: checkout from version control
  • Click on generate script
  • Add above script for generation of pipeline script
  • Add sample step as git: Git with repository URL and branch name and credentials for your git repository and add generated pipeline script to main script
  • Add pipeline syntax for post bill action for generating allure report
  • This is the generalize example of your script

 

  • Click on save and run your build by clicking build now
  • Check the Jenkins console while running the execution from GitHub

Peculiarity:

  1. Environment Management: Handling different environments like development, staging, production can be difficult but is essential for complete testing.
  2. Cross-Browser Testing: Ensuring tests run consistently across multiple browsers requires meticulous setup and maintenance.
  3. Dynamic Content Handling: UI tests must be resilient to dynamic content changes, which can be challenging without robust locators and waits.
  4. Visual Regression Testing: Incorporating visual regression tools to catch UI discrepancies that functional tests might miss.

Test Reporting:

  1. JUnit/TestNG Reports: Use these built-in reporting frameworks for generating XML reports.
  2. Allure Reports: A comprehensive reporting tool that provides detailed insights into test execution.
  3. Custom Reports: Develop custom reports using scripting or plugins to cater to specific reporting needs.
  4. Dashboard: Jenkins can aggregate test results into a dashboard, providing a holistic view of the testing status.

Allure Reporting:

CI/CD Integration:

  1. Continuous Integration: Automate the integration of code changes, triggering builds and tests on each commit.
  2. Continuous Deployment: Automate the deployment process, ensuring that only passing builds are deployed to production.
  3. Pipeline as Code: Define the entire CI/CD process in code using Jenkins file, ensuring version control and reproducibility.
  4. Environment Provisioning: Automate the setup and teardown of testing environments using tools like Docker and Kubernetes.

Supplement:

  1. Parallel Execution: Utilize Jenkins’ capabilities to run tests in parallel, reducing the overall execution time.
  2. Load Testing: Integrate load testing tools to evaluate the performance of the application under stress.
  3. Security Testing: Incorporate security testing into the pipeline to identify vulnerabilities early in the development process.
  4. Accessibility Testing: Ensure the application meets accessibility standards by integrating accessibility tests.

Conclusion:

There are several benefits integrating Jenkins with UI test automation, including scalability, improved reporting, and automated execution. Teams may guarantee reliable and effective UI testing procedures by utilizing Jenkins’ rich features and adhering to best practices in framework architecture, CI/CD integration, and reporting. This connection expedites the delivery process and enhances the application quality, resulting in faster and more dependable releases.

Ref Link:

https://stories.jenkins.io/user-story/to-manageable-ui-test-automation/

https://www.jenkins.io/download/

Tags:
Test Automation

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Test Automation Streamlining REST API Processes with Postman Automation Summary:In today's world, industries are increasingly focusing on the development of...

Uncategorized Enhancing Test Efficiency with Playwright, TestNG and Allure Summary:Playwright is an open-source library developed by Microsoft for automated browser...

Test Automation Continuous Integration and Delivery with Jenkins and GitHub Summary: Testing and deployment-related operations can be automated with Jenkins,...

Mobile App Test Automation with TDD Telecommunications (Cable) Location Performance Testing CONTEXT Elyments is an India-based mobile application similar to...

Leave a Reply

Your email address will not be published. Required fields are marked *