Hi Bartosz,
I'm experiencing very strange behavior of persistence extension. If I first run tests they pass, but when later on I mess up script with expected dataset then both tests fail.
If we have ATest with two @Test methods then if assertions for ShouldMatchDataSet of first executed method fail then the other method doesn't get dataset inserted into DB.
Sample below assumes that method "remove" is run first and method "attemptoToRemoveNothing" is run afterwards:
{code:java}
@Transactional
@UsingDataSet
@RunWith(Arquillian.class)
public class VenueListViewCIT {
@Deployment
public static WebArchive createDeployment(){...}
@ViewScopeRequired
@ConversationScopeRequired
@Test
@ShouldMatchDataSet("com.test.venue.VenueListViewCIT.xml")
public void attemptoToRemoveNothing()
{
// Given
assertTrue(venueListView.getVenueSelection().isEmpty());
assertEquals(3, venueListView.getVenueList().getResultList().size());
...
}
@ViewScopeRequired
@ConversationScopeRequired
@Test
// @ShouldMatchDataSet //during first run this is uncommented and the script contains good dataset; during second run this is commented out
@ShouldMatchDataSet("com.test.venue.VenueListViewCIT.xml") //during first run this is commented out; during second run this is uncommented and points to initial script so this test will fail
public void remove()
{
// Given
assertTrue(venueListView.getVenueSelection().isEmpty());
assertEquals(3, venueListView.getVenueList().getResultList().size());
...//do remove element so that ShouldMatchDataSet fails after the test as it's pointing to initial state
}
}{code}
Hmm... that's scary I will look at it this evening and try to reproduce it.
Thanks for the feedback!