0

I'm dealing now with a problem during creating automation of integration test.

I would like to:

  1. input data via selenium RC
  2. check if values are correct in DB after import.

I've got problem with logic of those tests. Now I do it as it follows: in one test I generate random data (first name, last name, etc of the person). Then, by simple select from DB I obtain unique person_id key (I assumed that if first and last name are both 8 characters long, random generated strings I can treat them as unique) and then use this id in next queries.

Is this method correct? If not, how can I deal with it?

mawelpac
  • 35
  • 1
  • 8

1 Answers1

0

What exactly is the purpose of this integration test?

If you're testing your DB adaptor layer, then is there any need to use the Web UI? You can exercise the adaptor directly.

If you're testing the Web UI is there any need to actually store data in a database? You can check the values using a mock (or some other sort of test double).

If you're doing an end-2-end skim test, is it necessary to check the actual data values (over and above the success of the actual interaction)? And if the answer is yes, maybe the test should be along the lines of:

Given I have registered as "Random Person"
When I retrieve my details
Then my name is displayed correctly.
Seb Rose
  • 3,628
  • 18
  • 29
  • App I'm testing consists public available website with it's own DB where people input some data. In cyclic import task data is transferred into internal DB of second app. I would like to input some data (random generated) on website and then check if they imported correctly into second app. – mawelpac Aug 16 '12 at 06:30
  • It seems to me that there are several components here that can be tested independently. You could use mocked DBs for both apps to test the cyclic import; you can test the data entry using the UI and a stubbed middle tier; you can test the DB adaptors on their own; and so on. The aim here is to test small chunks of functionality so that when you do your system (end-2-end) test you're just checking that the app is wired up correctly. So you might only need to use Selenium to create a person and (for example) check that the number of people in the second database has increased by one. – Seb Rose Aug 21 '12 at 07:22
  • Yeah, but what if I would like to test cohesion of entire process? – mawelpac Aug 24 '12 at 06:41
  • I'm not saying that you won't have end-2-end system tests. I'm saying that the value of system tests is to ensure that the various components are 'wired-up' correctly. Use more granular unit and integration/component tests to verify the business functionality and collaborations respectively. – Seb Rose Aug 24 '12 at 13:55