0

Consider a somewhat old monolith application, there are no APIs available for the likes of creating users etc. In this instance which approach is best in terms of handling test data setup etc.

  • Prepopulate the database with data sets and have tests use specific data, restoring the database at the beginning of the pipeline so state is always set? obviously this has some down sides.

  • Input into the database as the tests are executing, e.g addUser(); would add a new user calling some Stored procedure or just run queries using JDBC.

  • Input the data using WebDriver itself, this one is insane..

What is the best approach? To me its pre populating the database with an assortment of accounts and using those directly in the tests, as a short term approach until APIs can be developed to aid with this process?

3
  • There is no word as 'test data' in the headline. Jan 17, 2018 at 12:21
  • What exactly you are testing in the application and at what level of testing? Jan 17, 2018 at 12:23
  • In simple words, what are your test goals? Jan 17, 2018 at 12:26

2 Answers 2

1

When I did something like this I went with option 2. I created new data before every test case. While this was pretty safe (each test used unique data) I would probably do it differently next time.

If you have tests that do not change the data, why not re-use it? If you do change data, maybe roll back any changes before the next test. That way you only need to define the different states of data that matter. Rolling back changes will have a perf hit, but I think it would help with maintaining sanity.

0

I would investigate adding APIs for the creating the data you need. If that's not possible, I would consider looking for another job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.