Question

I'm writing WebDriver NUnit tests using the WebDriver Page.Factory/Page object model. My problem is that my test must run on many variants that are subtly different.

For obvious reasons I don't want to have to maintain 15 versions of the same tests. I also wish to avoid the use of excessive switch statements in an effort to make the tests easier to maintain by the less experience test team members.

I want to write the tests generically so they will work with all variants by using some form of property/config file to pass in specific parameters where there is any difference. These parameters would include url components, search and assert strings, and page object references and may even specify specific test step methods.

I've looked at the NUnit Property and TestCaseData attributes but I'm not sure these would be of any use to me.

The tests will be executed for only one variant at a time. Would a property file file for each variant be the best approach and if so how would I go about implementing it?

Was it helpful?

Solution

In the end I found the best way to overcome my problems to parameterise these tests was to move all the variant specific field values to a database table. A config file which uses the variant value to build the test urls was also used by an sql query to return the desired values for the variant under test.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top