Transactional Server Tests

You can create server tests which roll back their actions by adding some additional notation to the server test example. This allows you to run tests and afterward clean out any data you may have written to the database. The database tables and the state of the system will be the same as before the test was run.

Here is the same server test we just saw, but with transactional notation added.

import com.onenetwork.platform.tools.test.AbstractServerTest;
import com.onenetwork.platform.tools.test.TransactionalServerTest;
 
//Annotation to run the method in one transaction and rollback at the end of transaction
@TransactionalServerTest
public class MyServerTest extends AbstractServerTest {
public void testUsecase1(){
fail("transactional annotation leaves your system as clean as it was when you started.");
}
}