Giter Club home page Giter Club logo

bookstore-api-tests's Introduction

bookstore-api-tests

Description: Demonstrate API test automation of Book Store API in Python and PyTest.

Platform: Darwin

Features

  • Pytest test framework
  • Parallel execution (~5x faster than sequential)
  • Random execution
  • Parametrize (DDT) test cases
  • HTML report with HTTP request/response logs
  • Categorize tests (smoke vs regression)
  • Performance profiling
  • No data collision
  • Repeat N-time(s) execution

Prerequisite Software

Download and install Python 3.9.0 for Mac.

Setup

  1. Setup Virtual Environment
make setup
  1. Install Dependencies
make install
  1. Activate Your Virtual Environment
bookstore

You should see (.bookstore) in your command prompt.

Execute the Tests

make

View the HTML Report

reports/report.html

Deactivate Your Virtual Environment

deactivate

Demos

PyCharm/Jenkins: demo.mov

Github/Jenkins: jenkins.mov

bookstore-api-tests's People

Contributors

billychow68 avatar

Watchers

James Cloos avatar  avatar

bookstore-api-tests's Issues

Refactor BaseTest::new_user

id = str(uuid.uuid4()).split('-',1)[0].rstrip() seems a bit "hacky".

The following options don't work in parallel mode in that they don't generate unique strings or they don't work as documented (bugs):

  1. random-username plug-in
  2. random-password-generator
  3. DateTime module

Update doc with features

  1. Parallel (scale-up) and random execution
  2. HTML report with detail request/response logs
  3. Parametrize tests
  4. Performance profiling
  5. Support for repeated tests
  6. Pytest testing framework
  7. No data collisions

Stats: sequential duration vs parallel duration

Check best practices

Need better assertion errors

Assertion errors are useless and doesn't assist in debugging:

[gw3] darwin -- Python 3.9.0 /Users/billy/.demoqa-selenium/bin/python3

self = <tests.home_page_test.TestHomePage object at 0x108e67eb0>, driver = <selenium.webdriver.chrome.webdriver.WebDriver (session="ae188793008127d6d15b1ca048cc3830")>

    def test_page_load(self, driver):
        home_page = HomePage(driver)
        home_page.open_home_page()
>       assert home_page.validate_page_load()
E       assert False
E        +  where False = <bound method HomePage.validate_page_load of <pages.home_page.HomePage object at 0x108e67c40>>()
E        +    where <bound method HomePage.validate_page_load of <pages.home_page.HomePage object at 0x108e67c40>> = <pages.home_page.HomePage object at 0x108e67c40>.validate_page_load

tests/home_page_test.py:11: AssertionError

Consider moving the assertions closer to the validation step.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.