How to use new test data everytime the test case runs(non reusable test data)

We are testing Activating a card on a web page. Every time the test is run it needs a new test data as the previous card would have been activated already.I want to add a list of cards to test database so that every time it picks a new one and once used it deletes the test data on the database.

hello harini,
i would do it this way:
i would define table in DB with all card information i need, with some logical attribute like “used”
then i’ll prepare db connection like described here: and after each successfull TC i’ll mark used data in DB by updating “used” flag so next time you will know what is available

1 Like

Thanks Andrej,

that sure helps.I will give it a try.Meanwhile can you also guide as how can I mark a data as used on the DB.I have very limited coding skills hence it will be great if you have some pointers in that direction.

And also we are using Excel sheet at the moment as our DB .Will the link provided by you will also work for Excel?

to work with excel you will need just correct driver take a look at this:

this will allow you to access excel files as they are DB. (not test that, just know it exist) 2nd option is to bind excel as ODBC source and then use JDBC:ODBC driver but this will restrict you in way that you will need to define this source on every computer that need to execute tests (additional work)

to work wit DB i assume you have connection to database(excel as DB) and informations about cards are in table cards then you can execute SQL like:

SELECT * FROM cards WHERE used = false;

this will return you all records that were not used, then pick one and based on some identifier on the end of sucessfull TC you will execute something like this:

UPDATE cards SET used = true WHERE id = ID_OF_USED_RECORD;

all above are basic SQL commands.
hope that helps

1 Like