A tour around the astrophysics lab
Vineet Reynolds L. P.
Red Hat
too hard > too slow > no time > no fun
The purpose of automated testing is to enable change. Verifying correctness is just a nice side-effect. - Jeremy Norris
So you can rule your code, not the bugs!
Extensible
&
Flexible
Test as you usually do....
Or drive your development through tests...
No problems!
Implement your own.
So you don't fight your Data Access Layer
Prefer commits. Test your database engine thoroughly.
@Test
@UsingDataSet("customer.xml")
@ShouldMatchDataSet("customer-with-account.xml")
public void testCreateAccountForCustomer() {
// Setup. Query for a customer
Customer customer = em.find(Customer.class, 1L);
// Execute. Associate an account with the queried entity
customerService.createAccount(customer);
// Verify. Query for the updated customer
// Avoid this, for REPEATABLE_READ/SERIALIZABLE
em.flush();
em.clear();
Customer updatedCustomer = em.find(Customer.class, 1L);
assertThat(updatedCustomer.getAccount(), equalTo(expectedAccount));
}
Avoid large datasets if you can.
Design and prepare datasets for reuse across tests.
Selenium/WebDriver for functional black box tests
Don't let your black box tests fool you
Far from it!