nyu-devops-team / customers

The customers resource is a representation of the customer accounts of the eCommerce site
2 stars 1 forks source link

Clearing database after behave tests #87

Closed nancywen25 closed 4 years ago

nancywen25 commented 4 years ago

As a developer, I need to clear the customers database after the BDD tests So that test data does not persist in the database.

Assumptions:

Acceptance Criteria:

Given the app is launched
When I press 'Search' before adding anything to the database,
Then nothing should be returned.
nancywen25 commented 4 years ago

From prof: Hi @Nancy Wen , If you want to remove the data after all tests have run, then the after_all() function in environment.py is a good place to put this. You might write a function in your service that can do this and then just call that function. It's not a bad thing to leave the data because any testing that is done should clean the database before it starts so I don't mind data being left behind. (not a big deal, it's a dev instance)

nancywen25 commented 4 years ago

I do clear the database before running the behave tests so no need to add function to clear database after tests: https://github.com/nyu-devops-team/customers/blob/master/features/steps/customer_steps.py#L26