Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • So what happens if one of the requirements IS that duplicates aren't allowed (one record in the database actually maps to a single entity in the domain). Commented Nov 6, 2012 at 14:21
  • It's times like this when the internet sucks, because I can't actually show you what my tests look like. But if it helps I'm not really doing an integration test. I'm not looking at the database at all. I'm using selenium and specflow to actually manipulate my website in code. Commented Nov 6, 2012 at 14:24
  • @MattPhillips Your issue is two fold. Your requirements should not call out database records and common knowledge. If a user doesn't care/know about it then it shouldn't be a requirement. Secondly, Selenium is a great tool for testing the application UI and presentation logic, but this is no substitute for a true acceptance test. An acceptance test should not concern itself with duplicate database records, just that I can't create a user with the same ID. This kind of test is too low level for the UI to do well as you are experiencing. cont... Commented Nov 6, 2012 at 15:22
  • ... Try writing repeatable unit tests that use transactions for testing low level functionality and leave your Selenium tests for the more interesting tests involving UI interaction. Spring has really good support for transactional JUnit tests that automatically rollback. It is worth looking into. Commented Nov 6, 2012 at 15:24
  • Ok, so your example "just that I can't create a user with the same ID" doesn't map to my domain though. My test shows that when you try and create something with duplicate data, an error message is shown in the UI, that to me would be the acceptance piece. But how do I structure it so I don't end up with 10's if not hundreds of fake data records just to use the UI properly. My application is very data driven. So i can't just fill the fields with garbage in order to test. Commented Nov 6, 2012 at 15:27