maven-surefire-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Höger <choe...@cs.tu-berlin.de>
Subject forking single tests from junit test suite
Date Mon, 23 Mar 2009 14:01:59 GMT
Hi,

I need to test a feature for my project on large test input files.
To get that, I create TestCases from a single TestSuite dynamically. The
relevant part of the pom looks like:


> 			<plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 				<artifactId>maven-surefire-plugin</artifactId>
> 				<configuration>
> 					<reportFormat>plain</reportFormat>
> 					<trimStackTrace>false</trimStackTrace>
> 					<forkMode>perTest</forkMode>
> 					<argLine>-XX:+HeapDumpOnOutOfMemoryError</argLine>
> 					<excludes>
> 						<exclude>**/IncrementalParsePhase1Test.java</exclude>
> 						<exclude>**/incremental/testparser/*.java</exclude>
> 					</excludes>
> 					<includes>
> 						<include>**/IncrementalParsingTestSuite.java</include>
> 					</includes>
> 				</configuration>
> 			</plugin>

In my TestSuite there runs a loop:


> for (int i = 0; i < Lexer.getCachedInput().size(); i++) {
> 				//brake for large test cases
> 				if (i % (1 + (Lexer.getCachedInput().size() / 20)) != 0)
> 					continue;
> 
> 				Range diffRange = new Range(i, i);
> 
> 				IncrementalParsePhase1Test test = new IncrementalParsePhase1Test(
> 						Lexer.getInputFileName(), Lexer.getCachedInput(),
> 						generatedStates, diffRange, rootAbsy, Lexer.getCachedInput().get(i).getSavedConfiguration());
> 				suite.addTest(test);
> 			}

The problem is, that maven does not seem to run every testCase in a new
vm, but reuses the old one (and somehow prevents the GC from cleaning
up old testcases), so earlier or later I run into a heap overflow.

This is especially bad, as I want to measure the performance of some operations and the GC
seems to interrupt my threads thus creating huge performance problems.

So is it possible to make surefire run each test in a single vm?

regards

Christoph

Mime
View raw message