title: How to specify Evosuite dependencies
body: <p>When you want to generate tests for a java project using Evosuite, You have to specify: </p>
  
  <ol>
  <li><p>class under test</p></li>
  <li><p>The classpath where you can find the bytecode of the class under test and its dependencies</p></li>
  </ol>
  
  <p>So I give the following on the command prompt:</p>
  
  <pre><code>$EVOSUITE -prefix com.lightbend.akka.sample  -projectCP target/classes:target/dependency
  </code></pre>
  
  <p><code>$EVOSUITE</code> stands for <code>java -jar evosuite.jar</code></p>
  
  <p><code>com.lightbend.akka.sample</code> represents the package where I have four classes to be tested. </p>
  
  <p><code>target/classes</code> is the folder where I have all my classes under test bytecode.</p>
  
  <p><code>target/dependency</code> is the folder where I have my dependencies as jars.</p>
  
  <p>Out of the four classes under test, one has no dependencies. It is a simple implementation of stack pop and push. If I have just this class inside the <code>com.lightbend.akka.sample</code> the tests suite for this class automatically generated by Evosuite.</p>
  
  <p>The other three classes are implementations that use AKKA and thus have dependencies on Akka jars among other jars inside <code>target/dependency</code>. For these tests, generation fails as Evosuite fails to find a class: <code>Error while initializing target class: Class not found: akka/actor/ActorRef:</code> </p>
  
  <p>What am I doing wrong? How do you generate tests with Evosuite for several classes with external dependencies?</p>
  
  <p>Below is the full error after issuing my command above:</p>
  
  <pre><code>    * EvoSuite 1.0.6
  * Analyzing classpath (generating inheritance tree)
    - target/classes
    - target/dependency
  * Found 4 matching classes for prefix com.lightbend.akka.sample
  * Current class: com.lightbend.akka.sample.Printer
  * Going to generate test cases for class: com.lightbend.akka.sample.Printer
  * Starting client
  * Connecting to master process on port 7154
  * Analyzing classpath: 
  * Error while initializing target class: akka/actor/AbstractActor
  [MASTER] 12:11:18.052 [logback-2] ERROR TestSuiteGenerator - Problem for com.lightbend.akka.sample.Printer. Full stack:
  java.lang.ClassNotFoundException: akka/actor/AbstractActor
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:201) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:168) ~[evosuite-1.0.6.jar:1.0.6]
      at java.lang.Class.forName0(Native Method) ~[na:1.8.0_181]
      at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_181]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
      at org.evosuite.testcase.statements.MethodStatement$1.execute(MethodStatement.java:257) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.statements.AbstractStatement.exceptionHandler(AbstractStatement.java:169) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.statements.MethodStatement.execute(MethodStatement.java:220) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.executeStatements(TestRunnable.java:307) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:213) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:55) ~[evosuite-1.0.6.jar:1.0.6]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181]
      at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
  Caused by: java.lang.NoClassDefFoundError: akka/actor/AbstractActor
      at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_181]
      at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_181]
      at java.lang.ClassLoader.defineClass(ClassLoader.java:642) ~[na:1.8.0_181]
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:194) ~[evosuite-1.0.6.jar:1.0.6]
      ... 17 common frames omitted
  Caused by: java.lang.ClassNotFoundException: Class 'akka/actor/AbstractActor.class' should be in target project, but could not be found!
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:201) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:168) ~[evosuite-1.0.6.jar:1.0.6]
      ... 21 common frames omitted
  Caused by: java.lang.ClassNotFoundException: Class 'akka/actor/AbstractActor.class' should be in target project, but could not be found!
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:188) ~[evosuite-1.0.6.jar:1.0.6]
      ... 22 common frames omitted
  * Computation finished
  [MASTER] 12:11:18.181 [main] ERROR SearchStatistics - No statistics has been saved because EvoSuite failed to generate any test case
  [MASTER] 12:11:18.282 [main] ERROR TestGeneration - failed to write statistics data
  * Current class: com.lightbend.akka.sample.Stack
  * Going to generate test cases for class: com.lightbend.akka.sample.Stack
  * Starting client
  * Connecting to master process on port 3398
  * Analyzing classpath: 
  * Inheritance tree loaded from /tmp/ES_inheritancetree5527612279643905395.xml.gz
  * Finished analyzing classpath
  * Generating tests for class com.lightbend.akka.sample.Stack
  * Test criteria:
    - Line Coverage
    - Branch Coverage
    - Exception
    - Mutation testing (weak)
    - Method-Output Coverage
    - Top-Level Method Coverage
    - No-Exception Top-Level Method Coverage
    - Context Branch Coverage
  * Setting up search algorithm for whole suite generation
  * Total number of test goals: 
    - Line 12
    - Branch 7
    - Exception 0
    - MutationFactory 40
    - Output 4
    - Method 4
    - MethodNoException 4
    - CBranchFitnessFactory 7
  * Using seed 1539252678603
  * Starting evolution
  [Progress:==============================100%] [Cov:==================================&gt;99%]
  * Search finished after 61s and 1668 generations, 404567 statements, best individual has fitness: 1.8333333333333333
  * Minimizing test suite
  * Going to analyze the coverage criteria
  * Coverage analysis for criterion LINE
  * Coverage of criterion LINE: 100%
  * Total number of goals: 12
  * Number of covered goals: 12
  * Coverage analysis for criterion BRANCH
  * Coverage of criterion BRANCH: 100%
  * Total number of goals: 7
  * Number of covered goals: 7
  * Coverage analysis for criterion EXCEPTION
  * Coverage of criterion EXCEPTION: 100%
  * Total number of goals: 2
  * Number of covered goals: 2
  * Coverage analysis for criterion WEAKMUTATION
  * Coverage of criterion WEAKMUTATION: 92%
  * Total number of goals: 40
  * Number of covered goals: 37
  * Coverage analysis for criterion OUTPUT
  * Coverage of criterion OUTPUT: 100%
  * Total number of goals: 4
  * Number of covered goals: 4
  * Coverage analysis for criterion METHOD
  * Coverage of criterion METHOD: 100%
  * Total number of goals: 4
  * Number of covered goals: 4
  * Coverage analysis for criterion METHODNOEXCEPTION
  * Coverage of criterion METHODNOEXCEPTION: 100%
  * Total number of goals: 4
  * Number of covered goals: 4
  * Coverage analysis for criterion CBRANCH
  * Coverage of criterion CBRANCH: 100%
  * Total number of goals: 7
  * Number of covered goals: 7
  * Generated 6 tests with total length 26
  * Resulting test suite's coverage: 99% (average coverage for all fitness functions)
  * Generating assertions
  * Resulting test suite's mutation score: 67%
  * Compiling and checking tests
  * Writing JUnit test case 'Stack_ESTest' to evosuite-tests
  * Done!
  
  * Computation finished
  * Current class: com.lightbend.akka.sample.Greeter
  * Going to generate test cases for class: com.lightbend.akka.sample.Greeter
  * Starting client
  * Connecting to master process on port 7164
  * Analyzing classpath: 
  * Error while initializing target class: akka/actor/AbstractActor
  [MASTER] 12:12:23.277 [logback-2] ERROR TestSuiteGenerator - Problem for com.lightbend.akka.sample.Greeter. Full stack:
  java.lang.ClassNotFoundException: akka/actor/AbstractActor
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:201) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:168) ~[evosuite-1.0.6.jar:1.0.6]
      at java.lang.Class.forName0(Native Method) ~[na:1.8.0_181]
      at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_181]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
      at org.evosuite.testcase.statements.MethodStatement$1.execute(MethodStatement.java:257) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.statements.AbstractStatement.exceptionHandler(AbstractStatement.java:169) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.statements.MethodStatement.execute(MethodStatement.java:220) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.executeStatements(TestRunnable.java:307) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:213) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:55) ~[evosuite-1.0.6.jar:1.0.6]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181]
      at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
  Caused by: java.lang.NoClassDefFoundError: akka/actor/AbstractActor
      at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_181]
      at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_181]
      at java.lang.ClassLoader.defineClass(ClassLoader.java:642) ~[na:1.8.0_181]
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:194) ~[evosuite-1.0.6.jar:1.0.6]
      ... 17 common frames omitted
  Caused by: java.lang.ClassNotFoundException: Class 'akka/actor/AbstractActor.class' should be in target project, but could not be found!
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:201) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:168) ~[evosuite-1.0.6.jar:1.0.6]
      ... 21 common frames omitted
  Caused by: java.lang.ClassNotFoundException: Class 'akka/actor/AbstractActor.class' should be in target project, but could not be found!
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:188) ~[evosuite-1.0.6.jar:1.0.6]
      ... 22 common frames omitted
  * Computation finished
  [MASTER] 12:12:23.386 [main] ERROR SearchStatistics - No statistics has been saved because EvoSuite failed to generate any test case
  [MASTER] 12:12:23.487 [main] ERROR TestGeneration - failed to write statistics data
  * Current class: com.lightbend.akka.sample.AkkaQuickstart
  * Going to generate test cases for class: com.lightbend.akka.sample.AkkaQuickstart
  * Starting client
  * Connecting to master process on port 13590
  * Analyzing classpath: 
  * Error while initializing target class: Class not found: akka/actor/ActorRef: java.lang.NullPointerException: Class not found akka/actor/ActorRef
  [MASTER] 12:12:24.206 [logback-2] ERROR TestSuiteGenerator - Problem for com.lightbend.akka.sample.AkkaQuickstart. Full stack:
  java.lang.ClassNotFoundException: Class not found: akka/actor/ActorRef: java.lang.NullPointerException: Class not found akka/actor/ActorRef
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:201) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.loadClass(InstrumentingClassLoader.java:168) ~[evosuite-1.0.6.jar:1.0.6]
      at java.lang.Class.forName0(Native Method) ~[na:1.8.0_181]
      at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_181]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
      at org.evosuite.testcase.statements.MethodStatement$1.execute(MethodStatement.java:257) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.statements.AbstractStatement.exceptionHandler(AbstractStatement.java:169) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.statements.MethodStatement.execute(MethodStatement.java:220) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.executeStatements(TestRunnable.java:307) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:213) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.testcase.execution.TestRunnable.call(TestRunnable.java:55) ~[evosuite-1.0.6.jar:1.0.6]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_181]
      at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
  Caused by: java.lang.RuntimeException: Class not found: akka/actor/ActorRef: java.lang.NullPointerException: Class not found akka/actor/ActorRef
      at org.evosuite.runtime.util.ComputeClassWriter.getCommonSuperClass(ComputeClassWriter.java:58) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.ClassWriter.getMergedType(ClassWriter.java:1729) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.Frame.merge(Frame.java:1530) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.Frame.merge(Frame.java:1429) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1497) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.runtime.instrumentation.LoopCounterMethodAdapter.visitMaxs(LoopCounterMethodAdapter.java:48) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(LocalVariablesSorter.java:165) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.MethodEntryAdapter.visitMaxs(MethodEntryAdapter.java:109) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.LineNumberMethodAdapter.visitMaxs(LineNumberMethodAdapter.java:127) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.commons.LocalVariablesSorter.visitMaxs(LocalVariablesSorter.java:165) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:835) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.commons.JSRInlinerAdapter.visitEnd(JSRInlinerAdapter.java:187) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:838) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.graphs.cfg.CFGMethodAdapter.visitEnd(CFGMethodAdapter.java:263) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:878) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.MethodVisitor.visitEnd(MethodVisitor.java:878) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:838) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:727) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.shaded.org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:452) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.BytecodeInstrumentation.transformBytes(BytecodeInstrumentation.java:287) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.getTransformedBytes(InstrumentingClassLoader.java:175) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.instrumentation.InstrumentingClassLoader.instrumentClass(InstrumentingClassLoader.java:192) ~[evosuite-1.0.6.jar:1.0.6]
      ... 17 common frames omitted
  Caused by: java.lang.NullPointerException: Class not found akka/actor/ActorRef
      at org.evosuite.runtime.util.ComputeClassWriter.typeInfo(ComputeClassWriter.java:186) ~[evosuite-1.0.6.jar:1.0.6]
      at org.evosuite.runtime.util.ComputeClassWriter.getCommonSuperClass(ComputeClassWriter.java:55) ~[evosuite-1.0.6.jar:1.0.6]
      ... 44 common frames omitted
  * Computation finished
  [MASTER] 12:12:24.320 [main] ERROR SearchStatistics - No statistics has been saved because EvoSuite failed to generate any test case
  [MASTER] 12:12:24.421 [main] ERROR TestGeneration - failed to write statistics data
  </code></pre>