Best way to test and revert

Download and share automation modules and examples.
PFE
Posts: 1
Joined: Tue Mar 21, 2017 1:41 pm

Best way to test and revert

Post by PFE » Tue Mar 21, 2017 1:51 pm

Hi,

I'm currently evaluating ranorex and I have a question to the best way to revert/restore the test-data.

I would like to GUI-test the complete registration of a user of our WinForms-application.
So I start the recorder and give all the inputs for registration. After that I validate the registration (e.g. check if the username is in the userlist).
The test succeeds for the first execution, but for all following tests it fails, because the user already exists. That is ok so far, because for each test scenario I have to create a new blank database. correct?

In complex scenarios it is not the best behaviour.
I have some recording modules which I want to reuse, e.g. the creation of a customer.
When testcase A creates the customer everything is fine. When the following testcase B creates the customer, it fails because the customer already exists.

The restore of a blank database for each testcase can't be the solution because it would expand the time of each testcase.

Is there a better way to do my tests?

Thanks for any help,
Patrick

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Best way to test and revert

Post by qwertzu » Tue Mar 21, 2017 3:15 pm

Hi PFE,

There is no action where you can simply reset everything to the state before your test. But you could add a module in which you delete the customer before you create a new one.
When testcase A creates the customer everything is fine. When the following testcase B creates the customer, it fails because the customer already exists.
You could try to create the customer only one time and in the other testcase use the same customer without creating a new one if this is an option.

regards,

qwertzu

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Best way to test and revert

Post by krstcs » Tue Mar 21, 2017 3:28 pm

I would recommend not using the same customer over and over. For each test case, use a different customer. Then, at the end, reset the DB so you only have to do it once.

Your other option is to dynamically generate the customer info each time using a random generator. This makes the test easier to run, but you loose the benefit of have the same information every time, which means you never know for sure if a failure is due to a bug, or to the random data. I try to stay away from this type of testing, unless it is required for some reason.
Shortcuts usually aren't...

barkha
Posts: 18
Joined: Tue May 16, 2017 9:41 pm
Location: Ames, IA
Contact:

Re: Best way to test and revert

Post by barkha » Thu Jul 26, 2018 8:35 pm

I agree with Krstcs.
You can create multiple global variables for username.
Then make username in you "Create user" recording a variable and bind it to a different global variable every time you reuse it.
You will be able to reuse the code with no problem.
The rollback the database in your teardown at the end of test suite. :) :) :) :)

Marie143
Posts: 30
Joined: Tue Jul 26, 2022 5:20 pm

Re: Best way to test and revert

Post by Marie143 » Thu Dec 21, 2023 5:25 pm

I would advise against repeatedly utilizing the same client. Use a distinct customer for every test case. Finally, reset the database so that you only need to do it once. Flash Party Photo Booth Oklahoma City fence panels wellington
Glen Oaks drywall contractorwedding photo booth rental DFW http://wellingtonretainingwall.co.nz/