jeudi 26 octobre 2017

Run each cucumber test independently

I'm using cucumber and maven on eclipse and what I'm trying to do is run each test independently. For example I have a library system software that basically allows users to borrow books and do other stuff.

One of the conditions is that users can only borrow a max of two books so I wrote to make sure that the functionality works. This is my feature file:

Scenario: Borrow over max limit
Given "jim@help.ca" logs in to the library system
When "Sun@help.ca" order his first book with ISBN "9781611687910"
And "Sun@help.ca" order another book with ISBN "9781442667181"
And "Sun@help.ca" tries to order another book with ISBN "1234567890123"
Then Sun will get the message that says "The User has reached his/her max number of books"

I wrote a corresponding step definition file and every worked out great. However, in the future I want to use the same username ("Sun@help.ca") for borrowing books as though Sun@help.ca has not yet borrowed any books. I want each test to be independent of each other.

Is there any way of doing this...maybe there's something I can put into my step definition classes. If there's a way please help me. Any help is greatly appreciated and I thank you in advance!

Aucun commentaire:

Enregistrer un commentaire