コード例 #1
0
ファイル: NoPol.java プロジェクト: maxcleme/nopol
  public List<Patch> build(String[] testClasses) {
    gZoltar = GZoltarSuspiciousProgramStatements.create(this.classpath, testClasses);
    Collection<Statement> statements = gZoltar.sortBySuspiciousness(testClasses);
    if (statements.isEmpty()) {
      throw new RuntimeException("No suspicious statements found.");
    }

    Map<SourceLocation, List<TestResult>> testListPerStatement = getTestListPerStatement();

    if (Config.INSTANCE.getOracle() == Config.NopolOracle.SYMBOLIC) {
      try {
        this.classpath = addJPFLibraryToCassPath(classpath);
        SpoonedProject jpfSpoon = new SpoonedProject(this.sourceFiles, classpath);
        String mainClass = "nopol.repair.NopolTestRunner";
        TestExecutorProcessor.createMainTestClass(jpfSpoon, mainClass);
        jpfSpoon.process(new AssertReplacer());

        final File outputSourceFile = new File("src-gen");
        final File outputCompiledFile = new File("target-gen");
        // generate the output file
        jpfSpoon.generateOutputFile(outputSourceFile);
        jpfSpoon.generateOutputCompiledFile(outputCompiledFile);
      } catch (IOException e) {
        throw new RuntimeException("Unable to write transformed test", e);
      }
    }

    return solveWithMultipleBuild(statements, testListPerStatement);
  }
コード例 #2
0
ファイル: JPFRunner.java プロジェクト: maxcleme/nopol
  @Override
  public Collection<Specification<T>> buildFor(
      final URL[] classpath, final String[] testClasses, final Collection<TestCase> failures) {
    final LoggingInstrumenter<T> logging = createLoggingInstrumenter();
    SpoonedClass fork = cleanSpoon.forked(sourceLocation.getContainingClassName());
    final ClassLoader unitTestClassLoader = fork.processedAndDumpedToClassLoader(logging);

    final SpecificationTestCasesListener<T> listener =
        run(classpath, failures, unitTestClassLoader);

    if (this.find) {
      logging.disable();
      TestSuiteExecution.runCasesIn(testClasses, unitTestClassLoader, listener);
    }
    return listener.specifications();
  }
コード例 #3
0
ファイル: NoPol.java プロジェクト: maxcleme/nopol
 private Collection<TestCase> failingTests(String[] testClasses) {
   TestCasesListener listener = new TestCasesListener();
   TestSuiteExecution.runCasesIn(testClasses, spooner.dumpedToClassLoader(), listener);
   return listener.failedTests();
 }