Skip to content

This repository contains the code of API automation for Brit QA API test. Framework used is Pytest-Allure framework.

Notifications You must be signed in to change notification settings

satyajit5988/BritAPIAutomate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Repository -

https://github.com/satyajit5988/BritAPIAutomate

Python Packages Required To Run The Tests -

The project root location contains the requirement.txt file which lists all the packages required to run the test after cloning the repository in the local system. Base python version is 3.13.XX.

Few of the major libraries that are used in this project are:

  1. pip install requests

  2. pip install json

  3. pip install jsonpath

  4. pip install pytest

  5. pip install pytest-xdist

  6. pip install pytest-html

  7. pip install pytest-json-report

  8. pip install pytest-cov

  9. pip install openpyxl

10 ) pip install allure-pytest

Cloning Code Repository -

In order to clone the repository on your local system, create a folder to store the code, open GitBash terminal and redirect to the created folder location and run below commands:

cd <Path of folder>

git clone https://github.com/satyajit5988/BritAPIAutomate.git

Setting Up GIT For Source Code Management -

Git can be used for pushing or pulling your code. Steps to set up remote GIT repository is as follows:

  1. Create a remote repository by login to GitHub. Note the HTTP's URL to connect to it - git@github.com:XYZ/ABC.git

  2. Now go to the folder where all your automation code is written. Create a local repository by initializing git = git init

  3. Check status of untracked file by running below command - git status

  4. Add these files to staging area - git add or git add .

  5. Commit these changes - git commit -m "Updating project Files"

  6. Then connect the local and remote repository by running the command - git remote add origin git@github.com:XYZ/ABC.git

  7. Set the branch to which code is to be pushed - git branch -M main

  8. Finally push your code using below command - git push -u origin main

Setting Up CI Pipeline Using GitHub Actions -

GitHub Actions can be used for pushing or pulling your code. Steps to set up remote GIT repository is as follows:

  1. In our project repository, create the folders:

    Open GitBash and run the below commands:

    cd /path/to/your/repo

    mkdir -p .github/workflows

  2. Create a .yml file and add the below code to it:

       name: Python CI Pipeline (Github Actions)
    
       on:
         push:
           branches:
             - main
         pull_request:
           branches:
             - main
    
       jobs:
         test:
           runs-on: ubuntu-latest
    
        steps:
          - name: Checkout code
            uses: actions/checkout@v3
    
          - name: Set up Python
            uses: actions/setup-python@v4
            with:
              python-version: '3.13'
    
          - name: Install dependencies
            run: |
              python -m pip install --upgrade pip
              pip install -r requirements.txt
    
          - name: Create Reports Folder
            run: |
              mkdir -p Reports
    
          - name: Run tests
            run: |
              pytest TestCases/test_EndToEnd.py -v --html=Reports/report.html --capture=no --disable-warnings
    
          - name: Upload HTML report
            uses: actions/upload-artifact@v4
            with:
              name: TestReportHTML
              path: Reports/report.html
    
  3. Commit this file and push to repo:

    git add .github/workflows/ci.yml

    git commit -m "Adding CI pipeline yml file"

    git push origin main

  4. Go to Actions tab in GitHub repository and check if the workflow ran, and it is successful or not - https://github.com/satyajit5988/BritAPIAutomate/actions

Observations:

1) With the PUT Request we get following error when we try to delete any of the existing user.

{ "error": "7 is a reserved id and the data object of it cannot be overridden. You can create a new object via POST request and use new generated by id from it to send a PUT request." }

2) When we hit overall 200 requests from an IP address, we get the following message which explains that we have hit our limit for the day. { "error": "We are very sorry but you reached your limit of requests per day. Our current limit is equal to 100 requests per day. The reason for that is the fact that servers cost money and 200 requests per user per day is all that we can afford at the moment. Tomorrow the limit will reset and you will be able to continue. Thanks and have a good day!" }

About

This repository contains the code of API automation for Brit QA API test. Framework used is Pytest-Allure framework.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages