title: JMeter Maven Plugin not able to detect JUnit Tests from the fat Snapshot Jar created
body: <p>I want to run JUnit tests for the performance testing using <strong>JMeter Maven Plugin</strong>. I am creating my project snapshot jar in the target folder. This snapshot jar has test classes and external jars included using <code>maven-assembly-plugin</code>. The same snapshot jar is able to detect the JUnit test method from the JMeter application and running successfully but not able to detect the same test methods from the plugin when I put that inside <code>&lt;project&gt;/src/test/jmeter/lib/junit</code>.</p>
  <p>I am putting the JMX file inside <code>&lt;project&gt;/src/test/jmeter</code> and snapshot jar in this folder <code>&lt;project&gt;/src/test/jmeter/lib/junit</code>.</p>
  <p>please find my pom file below.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com&lt;/groupId&gt;
      &lt;artifactId&gt;myproject&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.lazerycode.jmeter&lt;/groupId&gt;
                  &lt;artifactId&gt;jmeter-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.4.0&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;!-- Generate JMeter configuration --&gt;
                      &lt;execution&gt;
                          &lt;id&gt;configuration&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;configure&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                      &lt;!-- Run JMeter tests --&gt;
                      &lt;execution&gt;
                          &lt;id&gt;jmeter-tests&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;jmeter&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                      &lt;!-- Fail build on errors in test --&gt;
                      &lt;execution&gt;
                          &lt;id&gt;jmeter-check-results&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;results&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;generateReports&gt;true&lt;/generateReports&gt;
                      &lt;jmeterExtensions&gt;
                          &lt;artifact&gt;kg.apc:jmeter-plugins:pom:1.4.0&lt;/artifact&gt;
                          &lt;artifact&gt;kg.apc:jmeter-plugins-json:2.7&lt;/artifact&gt;
                      &lt;/jmeterExtensions&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;descriptors&gt;
                          &lt;descriptor&gt;src/main/assembly/assembly.xml&lt;/descriptor&gt;
                      &lt;/descriptors&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                      &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;MainClass.TestMethod&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;maven-assembly&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;single&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  &lt;/project&gt;
  </code></pre>
  <p>I am able to run the same test from JMeter application but the not able to detect the same class from <code>mvn clean verify</code> command?</p>
  <p>The log generated after running <code>mvn clean verify</code> is below. it says <code>JUnitSampler: ClassNotFoundException:: MyClass.TestMethod</code></p>
  <pre><code>2021-07-12 11:18:38,748 WARN o.a.j.p.j.s.JUnitSampler: ClassNotFoundException:: MyClass.TestMethod
  2021-07-12 11:18:38,750 INFO o.a.j.s.SampleResult: Note: Sample TimeStamps are START times
  2021-07-12 11:18:38,750 INFO o.a.j.s.SampleResult: sampleresult.default.encoding is set to ISO-8859-1
  2021-07-12 11:18:38,750 INFO o.a.j.s.SampleResult: sampleresult.useNanoTime=true
  2021-07-12 11:18:38,750 INFO o.a.j.s.SampleResult: sampleresult.nanoThreadSleep=5000
  2021-07-12 11:18:38,751 INFO o.a.j.t.JMeterThread: Thread is done: ThreadGroup 1-1
  2021-07-12 11:18:38,751 INFO o.a.j.t.JMeterThread: Thread finished: ThreadGroup 1-1
  2021-07-12 11:18:40,745 INFO o.a.j.t.JMeterThread: Thread started: ThreadGroup 1-2
  2021-07-12 11:18:40,745 WARN o.a.j.p.j.s.JUnitSampler: ClassNotFoundException:: MyClass.TestMethod
  2021-07-12 11:18:40,746 INFO o.a.j.t.JMeterThread: Thread is done: ThreadGroup 1-2
  2021-07-12 11:18:40,746 INFO o.a.j.t.JMeterThread: Thread finished: ThreadGroup 1-2
  2021-07-12 11:18:42,746 INFO o.a.j.t.JMeterThread: Thread started: ThreadGroup 1-3
  2021-07-12 11:18:42,746 WARN o.a.j.p.j.s.JUnitSampler: ClassNotFoundException:: MyClass.TestMethod
  2021-07-12 11:18:42,746 INFO o.a.j.t.JMeterThread: Thread is done: ThreadGroup 1-3
  2021-07-12 11:18:42,747 INFO o.a.j.t.JMeterThread: Thread finished: ThreadGroup 1-3
  2021-07-12 11:18:44,748 INFO o.a.j.t.JMeterThread: Thread started: ThreadGroup 1-4
  2021-07-12 11:18:44,749 WARN o.a.j.p.j.s.JUnitSampler: ClassNotFoundException:: MyClass.TestMethod
  
  </code></pre>