public TestFramework testFramework(Closure testFrameworkConfigure) { if (testFramework == null) { useJUnit(testFrameworkConfigure); } return testFramework; }
private TestFramework useTestFramework(TestFramework testFramework, Closure testFrameworkConfigure) { if (testFramework == null) { throw new IllegalArgumentException("testFramework is null!"); } this.testFramework = testFramework; if (testFrameworkConfigure != null) { ConfigureUtil.configure(testFrameworkConfigure, this.testFramework.getOptions()); } return this.testFramework; }
@Override public void execute(final Test testTask, TestResultProcessor testResultProcessor) { final TestFramework testFramework = testTask.getTestFramework(); final WorkerTestClassProcessorFactory testInstanceFactory = testFramework.getProcessorFactory(); final BuildOperationWorkerRegistry.Operation currentOperation = buildOperationWorkerRegistry.getCurrent(); final Set<File> classpath = ImmutableSet.copyOf(testTask.getClasspath()); final Factory<TestClassProcessor> forkingProcessorFactory = new Factory<TestClassProcessor>() { public TestClassProcessor create() { return new ForkingTestClassProcessor(workerFactory, testInstanceFactory, testTask, classpath, testFramework.getWorkerConfigurationAction(), moduleRegistry, currentOperation); } }; Factory<TestClassProcessor> reforkingProcessorFactory = new Factory<TestClassProcessor>() { public TestClassProcessor create() { return new RestartEveryNTestClassProcessor(forkingProcessorFactory, testTask.getForkEvery()); } }; TestClassProcessor processor = new MaxNParallelTestClassProcessor(testTask.getMaxParallelForks(), reforkingProcessorFactory, actorFactory); final FileTree testClassFiles = testTask.getCandidateClassFiles(); Runnable detector; if (testTask.isScanForTestClasses()) { TestFrameworkDetector testFrameworkDetector = testTask.getTestFramework().getDetector(); testFrameworkDetector.setTestClassesDirectory(testTask.getTestClassesDir()); testFrameworkDetector.setTestClasspath(classpath); detector = new DefaultTestClassScanner(testClassFiles, testFrameworkDetector, processor); } else { detector = new DefaultTestClassScanner(testClassFiles, null, processor); } final Object testTaskOperationId = buildOperationExecutor.getCurrentOperation().getId(); new TestMainAction(detector, processor, testResultProcessor, new TrueTimeProvider(), testTaskOperationId, testTask.getPath(), "Gradle Test Run " + testTask.getIdentityPath()).run(); }
public void execute(final Test testTask, TestResultProcessor testResultProcessor) { final TestFramework testFramework = testTask.getTestFramework(); final WorkerTestClassProcessorFactory testInstanceFactory = testFramework.getProcessorFactory(); final Factory<TestClassProcessor> forkingProcessorFactory = new Factory<TestClassProcessor>() { public TestClassProcessor create() { return new ForkingTestClassProcessor(workerFactory, testInstanceFactory, testTask, testTask.getClasspath(), testFramework.getWorkerConfigurationAction()); } }; Factory<TestClassProcessor> reforkingProcessorFactory = new Factory<TestClassProcessor>() { public TestClassProcessor create() { return new RestartEveryNTestClassProcessor(forkingProcessorFactory, testTask.getForkEvery()); } }; TestClassProcessor processor = new MaxNParallelTestClassProcessor(testTask.getMaxParallelForks(), reforkingProcessorFactory, actorFactor); final FileTree testClassFiles = testTask.getCandidateClassFiles(); Runnable detector; if (testTask.isScanForTestClasses()) { TestFrameworkDetector testFrameworkDetector = testTask.getTestFramework().getDetector(); testFrameworkDetector.setTestClassesDirectory(testTask.getTestClassesDir()); testFrameworkDetector.setTestClasspath(testTask.getClasspath()); detector = new DefaultTestClassScanner(testClassFiles, testFrameworkDetector, processor); } else { detector = new DefaultTestClassScanner(testClassFiles, null, processor); } new TestMainAction(detector, processor, testResultProcessor, new TrueTimeProvider()).run(); }
@Internal public TestFramework getTestFramework() { return testFramework(null); }
TestFramework useTestFramework(TestFramework testFramework) { return useTestFramework(testFramework, null); }
@Override public void execute(final Test testTask, TestResultProcessor testResultProcessor) { final TestFramework testFramework = testTask.getTestFramework(); final WorkerTestClassProcessorFactory testInstanceFactory = testFramework.getProcessorFactory(); final Set<File> classpath = ImmutableSet.copyOf(testTask.getClasspath()); final Factory<TestClassProcessor> forkingProcessorFactory = new Factory<TestClassProcessor>() { public TestClassProcessor create() { return new ForkingTestClassProcessor(workerFactory, testInstanceFactory, testTask, classpath, testFramework.getWorkerConfigurationAction(), moduleRegistry); } }; Factory<TestClassProcessor> reforkingProcessorFactory = new Factory<TestClassProcessor>() { public TestClassProcessor create() { return new RestartEveryNTestClassProcessor(forkingProcessorFactory, testTask.getForkEvery()); } }; TestClassProcessor processor = new MaxNParallelTestClassProcessor(testTask.getMaxParallelForks(), reforkingProcessorFactory, actorFactory); final FileTree testClassFiles = testTask.getCandidateClassFiles(); Runnable detector; if (testTask.isScanForTestClasses()) { TestFrameworkDetector testFrameworkDetector = testTask.getTestFramework().getDetector(); testFrameworkDetector.setTestClasses(testTask.getTestClassesDirs().getFiles()); testFrameworkDetector.setTestClasspath(classpath); detector = new DefaultTestClassScanner(testClassFiles, testFrameworkDetector, processor); } else { detector = new DefaultTestClassScanner(testClassFiles, null, processor); } Object testTaskOperationId; try { testTaskOperationId = buildOperationExecutor.getCurrentOperation().getParentId(); } catch (Exception e) { testTaskOperationId = UUID.randomUUID(); } new TestMainAction(detector, processor, testResultProcessor, clock, testTaskOperationId, testTask.getPath(), "Gradle Test Run " + testTask.getIdentityPath()).run(); }
public TestFramework getTestFramework() { return testFramework(null); }