Unable to run consecutive test suites due to error
See original GitHub issueWe have two Junit tests that each declare @BeforeClass and @AfterClass methods to setup and tear down the MongodExecutable instance, for example:
@BeforeClass
public static void setupClass() throws Exception {
IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(mongoPort, Network.localhostIsIPv6()))
.build();
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExecutable = runtime.prepare(mongodConfig);
mongod = mongodExecutable.start();
mongo = new MongoClient("localhost", mongoPort);
db = mongo.getDB("mydb");
}
@AfterClass
public static void tearDownClass() {
if (mongodExecutable != null)
mongodExecutable.stop();
}
Running each of these tests separately works fine, but running in the same suite the second test to run fails and reports:
WARNING: emptying DBPortPool to localhost/127.0.0.1:27017 b/c of error
Followed by a broken pipe error from the code attempting to access the DB.
In the @Before
method for each test we are loading test data by executing db.doEval(...);
and in the @After
we are doing the same with a dropDatabase()
call to clean up.
Issue Analytics
- State:
- Created 10 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Xcode 12 issues running multiple t… | Apple Developer Forums
Xcode 12 issues running multiple test suites with 'Underlying Error: Invalid device state' [only when running via SSH].
Read more >Consecutive test cases fails with Error: Not supported #910
Current Behavior When executing several tests in the same file each consecutive test fails with the following error: Error: Uncaught [Error: ...
Read more >Unable to launch multiple test cases in test Suite ...
Hi, It shows me a problem (An internal error occurred during: “Launching the test suite…”. Java heap space) when I run a test...
Read more >'Unable to load a Suite class' while running ScalaTest in IntelliJ
I'm basically "right-clicking" on the test and selecting "Run". What I get is the following error: "C:\Program Files\Java\jdk1.7.0_25\bin\java" ...
Read more >Can't use a Test Case twice in a Test Plan | Support
It appears that it is impossible to add a given Test Case to a Test Plan more than once. (I get an error...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I’ve got same issue, and my tests are passed after adding @DirtiesContext to each test method:
and some test dependencies in build.gradle:
Here’s my implementation for reference: