QA Automation for SuperNurse Recruitment Service
- 1 Goal
- 2 Design
- 3 Docker Based Backend Local Environment Setup
- 4 Automation Test Development
Goal
Automate SuperNurse Recruitment backend environment buildup, “integration” branch deployment, GraphQL API integration test automation.
Design
Use existing docker image for the standard application(Firebase Emulator, PostgresQL, RabbitMQ, ElasticSearch) to provide services
Deploy specific branch of supernurse-backend into Bitbucket pipeline docker to have the QA preflight environment ready
Automate local environment setup for QA local test
Automate GraphQL API automation with REST Assured
Diagram of Preflight Environment
Number of docker services depends on project progress, below diagram is just for high level idea (diagram will not be updated if project change to use other search technics).
Diagram of Local QA test Environment
Number of docker services depends on project progress, below diagram is just for high level idea (diagram will not be updated if project change to use other search technics).
Trigger the test from Bitbucket Pipeline
Daily run for full regression
Customized run with given dev branch name
As of 2022-Dec-7:
2023-Feb-17: Currently has been upgraded to support both frontend and backend customized branch name, and then build the hooked environment inside Bitbucket Pipeline docker.
Docker Based Backend Local Environment Setup
Steps for backend local QA environment setup
Docker, Homebrew and Colima required before proceeding_ ✅
If homebrew is not installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
Once homebrew is installed run the following CLI commands
brew install docker
brew install docker-compose
brew install colima
brew upgrade colima
colima start --cpu 4 --memory 8
mkdir -p ~/.docker/cli-plugins
# If on a M1 Mac
ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
brew install docker-credential-helper
# If on an Intel Mac
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
Clone the supernurse-backend branch each time for a clean setup
# Maintain branch under qa folder to local testing
mkdir qa
cd qa
# always stop existing running process before clone new branch
# enter into the directory where you cloned the branch, e.g. qa/supernurse-backend
# if it is first time ever, skip the cleanup and proceed to git clone
cd supernurse-backend
docker compose down
# remove the testing folder everytime
cd ..
rm -rf supernurse-backend
git clone --branch integration --single-branch git@bitbucket.org:relias/supernurse-backend.git
cd supernurse-backend
Copy docker-compose.yml and entrypoint.sh from supernurse-qa repo into the supernurse-backend directory from previous step
Make sure your local environment has
docker compose
command, then in the Terminal executedocker compose up
to bring up all the services, ordocker compose down
to tear down all the services
In your browser, http://localhost:5556/explorer.html should now be working
Run GraphQL API automation test cases (There are two approaches, please use either way)
Run GraphQL API test from BitBucket pipeline with merged test cases
go to
pipelines
and clickrun pipeline
, to run regression test for QA environment, follow below screenshot.
Run GraphQL API test locally:
Fill in all those password fields in env.properties (under resources folder)
local-SeededSuperUserPwd=
local-SuperUserPwd=
local-OrgAdminPwd=
local-RecruiterPwd=
local-RecruiterTestPwd=
local-NursePwd=
local-NurseTestPwd=
mvn -B verify -Denvironment=qa -DrunSuite=APIstablebranch.xml --file pom.xml
Run Selenium UI automation test cases(There are two approaches, please use either way)
Run Selenium UI test from BitBucket pipeline with merged test cases
go to
pipelines
and clickrun pipeline
, to run regression test for QA environment, follow below screenshot.
Run Selenium UI test locally:
Get test code from
master
branchBring up docker container with selenium chrome image (below is the example for Mac M1 only, google selenium docker image for your own CPU model and browser type preferred)
Connect to VNC
vnc://localhost:5900
to check your test execution if needed
mvn -B verify -Denvironment=qa -DrunSuite=UIfullregression.xml --file pom.xml
Automation Test Development
Writing Selenium UI integration test
2023-01-24: 1 healthcheck UI automation case running daily https://bitbucket.org/relias/supernurse-qa/pipelines/results/204
Dependencies: TestNG + Java + Selenium
Test case structure
UI element locators are defined under
pages
folderUI test cases are defined under
tests/ui
folder
Writing GraphQL API integration test
2023-4-28: 254 backend GraphQL API and 2 frontend Selenium automation cases running daily for QA environment and integration branchhttps://bitbucket.org/relias/supernurse-qa/pipelines/results/1145
2023-03-31: 224 backend GraphQL API and 2 frontend Selenium automation cases running daily for QA environment and integration branchhttps://bitbucket.org/relias/supernurse-qa/pipelines/results/651
2023-03-20: 201 backend GraphQL API and 1 frontend Selenium automation test cases running daily for QA environment and integration branch
2023-03-20: supernurse-backend code coverage is also improved before gigantic nurse code change(SUP-159)
2023-02-28: 159 backend GraphQL API automation test cases running daily for integration branch
2023-03-01: supernurse backend automation has code coverage listed below
2023-01-31: 85 backend GraphQL API automation test cases running daily for integration branch
2022-12-31: 52 backend GraphQL API automation test cases running daily for develop branch
2022-11-30: 24 backend GraphQL API automation test cases running daily for develop branch
Dependencies: TestNG + REST Assured
Test case structure
More extensions(under common folder) for supernuser-backend API are added as time goes
Test case example