For the SessionFactory case, we have OgmTestCase and OgmTestRunner which avoids creating a new SessionFactory for each test method. As for JPA related tests, we only have JpaTestCase which initializes a new EntityManagerFactory for each test method. This is especially problematic for Cassandra as connecting to the cluster is very slow so reconnecting to the cluster for each test method costs us a lot of time. |