Page 1 of 1

Best way to test and revert

Posted: Tue Mar 21, 2017 1:51 pm
by PFE
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

Re: Best way to test and revert

Posted: Tue Mar 21, 2017 3:15 pm
by qwertzu
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

Re: Best way to test and revert

Posted: Tue Mar 21, 2017 3:28 pm
by krstcs
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.

Re: Best way to test and revert

Posted: Thu Jul 26, 2018 8:35 pm
by barkha
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. :) :) :) :)

Re: Best way to test and revert

Posted: Thu Dec 21, 2023 5:25 pm
by Marie143
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/