Open jonenst opened 4 years ago
Does this change help in this case? I think we have a similar issue with our tests - they just take too long. Since the mentioned change is not released yet, I cannot say anything about whether it improves anything for us.
Hi @nikeee The change you mentioned should improve the situation. As mentioned it's not yet released but you can give it a try with latest published snapshot version of cu (4.3.1.1-SNAPSHOT : https://oss.sonatype.org/content/repositories/snapshots/)
To solve this issue, you can write your own AbstractCassandraUnitTestExecutionListener implementation that only loads the cassandraDataSet if the server is not initialized, and call the startServer method from your own AbstractCassandraUnitTestExecutionListener implementation, which would look like this :
@Override public void beforeTestClass(TestContext testContext) throws Exception { startServer(testContext); }
@Override public void afterTestMethod(TestContext testContext) throws Exception { }
@Override public void afterTestClass(TestContext testContext) throws Exception { }
Would you be interested in a PR @jsevellec ?
@jsevellec any chance to get this released?
Hi, when you have many tests, it becomes prohibitively expansive to recreate the schema for every test method (like CassandraUnitTestExecutionListener or CassandraUnitDependencyInjectionTestExecutionListener do). CassandraUnitDependencyInjectionIntegrationTestExecutionListener partially solves the performance problem by resetting the schema once per class. But when you have many test classes the performance problem is still prohibitive (my test suite takes one hour to execute when recreating the schema everytime, thirty seconds when not recreating the schema)
Would you be open to adding a TestExecutionListener that never drops or truncate previous tables ? This would be useful when all is needed is a globally available database for the whole duration of the tests. If not, what are the alternatives ?
ps: Of course the downside is that the persisted state of the database allows writing tests that depend on global state and work or fail unexpectedly depending on which tests are run and their order. The responsibility of writing "correct" tests falls on the developer.
Thanks in advance, Jon