Please post your Web Driver questions in official Web Driver forum

Sunday, May 29, 2016

Where is my default Test Data

Importance of test data can not be emphasized enough whether we are writing automated or manual tests. With automated test we often deal with data objects. Data object is an object which encapsulates properties of data dealing with object. For example username and password could be encapsulated in to Credential object and passed on to required test methods.

But many a times we require default test data which can be used to facilitate system under test reach certain stage. How do we provide such default test data so that it is readily available for use? One way to deal with this is to use constructor on data object class which would initialize the data object with default data. In the following example TeamAttributes data object is initialized with default values -


Screenshot from 2016-04-20 09:59:30.png

Of course default values can also be read from a property file instead of being hardcoded as above :-)

And now if any of your test want to use default data then they can just instantiate data object class as-

Screenshot from 2016-04-20 10:03:49.png

What do you think of this approach of providing default test data? How do you handle default test data?
Fork me on GitHub