use of com.facebook.buck.test.selectors.TestSelectorList in project buck by facebook.
the class JavaTest method getJUnitStep.
private JUnitStep getJUnitStep(ExecutionContext executionContext, SourcePathResolver pathResolver, TestRunningOptions options, Optional<Path> outDir, Optional<Path> robolectricLogPath, Set<String> testClassNames) {
Iterable<String> reorderedTestClasses = reorderClasses(testClassNames, options.isShufflingTests());
ImmutableList<String> properVmArgs = amendVmArgs(this.vmArgs, pathResolver, executionContext.getTargetDevice());
BuckEventBus buckEventBus = executionContext.getBuckEventBus();
BuildId buildId = buckEventBus.getBuildId();
TestSelectorList testSelectorList = options.getTestSelectorList();
JUnitJvmArgs args = JUnitJvmArgs.builder().setTestType(testType).setDirectoryForTestResults(outDir).setClasspathFile(getClassPathFile()).setTestRunnerClasspath(TESTRUNNER_CLASSES).setCodeCoverageEnabled(executionContext.isCodeCoverageEnabled()).setInclNoLocationClassesEnabled(executionContext.isInclNoLocationClassesEnabled()).setDebugEnabled(executionContext.isDebugEnabled()).setPathToJavaAgent(options.getPathToJavaAgent()).setBuildId(buildId).setBuckModuleBaseSourceCodePath(getBuildTarget().getBasePath()).setStdOutLogLevel(stdOutLogLevel).setStdErrLogLevel(stdErrLogLevel).setRobolectricLogPath(robolectricLogPath).setExtraJvmArgs(properVmArgs).addAllTestClasses(reorderedTestClasses).setShouldExplainTestSelectorList(options.shouldExplainTestSelectorList()).setTestSelectorList(testSelectorList).build();
return new JUnitStep(getProjectFilesystem(), nativeLibsEnvironment, testRuleTimeoutMs, testCaseTimeoutMs, env, javaRuntimeLauncher, args);
}
use of com.facebook.buck.test.selectors.TestSelectorList in project buck by facebook.
the class TestResultFormatterTest method shouldSaySelectedTestsWillBeRun.
@Test
public void shouldSaySelectedTestsWillBeRun() {
TestResultFormatter formatter = createSilentFormatter();
ImmutableList.Builder<String> builder = ImmutableList.builder();
TestSelectorList testSelectorList = TestSelectorList.builder().addRawSelectors("com.example.clown.Car").build();
ImmutableSet<String> targetNames = ImmutableSet.of("//:example", "//foo:bar");
formatter.runStarted(builder, false, testSelectorList, false, targetNames, TestResultFormatter.FormatMode.BEFORE_TEST_RUN);
assertEquals("TESTING SELECTED TESTS", toString(builder));
}
use of com.facebook.buck.test.selectors.TestSelectorList in project buck by facebook.
the class TestResultFormatterTest method shouldExplainWhichTestsWillBeSelected.
@Test
public void shouldExplainWhichTestsWillBeSelected() {
TestResultFormatter formatter = createSilentFormatter();
ImmutableList.Builder<String> builder = ImmutableList.builder();
TestSelectorList testSelectorList = TestSelectorList.builder().addRawSelectors("com.example.clown.Car").build();
ImmutableSet<String> targetNames = ImmutableSet.of("//:example", "//foo:bar");
boolean shouldExplain = true;
formatter.runStarted(builder, false, testSelectorList, shouldExplain, targetNames, TestResultFormatter.FormatMode.BEFORE_TEST_RUN);
String expected = "TESTING SELECTED TESTS\n" + "include class:com.example.clown.Car$ method:<any>\n" + "exclude everything else";
assertEquals(expected, toString(builder));
}
Aggregations