├── README.md ├── clover ├── pom.xml └── src │ ├── main │ └── java │ │ └── example │ │ └── Foo.java │ └── test │ └── java │ └── example │ ├── Foo_ESTest.java │ └── Foo_ESTest_scaffolding.java ├── cobertura ├── pom.xml └── src │ ├── main │ └── java │ │ └── example │ │ └── Foo.java │ └── test │ └── java │ └── example │ ├── Foo_ESTest.java │ └── Foo_ESTest_scaffolding.java ├── jacoco-offline ├── pom.xml └── src │ ├── main │ └── java │ │ └── example │ │ └── Foo.java │ └── test │ └── java │ └── example │ ├── Foo_ESTest.java │ └── Foo_ESTest_scaffolding.java ├── jacoco ├── pom.xml └── src │ ├── main │ └── java │ │ └── example │ │ └── Foo.java │ └── test │ └── java │ └── example │ ├── Foo_ESTest.java │ └── Foo_ESTest_scaffolding.java ├── openclover ├── pom.xml └── src │ ├── main │ └── java │ │ └── example │ │ └── Foo.java │ └── test │ └── java │ └── example │ ├── Foo_ESTest.java │ └── Foo_ESTest_scaffolding.java └── pit ├── pom.xml └── src ├── main └── java │ └── example │ └── Foo.java └── test └── java └── example ├── Foo_ESTest.java └── Foo_ESTest_scaffolding.java /README.md: -------------------------------------------------------------------------------- 1 | # Using EvoSuite together with coverage analysis tools 2 | 3 | ## PIT 4 | 5 | PIT works with generated tests if separate classloader is set to false. It does not work 6 | otherwise. 7 | 8 | ## Jacoco 9 | 10 | Jacoco with a JavaAgent for instrumentation at classloading-time works with generated tests 11 | if separate classloader is set to false. It does not work otherwise. 12 | 13 | Jacoco with offline instrumentation works regardless of the classloader 14 | setting. It is important, however, to explicitly set the location of the 15 | jacoco.exec file. The commandline for Jacoco with offline instrumentation 16 | is: 17 | 18 | mvn clean test jacoco:restore-instrumented-classes jacoco:report 19 | 20 | ## Cobertura 21 | 22 | Works regardless of classloader setting. 23 | 24 | 25 | ## Clover 26 | 27 | Works regardless of classloader setting. 28 | -------------------------------------------------------------------------------- /clover/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | org.evosuite 6 | example-clover 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 4.12 11 | 12 | 13 | 14 | 15 | junit 16 | junit 17 | ${junit.version} 18 | test 19 | 20 | 21 | org.evosuite 22 | evosuite-standalone-runtime 23 | 1.0.6 24 | test 25 | 26 | 27 | org.slf4j 28 | slf4j-nop 29 | 1.7.25 30 | test 31 | 32 | 33 | 34 | 35 | 36 | 37 | com.atlassian.maven.plugins 38 | clover-maven-plugin 39 | 4.1.2 40 | 41 | 42 | **/*_ESTest.java 43 | **/*_ESTest_scaffolding.java 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /clover/src/main/java/example/Foo.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class Foo { 4 | 5 | private int y = 0; 6 | 7 | public boolean testMe(int x) { 8 | return x == 42; 9 | } 10 | 11 | public void inc() { 12 | y++; 13 | } 14 | 15 | public boolean isFoo() { 16 | return y == 2; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /clover/src/test/java/example/Foo_ESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was automatically generated by EvoSuite 3 | * Sun Feb 11 18:46:50 GMT 2018 4 | */ 5 | 6 | package example; 7 | 8 | import org.junit.Test; 9 | import static org.junit.Assert.*; 10 | import example.Foo; 11 | import org.evosuite.runtime.EvoRunner; 12 | import org.evosuite.runtime.EvoRunnerParameters; 13 | import org.junit.runner.RunWith; 14 | 15 | @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) 16 | public class Foo_ESTest extends Foo_ESTest_scaffolding { 17 | 18 | @Test(timeout = 4000) 19 | public void test0() throws Throwable { 20 | Foo foo0 = new Foo(); 21 | boolean boolean0 = foo0.isFoo(); 22 | assertFalse(boolean0); 23 | } 24 | 25 | @Test(timeout = 4000) 26 | public void test1() throws Throwable { 27 | Foo foo0 = new Foo(); 28 | boolean boolean0 = foo0.testMe(131); 29 | assertFalse(boolean0); 30 | } 31 | 32 | @Test(timeout = 4000) 33 | public void test2() throws Throwable { 34 | Foo foo0 = new Foo(); 35 | foo0.inc(); 36 | assertFalse(foo0.isFoo()); 37 | 38 | foo0.inc(); 39 | boolean boolean0 = foo0.isFoo(); 40 | assertTrue(boolean0); 41 | } 42 | 43 | @Test(timeout = 4000) 44 | public void test3() throws Throwable { 45 | Foo foo0 = new Foo(); 46 | boolean boolean0 = foo0.testMe(42); 47 | assertTrue(boolean0); 48 | } 49 | 50 | @Test(timeout = 4000) 51 | public void test4() throws Throwable { 52 | Foo foo0 = new Foo(); 53 | boolean boolean0 = foo0.testMe(0); 54 | assertFalse(boolean0); 55 | } 56 | 57 | @Test(timeout = 4000) 58 | public void test5() throws Throwable { 59 | Foo foo0 = new Foo(); 60 | foo0.inc(); 61 | foo0.inc(); 62 | assertTrue(foo0.isFoo()); 63 | 64 | foo0.inc(); 65 | boolean boolean0 = foo0.isFoo(); 66 | assertFalse(boolean0); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /clover/src/test/java/example/Foo_ESTest_scaffolding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Scaffolding file used to store all the setups needed to run 3 | * tests automatically generated by EvoSuite 4 | * Sun Feb 11 18:46:50 GMT 2018 5 | */ 6 | 7 | package example; 8 | 9 | import org.evosuite.runtime.annotation.EvoSuiteClassExclude; 10 | import org.junit.BeforeClass; 11 | import org.junit.Before; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.evosuite.runtime.sandbox.Sandbox; 15 | import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; 16 | 17 | @EvoSuiteClassExclude 18 | public class Foo_ESTest_scaffolding { 19 | 20 | @org.junit.Rule 21 | public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); 22 | 23 | private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 24 | 25 | private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); 26 | 27 | 28 | @BeforeClass 29 | public static void initEvoSuiteFramework() { 30 | org.evosuite.runtime.RuntimeSettings.className = "example.Foo"; 31 | org.evosuite.runtime.GuiSupport.initialize(); 32 | org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 33 | org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 34 | org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 35 | org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 36 | org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 37 | org.evosuite.runtime.classhandling.JDKClassResetter.init(); 38 | setSystemProperties(); 39 | initializeClasses(); 40 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 41 | } 42 | 43 | @AfterClass 44 | public static void clearEvoSuiteFramework(){ 45 | Sandbox.resetDefaultSecurityManager(); 46 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 47 | } 48 | 49 | @Before 50 | public void initTestCase(){ 51 | threadStopper.storeCurrentThreads(); 52 | threadStopper.startRecordingTime(); 53 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 54 | org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 55 | setSystemProperties(); 56 | org.evosuite.runtime.GuiSupport.setHeadless(); 57 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 58 | org.evosuite.runtime.agent.InstrumentingAgent.activate(); 59 | } 60 | 61 | @After 62 | public void doneWithTestCase(){ 63 | threadStopper.killAndJoinClientThreads(); 64 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 65 | org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 66 | resetClasses(); 67 | org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 68 | org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 69 | org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 70 | } 71 | 72 | public static void setSystemProperties() { 73 | 74 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 75 | java.lang.System.setProperty("file.encoding", "UTF-8"); 76 | java.lang.System.setProperty("java.awt.headless", "true"); 77 | java.lang.System.setProperty("user.country", "AT"); 78 | java.lang.System.setProperty("user.language", "en"); 79 | java.lang.System.setProperty("user.timezone", "Europe/Berlin"); 80 | } 81 | 82 | private static void initializeClasses() { 83 | org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Foo_ESTest_scaffolding.class.getClassLoader() , 84 | "example.Foo" 85 | ); 86 | } 87 | 88 | private static void resetClasses() { 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /cobertura/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | org.evosuite 6 | example-cobertura 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 4.12 11 | 12 | 13 | 14 | 15 | junit 16 | junit 17 | ${junit.version} 18 | test 19 | 20 | 21 | org.evosuite 22 | evosuite-standalone-runtime 23 | 1.0.6 24 | test 25 | 26 | 27 | org.slf4j 28 | slf4j-nop 29 | 1.7.25 30 | test 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.codehaus.mojo 38 | cobertura-maven-plugin 39 | 2.7 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /cobertura/src/main/java/example/Foo.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class Foo { 4 | 5 | private int y = 0; 6 | 7 | public boolean testMe(int x) { 8 | return x == 42; 9 | } 10 | 11 | public void inc() { 12 | y++; 13 | } 14 | 15 | public boolean isFoo() { 16 | return y == 2; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /cobertura/src/test/java/example/Foo_ESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was automatically generated by EvoSuite 3 | * Sun Feb 11 18:46:50 GMT 2018 4 | */ 5 | 6 | package example; 7 | 8 | import org.junit.Test; 9 | import static org.junit.Assert.*; 10 | import example.Foo; 11 | import org.evosuite.runtime.EvoRunner; 12 | import org.evosuite.runtime.EvoRunnerParameters; 13 | import org.junit.runner.RunWith; 14 | 15 | @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) 16 | public class Foo_ESTest extends Foo_ESTest_scaffolding { 17 | 18 | @Test(timeout = 4000) 19 | public void test0() throws Throwable { 20 | Foo foo0 = new Foo(); 21 | boolean boolean0 = foo0.isFoo(); 22 | assertFalse(boolean0); 23 | } 24 | 25 | @Test(timeout = 4000) 26 | public void test1() throws Throwable { 27 | Foo foo0 = new Foo(); 28 | boolean boolean0 = foo0.testMe(131); 29 | assertFalse(boolean0); 30 | } 31 | 32 | @Test(timeout = 4000) 33 | public void test2() throws Throwable { 34 | Foo foo0 = new Foo(); 35 | foo0.inc(); 36 | assertFalse(foo0.isFoo()); 37 | 38 | foo0.inc(); 39 | boolean boolean0 = foo0.isFoo(); 40 | assertTrue(boolean0); 41 | } 42 | 43 | @Test(timeout = 4000) 44 | public void test3() throws Throwable { 45 | Foo foo0 = new Foo(); 46 | boolean boolean0 = foo0.testMe(42); 47 | assertTrue(boolean0); 48 | } 49 | 50 | @Test(timeout = 4000) 51 | public void test4() throws Throwable { 52 | Foo foo0 = new Foo(); 53 | boolean boolean0 = foo0.testMe(0); 54 | assertFalse(boolean0); 55 | } 56 | 57 | @Test(timeout = 4000) 58 | public void test5() throws Throwable { 59 | Foo foo0 = new Foo(); 60 | foo0.inc(); 61 | foo0.inc(); 62 | assertTrue(foo0.isFoo()); 63 | 64 | foo0.inc(); 65 | boolean boolean0 = foo0.isFoo(); 66 | assertFalse(boolean0); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /cobertura/src/test/java/example/Foo_ESTest_scaffolding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Scaffolding file used to store all the setups needed to run 3 | * tests automatically generated by EvoSuite 4 | * Sun Feb 11 18:46:50 GMT 2018 5 | */ 6 | 7 | package example; 8 | 9 | import org.evosuite.runtime.annotation.EvoSuiteClassExclude; 10 | import org.junit.BeforeClass; 11 | import org.junit.Before; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.evosuite.runtime.sandbox.Sandbox; 15 | import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; 16 | 17 | @EvoSuiteClassExclude 18 | public class Foo_ESTest_scaffolding { 19 | 20 | @org.junit.Rule 21 | public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); 22 | 23 | private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 24 | 25 | private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); 26 | 27 | 28 | @BeforeClass 29 | public static void initEvoSuiteFramework() { 30 | org.evosuite.runtime.RuntimeSettings.className = "example.Foo"; 31 | org.evosuite.runtime.GuiSupport.initialize(); 32 | org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 33 | org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 34 | org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 35 | org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 36 | org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 37 | org.evosuite.runtime.classhandling.JDKClassResetter.init(); 38 | setSystemProperties(); 39 | initializeClasses(); 40 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 41 | } 42 | 43 | @AfterClass 44 | public static void clearEvoSuiteFramework(){ 45 | Sandbox.resetDefaultSecurityManager(); 46 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 47 | } 48 | 49 | @Before 50 | public void initTestCase(){ 51 | threadStopper.storeCurrentThreads(); 52 | threadStopper.startRecordingTime(); 53 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 54 | org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 55 | setSystemProperties(); 56 | org.evosuite.runtime.GuiSupport.setHeadless(); 57 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 58 | org.evosuite.runtime.agent.InstrumentingAgent.activate(); 59 | } 60 | 61 | @After 62 | public void doneWithTestCase(){ 63 | threadStopper.killAndJoinClientThreads(); 64 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 65 | org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 66 | resetClasses(); 67 | org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 68 | org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 69 | org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 70 | } 71 | 72 | public static void setSystemProperties() { 73 | 74 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 75 | java.lang.System.setProperty("file.encoding", "UTF-8"); 76 | java.lang.System.setProperty("java.awt.headless", "true"); 77 | java.lang.System.setProperty("user.country", "AT"); 78 | java.lang.System.setProperty("user.language", "en"); 79 | java.lang.System.setProperty("user.timezone", "Europe/Berlin"); 80 | } 81 | 82 | private static void initializeClasses() { 83 | org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Foo_ESTest_scaffolding.class.getClassLoader() , 84 | "example.Foo" 85 | ); 86 | } 87 | 88 | private static void resetClasses() { 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /jacoco-offline/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | org.evosuite 6 | example-jacoco-offline 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 4.12 11 | 12 | 13 | 14 | 15 | junit 16 | junit 17 | ${junit.version} 18 | test 19 | 20 | 21 | org.evosuite 22 | evosuite-standalone-runtime 23 | 1.0.6 24 | test 25 | 26 | 27 | org.slf4j 28 | slf4j-nop 29 | 1.7.25 30 | test 31 | 32 | 33 | org.jacoco 34 | org.jacoco.agent 35 | runtime 36 | 0.8.0 37 | test 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.jacoco 45 | jacoco-maven-plugin 46 | 0.8.0 47 | 48 | 49 | ${project.build.directory}/coverage-reports/jacoco-ut.exec 50 | ${project.build.directory}/coverage-reports/jacoco-ut.exec 51 | 52 | ${project.reporting.outputDirectory}/jacoco-ut 53 | 54 | 55 | 56 | default-instrument 57 | 58 | instrument 59 | 60 | 61 | 62 | default-restore-instrumented-classes 63 | 64 | restore-instrumented-classes 65 | 66 | 67 | 68 | default-report 69 | 70 | report 71 | 72 | 73 | 74 | 75 | 76 | org.apache.maven.plugins 77 | maven-surefire-plugin 78 | 2.15 79 | 80 | 81 | ${project.build.directory}/coverage-reports/jacoco-ut.exec 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /jacoco-offline/src/main/java/example/Foo.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class Foo { 4 | 5 | private int y = 0; 6 | 7 | public boolean testMe(int x) { 8 | return x == 42; 9 | } 10 | 11 | public void inc() { 12 | y++; 13 | } 14 | 15 | public boolean isFoo() { 16 | return y == 2; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jacoco-offline/src/test/java/example/Foo_ESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was automatically generated by EvoSuite 3 | * Sun Feb 11 18:46:50 GMT 2018 4 | */ 5 | 6 | package example; 7 | 8 | import org.junit.Test; 9 | import static org.junit.Assert.*; 10 | import example.Foo; 11 | import org.evosuite.runtime.EvoRunner; 12 | import org.evosuite.runtime.EvoRunnerParameters; 13 | import org.junit.runner.RunWith; 14 | 15 | @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = false, useJEE = true) 16 | public class Foo_ESTest extends Foo_ESTest_scaffolding { 17 | 18 | @Test(timeout = 4000) 19 | public void test0() throws Throwable { 20 | Foo foo0 = new Foo(); 21 | boolean boolean0 = foo0.isFoo(); 22 | assertFalse(boolean0); 23 | } 24 | 25 | @Test(timeout = 4000) 26 | public void test1() throws Throwable { 27 | Foo foo0 = new Foo(); 28 | boolean boolean0 = foo0.testMe(131); 29 | assertFalse(boolean0); 30 | } 31 | 32 | @Test(timeout = 4000) 33 | public void test2() throws Throwable { 34 | Foo foo0 = new Foo(); 35 | foo0.inc(); 36 | assertFalse(foo0.isFoo()); 37 | 38 | foo0.inc(); 39 | boolean boolean0 = foo0.isFoo(); 40 | assertTrue(boolean0); 41 | } 42 | 43 | @Test(timeout = 4000) 44 | public void test3() throws Throwable { 45 | Foo foo0 = new Foo(); 46 | boolean boolean0 = foo0.testMe(42); 47 | assertTrue(boolean0); 48 | } 49 | 50 | @Test(timeout = 4000) 51 | public void test4() throws Throwable { 52 | Foo foo0 = new Foo(); 53 | boolean boolean0 = foo0.testMe(0); 54 | assertFalse(boolean0); 55 | } 56 | 57 | @Test(timeout = 4000) 58 | public void test5() throws Throwable { 59 | Foo foo0 = new Foo(); 60 | foo0.inc(); 61 | foo0.inc(); 62 | assertTrue(foo0.isFoo()); 63 | 64 | foo0.inc(); 65 | boolean boolean0 = foo0.isFoo(); 66 | assertFalse(boolean0); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /jacoco-offline/src/test/java/example/Foo_ESTest_scaffolding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Scaffolding file used to store all the setups needed to run 3 | * tests automatically generated by EvoSuite 4 | * Sun Feb 11 18:46:50 GMT 2018 5 | */ 6 | 7 | package example; 8 | 9 | import org.evosuite.runtime.annotation.EvoSuiteClassExclude; 10 | import org.junit.BeforeClass; 11 | import org.junit.Before; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.evosuite.runtime.sandbox.Sandbox; 15 | import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; 16 | 17 | @EvoSuiteClassExclude 18 | public class Foo_ESTest_scaffolding { 19 | 20 | @org.junit.Rule 21 | public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); 22 | 23 | private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 24 | 25 | private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); 26 | 27 | 28 | @BeforeClass 29 | public static void initEvoSuiteFramework() { 30 | org.evosuite.runtime.RuntimeSettings.className = "example.Foo"; 31 | org.evosuite.runtime.GuiSupport.initialize(); 32 | org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 33 | org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 34 | org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 35 | org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 36 | org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 37 | org.evosuite.runtime.classhandling.JDKClassResetter.init(); 38 | setSystemProperties(); 39 | initializeClasses(); 40 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 41 | } 42 | 43 | @AfterClass 44 | public static void clearEvoSuiteFramework(){ 45 | Sandbox.resetDefaultSecurityManager(); 46 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 47 | } 48 | 49 | @Before 50 | public void initTestCase(){ 51 | threadStopper.storeCurrentThreads(); 52 | threadStopper.startRecordingTime(); 53 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 54 | org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 55 | setSystemProperties(); 56 | org.evosuite.runtime.GuiSupport.setHeadless(); 57 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 58 | org.evosuite.runtime.agent.InstrumentingAgent.activate(); 59 | } 60 | 61 | @After 62 | public void doneWithTestCase(){ 63 | threadStopper.killAndJoinClientThreads(); 64 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 65 | org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 66 | resetClasses(); 67 | org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 68 | org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 69 | org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 70 | } 71 | 72 | public static void setSystemProperties() { 73 | 74 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 75 | java.lang.System.setProperty("file.encoding", "UTF-8"); 76 | java.lang.System.setProperty("java.awt.headless", "true"); 77 | java.lang.System.setProperty("user.country", "AT"); 78 | java.lang.System.setProperty("user.language", "en"); 79 | java.lang.System.setProperty("user.timezone", "Europe/Berlin"); 80 | } 81 | 82 | private static void initializeClasses() { 83 | org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Foo_ESTest_scaffolding.class.getClassLoader() , 84 | "example.Foo" 85 | ); 86 | } 87 | 88 | private static void resetClasses() { 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /jacoco/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | org.evosuite 6 | example-jacoco 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 4.12 11 | 12 | 13 | 14 | 15 | junit 16 | junit 17 | ${junit.version} 18 | test 19 | 20 | 21 | org.evosuite 22 | evosuite-standalone-runtime 23 | 1.0.6 24 | test 25 | 26 | 27 | org.slf4j 28 | slf4j-nop 29 | 1.7.25 30 | test 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.jacoco 38 | jacoco-maven-plugin 39 | 0.8.0 40 | 41 | 45 | 46 | pre-unit-test 47 | 48 | prepare-agent 49 | 50 | 51 | 52 | ${project.build.directory}/coverage-reports/jacoco-ut.exec 53 | 57 | surefireArgLine 58 | 59 | 60 | 64 | 65 | post-unit-test 66 | test 67 | 68 | report 69 | 70 | 71 | 72 | ${project.build.directory}/coverage-reports/jacoco-ut.exec 73 | 74 | ${project.reporting.outputDirectory}/jacoco-ut 75 | 76 | 77 | 81 | 82 | 83 | 84 | org.apache.maven.plugins 85 | maven-surefire-plugin 86 | 2.15 87 | 88 | 89 | ${surefireArgLine} 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /jacoco/src/main/java/example/Foo.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class Foo { 4 | 5 | private int y = 0; 6 | 7 | public boolean testMe(int x) { 8 | return x == 42; 9 | } 10 | 11 | public void inc() { 12 | y++; 13 | } 14 | 15 | public boolean isFoo() { 16 | return y == 2; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jacoco/src/test/java/example/Foo_ESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was automatically generated by EvoSuite 3 | * Sun Feb 11 18:46:50 GMT 2018 4 | */ 5 | 6 | package example; 7 | 8 | import org.junit.Test; 9 | import static org.junit.Assert.*; 10 | import example.Foo; 11 | import org.evosuite.runtime.EvoRunner; 12 | import org.evosuite.runtime.EvoRunnerParameters; 13 | import org.junit.runner.RunWith; 14 | 15 | @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = false, useJEE = true) 16 | public class Foo_ESTest extends Foo_ESTest_scaffolding { 17 | 18 | @Test(timeout = 4000) 19 | public void test0() throws Throwable { 20 | Foo foo0 = new Foo(); 21 | boolean boolean0 = foo0.isFoo(); 22 | assertFalse(boolean0); 23 | } 24 | 25 | @Test(timeout = 4000) 26 | public void test1() throws Throwable { 27 | Foo foo0 = new Foo(); 28 | boolean boolean0 = foo0.testMe(131); 29 | assertFalse(boolean0); 30 | } 31 | 32 | @Test(timeout = 4000) 33 | public void test2() throws Throwable { 34 | Foo foo0 = new Foo(); 35 | foo0.inc(); 36 | assertFalse(foo0.isFoo()); 37 | 38 | foo0.inc(); 39 | boolean boolean0 = foo0.isFoo(); 40 | assertTrue(boolean0); 41 | } 42 | 43 | @Test(timeout = 4000) 44 | public void test3() throws Throwable { 45 | Foo foo0 = new Foo(); 46 | boolean boolean0 = foo0.testMe(42); 47 | assertTrue(boolean0); 48 | } 49 | 50 | @Test(timeout = 4000) 51 | public void test4() throws Throwable { 52 | Foo foo0 = new Foo(); 53 | boolean boolean0 = foo0.testMe(0); 54 | assertFalse(boolean0); 55 | } 56 | 57 | @Test(timeout = 4000) 58 | public void test5() throws Throwable { 59 | Foo foo0 = new Foo(); 60 | foo0.inc(); 61 | foo0.inc(); 62 | assertTrue(foo0.isFoo()); 63 | 64 | foo0.inc(); 65 | boolean boolean0 = foo0.isFoo(); 66 | assertFalse(boolean0); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /jacoco/src/test/java/example/Foo_ESTest_scaffolding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Scaffolding file used to store all the setups needed to run 3 | * tests automatically generated by EvoSuite 4 | * Sun Feb 11 18:46:50 GMT 2018 5 | */ 6 | 7 | package example; 8 | 9 | import org.evosuite.runtime.annotation.EvoSuiteClassExclude; 10 | import org.junit.BeforeClass; 11 | import org.junit.Before; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.evosuite.runtime.sandbox.Sandbox; 15 | import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; 16 | 17 | @EvoSuiteClassExclude 18 | public class Foo_ESTest_scaffolding { 19 | 20 | @org.junit.Rule 21 | public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); 22 | 23 | private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 24 | 25 | private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); 26 | 27 | 28 | @BeforeClass 29 | public static void initEvoSuiteFramework() { 30 | org.evosuite.runtime.RuntimeSettings.className = "example.Foo"; 31 | org.evosuite.runtime.GuiSupport.initialize(); 32 | org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 33 | org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 34 | org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 35 | org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 36 | org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 37 | org.evosuite.runtime.classhandling.JDKClassResetter.init(); 38 | setSystemProperties(); 39 | initializeClasses(); 40 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 41 | } 42 | 43 | @AfterClass 44 | public static void clearEvoSuiteFramework(){ 45 | Sandbox.resetDefaultSecurityManager(); 46 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 47 | } 48 | 49 | @Before 50 | public void initTestCase(){ 51 | threadStopper.storeCurrentThreads(); 52 | threadStopper.startRecordingTime(); 53 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 54 | org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 55 | setSystemProperties(); 56 | org.evosuite.runtime.GuiSupport.setHeadless(); 57 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 58 | org.evosuite.runtime.agent.InstrumentingAgent.activate(); 59 | } 60 | 61 | @After 62 | public void doneWithTestCase(){ 63 | threadStopper.killAndJoinClientThreads(); 64 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 65 | org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 66 | resetClasses(); 67 | org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 68 | org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 69 | org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 70 | } 71 | 72 | public static void setSystemProperties() { 73 | 74 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 75 | java.lang.System.setProperty("file.encoding", "UTF-8"); 76 | java.lang.System.setProperty("java.awt.headless", "true"); 77 | java.lang.System.setProperty("user.country", "AT"); 78 | java.lang.System.setProperty("user.language", "en"); 79 | java.lang.System.setProperty("user.timezone", "Europe/Berlin"); 80 | } 81 | 82 | private static void initializeClasses() { 83 | org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Foo_ESTest_scaffolding.class.getClassLoader() , 84 | "example.Foo" 85 | ); 86 | } 87 | 88 | private static void resetClasses() { 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /openclover/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | org.evosuite 6 | example-openclover 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 4.12 11 | 12 | 13 | 14 | 15 | junit 16 | junit 17 | ${junit.version} 18 | test 19 | 20 | 21 | org.evosuite 22 | evosuite-standalone-runtime 23 | 1.0.6-SNAPSHOT 24 | test 25 | 26 | 27 | org.slf4j 28 | slf4j-nop 29 | 1.7.25 30 | test 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.openclover 38 | clover-maven-plugin 39 | 4.2.1 40 | 41 | 42 | **/*_ESTest.java 43 | **/*_ESTest_scaffolding.java 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /openclover/src/main/java/example/Foo.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class Foo { 4 | 5 | private int y = 0; 6 | 7 | public boolean testMe(int x) { 8 | return x == 42; 9 | } 10 | 11 | public void inc() { 12 | y++; 13 | } 14 | 15 | public boolean isFoo() { 16 | return y == 2; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /openclover/src/test/java/example/Foo_ESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was automatically generated by EvoSuite 3 | * Sun Feb 11 18:46:50 GMT 2018 4 | */ 5 | 6 | package example; 7 | 8 | import org.junit.Test; 9 | import static org.junit.Assert.*; 10 | import example.Foo; 11 | import org.evosuite.runtime.EvoRunner; 12 | import org.evosuite.runtime.EvoRunnerParameters; 13 | import org.junit.runner.RunWith; 14 | 15 | @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = false, useVNET = true, resetStaticState = false, separateClassLoader = true, useJEE = true) 16 | public class Foo_ESTest extends Foo_ESTest_scaffolding { 17 | 18 | @Test(timeout = 4000) 19 | public void test0() throws Throwable { 20 | Foo foo0 = new Foo(); 21 | boolean boolean0 = foo0.isFoo(); 22 | assertFalse(boolean0); 23 | } 24 | 25 | @Test(timeout = 4000) 26 | public void test1() throws Throwable { 27 | Foo foo0 = new Foo(); 28 | boolean boolean0 = foo0.testMe(131); 29 | assertFalse(boolean0); 30 | } 31 | 32 | @Test(timeout = 4000) 33 | public void test2() throws Throwable { 34 | Foo foo0 = new Foo(); 35 | foo0.inc(); 36 | assertFalse(foo0.isFoo()); 37 | 38 | foo0.inc(); 39 | boolean boolean0 = foo0.isFoo(); 40 | assertTrue(boolean0); 41 | } 42 | 43 | @Test(timeout = 4000) 44 | public void test3() throws Throwable { 45 | Foo foo0 = new Foo(); 46 | boolean boolean0 = foo0.testMe(42); 47 | assertTrue(boolean0); 48 | } 49 | 50 | @Test(timeout = 4000) 51 | public void test4() throws Throwable { 52 | Foo foo0 = new Foo(); 53 | boolean boolean0 = foo0.testMe(0); 54 | assertFalse(boolean0); 55 | } 56 | 57 | @Test(timeout = 4000) 58 | public void test5() throws Throwable { 59 | Foo foo0 = new Foo(); 60 | foo0.inc(); 61 | foo0.inc(); 62 | assertTrue(foo0.isFoo()); 63 | 64 | foo0.inc(); 65 | boolean boolean0 = foo0.isFoo(); 66 | assertFalse(boolean0); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /openclover/src/test/java/example/Foo_ESTest_scaffolding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Scaffolding file used to store all the setups needed to run 3 | * tests automatically generated by EvoSuite 4 | * Sun Feb 11 18:46:50 GMT 2018 5 | */ 6 | 7 | package example; 8 | 9 | import org.evosuite.runtime.annotation.EvoSuiteClassExclude; 10 | import org.junit.BeforeClass; 11 | import org.junit.Before; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.evosuite.runtime.sandbox.Sandbox; 15 | import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; 16 | 17 | @EvoSuiteClassExclude 18 | public class Foo_ESTest_scaffolding { 19 | 20 | @org.junit.Rule 21 | public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); 22 | 23 | private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 24 | 25 | private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); 26 | 27 | 28 | @BeforeClass 29 | public static void initEvoSuiteFramework() { 30 | org.evosuite.runtime.RuntimeSettings.className = "example.Foo"; 31 | org.evosuite.runtime.GuiSupport.initialize(); 32 | org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 33 | org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 34 | org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 35 | org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.OFF; //RECOMMENDED; 36 | org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 37 | org.evosuite.runtime.classhandling.JDKClassResetter.init(); 38 | setSystemProperties(); 39 | initializeClasses(); 40 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 41 | } 42 | 43 | @AfterClass 44 | public static void clearEvoSuiteFramework(){ 45 | Sandbox.resetDefaultSecurityManager(); 46 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 47 | } 48 | 49 | @Before 50 | public void initTestCase(){ 51 | threadStopper.storeCurrentThreads(); 52 | threadStopper.startRecordingTime(); 53 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 54 | org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 55 | setSystemProperties(); 56 | org.evosuite.runtime.GuiSupport.setHeadless(); 57 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 58 | org.evosuite.runtime.agent.InstrumentingAgent.activate(); 59 | } 60 | 61 | @After 62 | public void doneWithTestCase(){ 63 | threadStopper.killAndJoinClientThreads(); 64 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 65 | org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 66 | resetClasses(); 67 | org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 68 | org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 69 | org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 70 | } 71 | 72 | public static void setSystemProperties() { 73 | 74 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 75 | java.lang.System.setProperty("file.encoding", "UTF-8"); 76 | java.lang.System.setProperty("java.awt.headless", "true"); 77 | java.lang.System.setProperty("user.country", "AT"); 78 | java.lang.System.setProperty("user.language", "en"); 79 | java.lang.System.setProperty("user.timezone", "Europe/Berlin"); 80 | } 81 | 82 | private static void initializeClasses() { 83 | org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Foo_ESTest_scaffolding.class.getClassLoader() , 84 | "example.Foo" 85 | ); 86 | } 87 | 88 | private static void resetClasses() { 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /pit/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | org.evosuite 6 | example-pit 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 4.12 11 | 12 | 13 | 14 | 15 | junit 16 | junit 17 | ${junit.version} 18 | test 19 | 20 | 21 | org.evosuite 22 | evosuite-standalone-runtime 23 | 1.0.6 24 | test 25 | 26 | 27 | org.pitest 28 | pitest-parent 29 | 1.3.2 30 | pom 31 | 32 | 33 | org.slf4j 34 | slf4j-nop 35 | 1.7.25 36 | test 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /pit/src/main/java/example/Foo.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | public class Foo { 4 | 5 | private int y = 0; 6 | 7 | public boolean testMe(int x) { 8 | return x == 42; 9 | } 10 | 11 | public void inc() { 12 | y++; 13 | } 14 | 15 | public boolean isFoo() { 16 | return y == 2; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pit/src/test/java/example/Foo_ESTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was automatically generated by EvoSuite 3 | * Sun Feb 11 18:46:50 GMT 2018 4 | */ 5 | 6 | package example; 7 | 8 | import org.junit.Test; 9 | import static org.junit.Assert.*; 10 | import example.Foo; 11 | import org.evosuite.runtime.EvoRunner; 12 | import org.evosuite.runtime.EvoRunnerParameters; 13 | import org.junit.runner.RunWith; 14 | 15 | @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = false, useJEE = true) 16 | public class Foo_ESTest extends Foo_ESTest_scaffolding { 17 | 18 | @Test(timeout = 4000) 19 | public void test0() throws Throwable { 20 | Foo foo0 = new Foo(); 21 | boolean boolean0 = foo0.isFoo(); 22 | assertFalse(boolean0); 23 | } 24 | 25 | @Test(timeout = 4000) 26 | public void test1() throws Throwable { 27 | Foo foo0 = new Foo(); 28 | boolean boolean0 = foo0.testMe(131); 29 | assertFalse(boolean0); 30 | } 31 | 32 | @Test(timeout = 4000) 33 | public void test2() throws Throwable { 34 | Foo foo0 = new Foo(); 35 | foo0.inc(); 36 | assertFalse(foo0.isFoo()); 37 | 38 | foo0.inc(); 39 | boolean boolean0 = foo0.isFoo(); 40 | assertTrue(boolean0); 41 | } 42 | 43 | @Test(timeout = 4000) 44 | public void test3() throws Throwable { 45 | Foo foo0 = new Foo(); 46 | boolean boolean0 = foo0.testMe(42); 47 | assertTrue(boolean0); 48 | } 49 | 50 | @Test(timeout = 4000) 51 | public void test4() throws Throwable { 52 | Foo foo0 = new Foo(); 53 | boolean boolean0 = foo0.testMe(0); 54 | assertFalse(boolean0); 55 | } 56 | 57 | @Test(timeout = 4000) 58 | public void test5() throws Throwable { 59 | Foo foo0 = new Foo(); 60 | foo0.inc(); 61 | foo0.inc(); 62 | assertTrue(foo0.isFoo()); 63 | 64 | foo0.inc(); 65 | boolean boolean0 = foo0.isFoo(); 66 | assertFalse(boolean0); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /pit/src/test/java/example/Foo_ESTest_scaffolding.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Scaffolding file used to store all the setups needed to run 3 | * tests automatically generated by EvoSuite 4 | * Sun Feb 11 18:46:50 GMT 2018 5 | */ 6 | 7 | package example; 8 | 9 | import org.evosuite.runtime.annotation.EvoSuiteClassExclude; 10 | import org.junit.BeforeClass; 11 | import org.junit.Before; 12 | import org.junit.After; 13 | import org.junit.AfterClass; 14 | import org.evosuite.runtime.sandbox.Sandbox; 15 | import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; 16 | 17 | @EvoSuiteClassExclude 18 | public class Foo_ESTest_scaffolding { 19 | 20 | @org.junit.Rule 21 | public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); 22 | 23 | private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 24 | 25 | private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); 26 | 27 | 28 | @BeforeClass 29 | public static void initEvoSuiteFramework() { 30 | org.evosuite.runtime.RuntimeSettings.className = "example.Foo"; 31 | org.evosuite.runtime.GuiSupport.initialize(); 32 | org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 33 | org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 34 | org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 35 | org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 36 | org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 37 | org.evosuite.runtime.classhandling.JDKClassResetter.init(); 38 | setSystemProperties(); 39 | initializeClasses(); 40 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 41 | } 42 | 43 | @AfterClass 44 | public static void clearEvoSuiteFramework(){ 45 | Sandbox.resetDefaultSecurityManager(); 46 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 47 | } 48 | 49 | @Before 50 | public void initTestCase(){ 51 | threadStopper.storeCurrentThreads(); 52 | threadStopper.startRecordingTime(); 53 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 54 | org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 55 | setSystemProperties(); 56 | org.evosuite.runtime.GuiSupport.setHeadless(); 57 | org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 58 | org.evosuite.runtime.agent.InstrumentingAgent.activate(); 59 | } 60 | 61 | @After 62 | public void doneWithTestCase(){ 63 | threadStopper.killAndJoinClientThreads(); 64 | org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 65 | org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 66 | resetClasses(); 67 | org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 68 | org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 69 | org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 70 | } 71 | 72 | public static void setSystemProperties() { 73 | 74 | java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 75 | java.lang.System.setProperty("file.encoding", "UTF-8"); 76 | java.lang.System.setProperty("java.awt.headless", "true"); 77 | java.lang.System.setProperty("user.country", "AT"); 78 | java.lang.System.setProperty("user.language", "en"); 79 | java.lang.System.setProperty("user.timezone", "Europe/Berlin"); 80 | } 81 | 82 | private static void initializeClasses() { 83 | org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Foo_ESTest_scaffolding.class.getClassLoader() , 84 | "example.Foo" 85 | ); 86 | } 87 | 88 | private static void resetClasses() { 89 | } 90 | } 91 | --------------------------------------------------------------------------------