title: Running tests from directory not in class path
body: <p>I am trying to run tests that are in  a jar file (sr/java/main/test/jarfile.jar directory ).
  The launcher does not find any test.  From intellij, in source of project when i runTesT is all ok, so no problem in actual tests. 
  TestProject:</p>
  
  <pre><code> Test_Road
   ├── src
   │   ├── test
   │   │      ├── java
   │   │      └── package_test
   │   └──resource          │
   │                        └── ConfigurationControllerTest.java
   └── pom.xml
  </code></pre>
  
  <p>pom.xml is this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;it.almaviva&lt;/groupId&gt;
      &lt;artifactId&gt;TestSuite&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.10.3&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.18.12&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!--dependency&gt;
              &lt;groupId&gt;com.vaadin.external.google&lt;/groupId&gt;
              &lt;artifactId&gt;android-json&lt;/artifactId&gt;
              &lt;version&gt;0.0.20131108.vaadin1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
              &lt;artifactId&gt;junit-jupiter-engine&lt;/artifactId&gt;
              &lt;version&gt;5.6.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;
              &lt;artifactId&gt;junit-platform-runner&lt;/artifactId&gt;
              &lt;version&gt;1.5.2&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;
              &lt;artifactId&gt;junit-platform-suite-api&lt;/artifactId&gt;
              &lt;version&gt;1.6.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;
              &lt;artifactId&gt;junit-platform-runner&lt;/artifactId&gt;
              &lt;version&gt;1.6.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;
              &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;
              &lt;version&gt;3.0.3&lt;/version&gt;
  
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
  
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.22.2&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.22.2&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;8&lt;/source&gt;
                      &lt;target&gt;8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <pre><code>public class ConfigurationControllerTest {
      private static final Logger log = Logger.getLogger(ConfigurationControllerTest.class);
  
      private static Properties properties = PropertyUtil.getProperties("/test.properties");
  
         @Test
      public void smartRoadRegistryTest(){
          String endpoint = properties.getProperty("smart-road.api.configuration-controller.endpoint.registry");
  
          try {
              expect().
                      statusCode(200).
                      contentType(ContentType.JSON).
              when().
                      get(endpoint);
          } catch(AssertionError e){
              log.error("Smart Road Registry test has failed ... \n");
              Assertions.fail(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>If i run smartRoadRegistryTest method it work well.</p>
  
  <p>Now i have create a new project TestSuiteLoader where i load jar inspect class and method with @Test and after i run a method called.</p>
  
  <pre><code>src
   └── main
        └── java
              ├── packageRunTest
              │      └── TestsuiteApplication.java
              └── pakageTest
              └──TestClass.jar
  </code></pre>
  
  <p>My function is this:</p>
  
  <pre><code>public void runOne(String jar_file,String class_name, String test_name,SummaryGeneratingListener listener) {
  
          File file = new File("src\\main\\java\\test\\"+ jar_file);
          URL[] urls = {new URL("jar:file:" + file + "!/")};
          URLClassLoader cl = URLClassLoader.newInstance(urls);
  
          Class cls=cl.loadClass(class_name);
          Method m=cls.getMethod(test_name);
          LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
                  .selectors(selectMethod(cls,m))
                  .build();
  
          Launcher launcher = LauncherFactory.create();
          launcher.registerTestExecutionListeners(listener);
          launcher.execute(request);
          TestExecutionSummary summary = listener.getSummary();
  
          StringWriter out = new StringWriter();
          summary.printTo(new PrintWriter(out));
          System.out.println(out);
      }
  </code></pre>
  
  <p>when i run it in main as:</p>
  
  <pre><code>this.runOne("TestSuite.jar","SmartRoadApiTest.ConfigurationControllerTest","smartRoadRegistryTest", new SummaryGeneratingListener());
  </code></pre>
  
  <p>In console i read:</p>
  
  <p>Test run finished after 63 ms</p>
  
  <pre><code>[         1 containers found      ]
  [         0 containers skipped    ]
  [         1 containers started    ]
  [         0 containers aborted    ]
  [         1 containers successful ]
  [         0 containers failed     ]
  [         0 tests found           ]
  [         0 tests skipped         ]
  [         0 tests started         ]
  [         0 tests aborted         ]
  [         0 tests successful      ]
  [         0 tests failed          ]
  </code></pre>
  
  <p>0 Test Found!!</p>
  
  <p>my pom.xml is:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.2.5.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;it.anas.TestSuiteLoader&lt;/groupId&gt;
      &lt;artifactId&gt;testsuite&lt;/artifactId&gt;
      &lt;version&gt;0.0.1&lt;/version&gt;
      &lt;name&gt;testsuite&lt;/name&gt;
      &lt;description&gt;Servizi per Caricamento Test Suite&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;optional&gt;true&lt;/optional&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                      &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
              &lt;artifactId&gt;junit-jupiter-engine&lt;/artifactId&gt;
              &lt;version&gt;5.6.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.platform&lt;/groupId&gt;
              &lt;artifactId&gt;junit-platform-launcher&lt;/artifactId&gt;
              &lt;version&gt;1.2.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.reflections&lt;/groupId&gt;
              &lt;artifactId&gt;reflections&lt;/artifactId&gt;
              &lt;version&gt;0.9.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.testng/testng --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;7.1.0&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.reflections&lt;/groupId&gt;
              &lt;artifactId&gt;reflections&lt;/artifactId&gt;
              &lt;version&gt;0.9.12&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.jupiter&lt;/groupId&gt;
              &lt;artifactId&gt;junit-jupiter-api&lt;/artifactId&gt;
              &lt;version&gt;5.6.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
              &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
          &lt;version&gt;4.12.0-M4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
                  &lt;plugin&gt;
                      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.22.2&lt;/version&gt;
                  &lt;/plugin&gt;
                  &lt;plugin&gt;
                      &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.22.2&lt;/version&gt;
                  &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Thanks Regards
  Giuseppe</p>