It is an answer to the CEGID CHALLENGE
The challenge was divided in 4 different parts:
1: QA
2: UI Tests
3: API Tests
4: Development
Goal: Writing Test Cases
Challenge:
- Analyse the website https://www.cegid.com/ib/pt/casos-de-sucesso/
- Explore the website understanding its capabilities and features.
- Identify most important test scenarios to be covered.
- Write at least 3 test cases, positive or negative, that you consider top priority.
Create a text or markdown file for each test scenario.
The scenarios is on this file
For this challenge, I created the scenarios using the language Javascript and the framework Cypress.
Navigate to the e2e-tests
project and install the dependencies:
cd .\e2e-tests\
npm install
You have to run the setup script to create the environment file parameters Run the script to create the setup for QA or PROD environment
QA Environment:
npm run setup:qa
Scenario:
- Access the website https://www.demoblaze.com/
- Login using the username 'admin' and password 'admin’.
- Add the 'Iphone 6 32Gb’ phone to the shopping cart.
- Add the 'ASUS Full HD’ monitor to the shopping cart
- Place the order
You can run the test above using 2 options, headed or headless mode.
Running npm run test
you will run the test in headless mode, only the results will be shown in the console log:
npm run test
Running npm run test:headed
, the browser will open and you will be able to see the script execution in action:
npm run test:headed
After the run is completed, you will be able to see the results of the test on the terminal console.
But, the script will generate a report with the result of the test on report folder in html format.
The report will be created like this image:
I created the tests for this part of the challenge using Python as the language and PYTEST as the framework.
First of all, please make sure that you have Python installed on your machine. If not, you can download the latest version of Python here https://www.python.org/downloads/windows/
Navigate to the api-tests
project folder and install the requirements:
cd .\api-tests\
pip install -r requirements.txt
For this test, you have to create your API_TOKEN
, access this URL, https://gorest.co.in/consumer/login, and log in with your preferred account type.
Save the token generated into .env
file in the api-tests
folder:
API_TOKEN="YOUR GENERATED TOKEN HERE"
Scenario:
- Create a new user
- Get the newly created user to check that it was created successfully
- Delete the user
To run the test, run the command:
python -m pytest -v
The test will be executed and you can see the results in the console terminal.
To run the tests and generate a report html file, you have to run the command
python -m pytest --html=report.html -v
After the run is completed, a reporter file html will be created into the root folder api-tests/report.html
The report will be created like this image:
For this part of the challenge, I created a script in Javascript language using NodeJs
Create a method, in the language of your choice, to detect if a string is a palindrome - reads the same backwards or forward.
Examples of palindrome words: kayak, deified, rotator
Input: String to validate
Output: True if the input String is palindrome, False otherwise
In the terminal console, go to the root of the project and select the command below:
node isPalindrome "WORD"
You can check if any word is a Palindrome or if any phrase is a palindrome as well.
node .\isPalindrome.js "Socorram-me, subi no ônibus em Marrocos."
To get the response of this execution as TRUE or FALSE, you must add the code echo $?
.
node .\isPalindrome.js "Socorram-me, subi no ônibus em Marrocos."
echo $?
The result of this execution will be like:
Debugger attached.
"Socorram-me, subi no ônibus em Marrocos." is a palindrome
Waiting for the debugger to disconnect...
True