Simplify Your Functional Test Reporting using AWS S3: Step-by-Step Instructions and Examples
In this article, I will share why we need a functional test reporting system and how we manage the test reporting process in Dolap Team.
Some Technical Challenges That We Solved with AWS S3
Before utilizing a test reporting system, we checked each project’s pipelines for test results. The implementation of the AWS bucket system has provided the following benefits to our testing process:
- Centralized access to test reports for multiple projects
- More efficient tracking and analysis of test results
- Faster identification and resolution of issues.
- Improved communication and collaboration among the team
What is AWS S3?
Amazon Simple Storage Service (Amazon S3) is an object storage service offering scalability, data availability, security, and performance.
AWS S3 Bucket stores data as objects, with each object being identified by a unique key. This key is then used to access and manipulate the object within the system.
Why AWS S3?
- Amazon S3 offers scalable and cost-effective pricing based on storage and bandwidth usage.
- AWS S3 has a simple structure for storing and distributing static HTML files, making it easy to set up a website quickly.
- Static content such as HTML, CSS, and JavaScript files can be hosted on Amazon S3, resulting in faster website load times as content can be served directly from the S3 bucket without the need for server-side processing.
How to use Amazon S3 Bucket to report on your functional test projects
Initially, we must create a bucket via Amazon Web Service (AWS).
We will navigate to the AWS > S3 > Buckets and click “Create Bucket” button.
After clicking the “Create Bucket” button, we can name our bucket and save the settings using the default configurations.
Once the bucket is created, the next step is to prepare the GitLab CI/CD script in the gitlab-ci.yml
file.
stages:
- test
- report
functional_test:
run_tests:
stage: test
script:
- mvn clean install -U -s settings.xml
expire_in: 24h
paths:
- target/cucumber-html-reports
upload_reports:
stage: report
script:
- aws s3 cp target/cucumber-html-reports s3://example-bucket-5/example-project/target/cucumber-html-reports --recursive
This file is used to define the build, test, and deployment steps for your application, as well as any required environment variables and AWS credentials.
In the gitlab-ci.yml
file, we can define the test stage to run your project's tests and specify that the cucumber-html-reports
file should be stored as an artifact for up to 24 hours later use.
We can use the aws s3 cp
command to copy the cucumber-html-reports
file from the target directory to our S3 bucket named example-bucket-5.
This will recursively copy the cucumber-html-reports
directory and its contents to the specified S3 bucket location.
To begin with, you need to install the AWS Command Line Interface (CLI) and have access to a terminal or command prompt. After running this command, we can see example-project in example-bucket-5.
If we navigate to the example-project/target/cucumber-html-reports
directory, we should be able to locate the overview-features.html
file.
overview-features.html
file contains an overview of your test results in HTML format, we can click it and the object overview page will open.
We can click on the Object URL link to view the cucumber reports.
This will open the overview-features.html
file in a web browser, displaying the results of our tests :)
How to consolidate multiple projects into a single reporting bucket
After defining gitlab-ci.yml
CI/CD steps to our projects when we run our project in the pipeline,
We can see our projects in our created bucket.
By uploading index.html
file, we can see all of our Object URLs on one page. This makes it easier to manage and access our objects.
The index.html
contain links to each Object URL for quick navigation.After opening the index.html
Object URL, we can easily access the reports.
This saves our time and customizes the page for a better user experience.
Conclusion
In summary, we initially used an AWS bucket for functional test reporting on the Dolap and found it to be useful and convenient.
We will show the last report in the test reporting system. If you prefer, you can define the reports by dates and store them in the bucket.
However, we later discovered Gitlab pages and decided to switch to it as an alternative to using external storage like AWS bucket.
You can refer to the following articles for more information on reporting processes on the Dolap Team.
How to Run Selenium Automation Tests on Gitlab CI/CD & Github Actions?
Thanks for reading :)
If you want to be part of a team that tries new technologies and want to experience a new challenge every day, come to us.