Dragonfly
Dragonfly

Reputation: 217

Test Automation - Design for Web/SOA architecture

I am finding much about test automation and web architecture using Selenium/java however I'd like to ask about another scenario.

Say you have a text file that contains customer details. A process then needs to be manually triggered that will parse that file and load the details in a database. The details are then view-able from a web page. From the web page you can further add/delete/edit/navigate records.

As a design I was thinking that I would follow this logic:

  1. Set-up file and automatically trigger process
  2. Automatically parse file and compare with database entries to ensure they were entered correctly.
  3. Automatically trigger selenium test to log-in and view results in web page, hence I would have compared the file to the database and the web page to the database.

I am not sure about this approach though, and it provides for various challenges especially in terms of re-initializing state between each test. Do you think there is a better approach where ultimately I need to make sure that the details in the file end up in the right database tables/columns and that the details can be correctly seen in the web page.

Many thanks!

Upvotes: 0

Views: 380

Answers (1)

Adam T
Adam T

Reputation: 675

I think your workflow is adequate, with a small exception.

For state, think about the following from a high level concept of "phases".

Setup Phase:

  • Have your automation routine 'create' records for you that you will need to use during your automated routines that will follow.
  • As the routines create the records for you in DB, it would probably be good to have a column with a GUID (36-character) that you can generate. In other words, do not assume that you will create unique row id 1, row id 2, row id 3 (etc).
  • Since you will know this value at create-time, write a manifest file to keep track of the DB records you will query during your test run.

Tests Run Phase:

  • Run your automated tests, having them utilize the manifest file to get their ids necessary. You already mentioned this in "say you have a text file that contains customer details".
  • With the IDs in the manifest, do whatever processes you need to do for test(s).

Teardown:

  • Using the manifest file, find your DB records by the identifiers (GUIDs) and perform the SQL statements to delete these records.
  • Truncate the manifest file so it is now empty (or you can write to it in a non-append way for all writes, which will accomplish same goal).

Upvotes: 1

Related Questions