RelationDigest

Monday, 25 December 2023

How to run Serenity tests with GitHub Actions

Site logo image vibssingh posted: " Last Updated On HOME This tutorial explains the steps to create a GitHub Action for the Serenity tests and execute the tests in that workflow. Table of Contents Why GitHub? Important points Implementation Steps Create GitH" QA Automation Expert

How to run Serenity tests with GitHub Actions

vibssingh

Dec 25

Last Updated On

HOME

This tutorial explains the steps to create a GitHub Action for the Serenity tests and execute the tests in that workflow.

Table of Contents

  1. Why GitHub?
  2. Important points
  3. Implementation Steps
    1. Create GitHub Actions and Workflows
    2. Select the type of Actions
    3. Generation of Sample pipeline
    4. Commit the changes
    5. Verify that the workflow is running
    6. Published Serenity Report on GitHub

Why GitHub?

The flexible aspects of Selenium WebDrivers and GitHub Actions enable users to create powerful, fast, and efficient automated testing workflows in CI/CD environments.

CI/CD pipelines have contributed to the success of the DevOps cycle in all software development projects. This is a holistic process that bridges development and operations. Continuous integration helps development teams deploy code efficiently, and continuous delivery automates code deployment.

Important points

1. The Serenity Web tests need to run in the headless mode. As we are using Chrome browser, use the below code in the serenity.config:

           headless.mode = true 

2. Install Chrome browser in ubuntu. Use the below code:

     - uses: browser-actions/setup-chrome@latest     - run: chrome --version  

Implementation Steps

Step 1 - Create GitHub Actions and Workflows

I have a repository available in GitHub - Serenity_Cucumber-JUnit5 as shown in the below image. Go to the "Actions" tab.  Click on the "Actions" tab.

Step 2 - Select the type of Actions

You will see that GitHub recommends Actions depending on the project. In our case, it is recommending actions suitable for a Java project. I have selected the "Java with Maven" option as my project is built in Maven.

Step 3 - Generation of Sample pipeline

If you choose an existing option, it will automatically generate a .yaml for the project as shown below.

We will replace the current workflow with the following yml file as shown below:

 name: Serenity Tests in GitHub   on:   push:     branches: [ "main" ]   pull_request:     branches: [ "main" ]   jobs:   build:       runs-on: ubuntu-latest       steps:     - uses: actions/checkout@v4     - name: Set up JDK 17       uses: actions/setup-java@v4       with:         java-version: '17'         distribution: 'temurin'         cache: maven      - uses: browser-actions/setup-chrome@latest     - run: chrome --version          - name: Build with Maven       run: mvn clean verify             - name: Test Report Generation       uses: actions/upload-artifact@v4       if: success() || failure()       with:           name: Serenity Report                 # Name of the folder           path: target/site/serenity/           # Path to test results 

Step 4 - Commit the changes

After the changes, hit the "Start Commit" button.

This will give the option to add a description for the commit. It will also enable the user to commit either to the main branch or commit to any other branch that exists in the project. Click on the "Commit new file" button to set up the workflow file.

It will create a maven.yml file as shown below in the project.

Step 5 - Verify that the workflow is running

Next, head over to the "Actions" tab, and you will see your YAML workflow file present under the tab. The yellow sign represents that the job is in the queue.

In Progress - When the job starts building and running, you will see the status change from "Queued" to "in progress".

Passed - If the build is successful, you will see a green tick mark. 

Click on the workflow and the below screen is displayed. It shows the status of the run of the workflow, the total time taken to run the workflow, and the name of the .yml file.

Below shows all the steps of the workflow.

Step 6 - Published Serenity Report on GitHub

From the logs of the Workflow, you can see that the Test Report step was executed successfully.

Once the pipeline run, a Serenity Report folder will be generated as shown in the below image:

When we click on the folder Serenity Report, a zipped file will be downloaded, and we can extract it to see all the files contained within it.

Open the folder and we will see all the files including index.html and others.

Open the index.html and we will see the report.

To know more about Chrome installation, please refer to this tutorial - browser-actions/setup-chrome.

The complete code can be found here on GitHub - vibssingh/Serenity_Cucumber_JUnit5.

Congratulations! We just created our CI workflow for running our Selenium test cases.

Comment
Like
Tip icon image You can also reply to this email to leave a comment.

Manage your email settings or unsubscribe.

WordPress.com and Jetpack Logos

Get the Jetpack app to use Reader anywhere, anytime

Follow your favorite sites, save posts to read later, and get real-time notifications for likes and comments.

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com on Twitter WordPress.com on Facebook WordPress.com on Instagram WordPress.com on YouTube
WordPress.com Logo and Wordmark title=

Automattic, Inc. - 60 29th St. #343, San Francisco, CA 94110  

at December 25, 2023
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Episode 9 - A Dangerous Week

Listen now (96 mins) | Charlie Kirk, RIP. ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

  • MACo Seeks Local Representation in Workgroup on School Facilities
    On March 26, 2024, Associate Policy Director Brianna January submitted written t...
  • “Barbie” snubbed with Oscar nominations
    ...
  • [New post] Could Trucker Populism Create A New North American Nation? By James Kirkpatrick
    Robert Gore posted: "We can only hope—preferably a new, much freer nation. From James Kirkpatrick at unz.com: Earlier...

Search This Blog

  • Home

About Me

RelationDigest
View my complete profile

Report Abuse

Blog Archive

  • September 2025 (20)
  • August 2025 (54)
  • July 2025 (59)
  • June 2025 (53)
  • May 2025 (47)
  • April 2025 (42)
  • March 2025 (30)
  • February 2025 (27)
  • January 2025 (30)
  • December 2024 (37)
  • November 2024 (31)
  • October 2024 (28)
  • September 2024 (28)
  • August 2024 (2729)
  • July 2024 (3249)
  • June 2024 (3152)
  • May 2024 (3259)
  • April 2024 (3151)
  • March 2024 (3258)
  • February 2024 (3046)
  • January 2024 (3258)
  • December 2023 (3270)
  • November 2023 (3183)
  • October 2023 (3243)
  • September 2023 (3151)
  • August 2023 (3241)
  • July 2023 (3237)
  • June 2023 (3135)
  • May 2023 (3212)
  • April 2023 (3093)
  • March 2023 (3187)
  • February 2023 (2865)
  • January 2023 (3209)
  • December 2022 (3229)
  • November 2022 (3079)
  • October 2022 (3086)
  • September 2022 (2791)
  • August 2022 (2964)
  • July 2022 (3157)
  • June 2022 (2925)
  • May 2022 (2893)
  • April 2022 (3049)
  • March 2022 (2919)
  • February 2022 (2104)
  • January 2022 (2284)
  • December 2021 (2481)
  • November 2021 (3146)
  • October 2021 (1048)
Powered by Blogger.