locked
unit testing strategy question RRS feed

  • Question

  • Hello - How do you manage unit tests that are based on the assumption of existing data?

    For example, say I have a unit test that validates that you can't save 2 different users with the same email address.  For this example let's say that the test email address is test@test.com.

    At the start of the test should I delete any users having an email address of test@test.com? Then insert a new user row with test@test.com?  Then run my duplicate user email insert test?

    Along these lines, in environments with heavy automated unit testing, what is the impact to the database in regards to "junk" data?  Basically, data that only exists to support tests or as a byproduct of tests?

    Also, do you run the unit tests after you have deployed to production?  I see how this could be valuable but at the same time I see how this could potentially create junk data in production....

    Tuesday, October 9, 2012 2:52 PM

All replies

  • I would think there is a testing forum? There are numerous ways of doing this. Since you've said 'Unit Test', and I'm assuming you mean that, then I would look at Fakes and Mocks.

    http://pauliom.wordpress.com

    Friday, October 12, 2012 8:37 AM