Duplication between xml dataset file and test method code
The only problem is that I have duplicate test data. I have the XML dataset for DbUnit and I also need to create some entities manually to use as expected results, so I have a subset of this dataset hardcoded in the test classes.
I don't have much experience with testing, but it looks to me that these test could break easily when changed. Is there any way to avoid this kind of duplication that is worth the effort?
I usually prefer to setup the test database with JPA as well. This a type-safer approach and also tests the JPA annotations at the same time.
精彩评论