qxf2 / cars-api

A sample REST application to help testers learn to write API automation
MIT License
6 stars 20 forks source link

Add session variables #7

Closed Annapooraniqxf2 closed 4 years ago

Annapooraniqxf2 commented 4 years ago

The main purpose here is we wanted to introduce 'session' to our trainee. So we are adding session to the cars app.

1. Changed files are:

  1. cars_app.py
  2. README.md
  3. templates/index.html

2. Changes we did in cars_app.py:

  1. import the flask session and added session support to all the methods in cars_app.py
  2. README.md: changed the instruction by using session
  3. templates/index.html: Explained the session with example

3. How did we test it? Since we have added session to our cars app we have changed the api test in our framework also. For changes to our automation framework, please refer this Github issue qxf2/qxf2-page-object-model: issue 255. We ran this test and made sure that the current API test was not broken.

Simple acceptance tests are

a. Try without using session In a Python interpreter,

  1. Get the list of the cars
  2. Add a new car
  3. In another Python interpreter, get the list of cars and you should see the newly added car

b. Try with session In a Python interpreter,

  1. Create a requests session object
  2. Get the list of the cars
  3. Add new cars
  4. In another Python interpreter, create a requests Session object
  5. Use that session object to get the list of cars and you shouldn;t see the newly added car