Search in sources :

Example 6 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project lightning by automatictester.

the class ReportTaskTest method runReportWithMissingInput.

@Test
public void runReportWithMissingInput() {
    BuildResult result = GradleRunner.create().withProjectDir(new File("src/integrationTest/resources/build/no/csv")).withArguments(":report").withPluginClasspath().buildAndFail();
    assertThat(taskOutputContainsText("Not all mandatory input specified for this task or specified files not readable", result), is(true));
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) File(java.io.File) Test(org.testng.annotations.Test)

Example 7 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project lightning by automatictester.

the class VerifyTaskTest method runVerifyWithServerSideTests.

@Test
public void runVerifyWithServerSideTests() {
    BuildResult result = GradleRunner.create().withProjectDir(new File("src/integrationTest/resources/build/perfmon")).withArguments(":verify").withPluginClasspath().build();
    assertThat(result.task(":verify").getOutcome(), is(SUCCESS));
    assertThat(taskOutputContainsFileContent("/results/expected/1_client_2_server.txt", result), is(true));
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) File(java.io.File) Test(org.testng.annotations.Test)

Example 8 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project wildfly-gradle-tools by wildfly.

the class BuildFunctionalTest method testProvisioningTask.

@Test
public void testProvisioningTask() {
    BuildResult result = testProject.runTask("provision");
    assertEquals(result.task(":provision").getOutcome(), TaskOutcome.SUCCESS);
    // now check some key file from WildFly was really materialized in the right place:
    final Path provisionedWildFlyPath = testProject.getWorkDirectory().resolve("build").resolve(ProvisionTask.DEFAULT_OUTPUT_DIR);
    System.out.println("Server expected in: " + provisionedWildFlyPath);
    assertTrue(provisionedWildFlyPath.resolve("jboss-modules.jar").toFile().isFile());
}
Also used : Path(java.nio.file.Path) BuildResult(org.gradle.testkit.runner.BuildResult) Test(org.junit.Test)

Example 9 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project spring-security by spring-projects.

the class IntegrationTestPluginITest method checkWithGroovy.

@Test
public void checkWithGroovy() throws Exception {
    BuildResult result = this.testKit.withProjectResource("samples/integrationtest/withgroovy/").withArguments("check").build();
    assertThat(result.task(":check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
    assertThat(new File(testKit.getRootDir(), "build/test-results/integrationTest/")).exists();
    assertThat(new File(testKit.getRootDir(), "build/reports/tests/integrationTest/")).exists();
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) File(java.io.File) Test(org.junit.Test)

Example 10 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project spring-security by spring-projects.

the class IntegrationTestPluginITest method checkWithJavaPlugin.

@Test
public void checkWithJavaPlugin() throws Exception {
    BuildResult result = this.testKit.withProjectResource("samples/integrationtest/withjava/").withArguments("check").build();
    assertThat(result.task(":check").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
    assertThat(new File(testKit.getRootDir(), "build/test-results/integrationTest/")).exists();
    assertThat(new File(testKit.getRootDir(), "build/reports/tests/integrationTest/")).exists();
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) File(java.io.File) Test(org.junit.Test)

Aggregations

BuildResult (org.gradle.testkit.runner.BuildResult)149 File (java.io.File)65 TestTemplate (org.junit.jupiter.api.TestTemplate)60 Test (org.junit.Test)47 Test (org.junit.jupiter.api.Test)21 StringWriter (java.io.StringWriter)19 GradleRunner (org.gradle.testkit.runner.GradleRunner)17 Test (org.testng.annotations.Test)10 ImageReference (org.springframework.boot.buildpack.platform.docker.type.ImageReference)8 JarFile (java.util.jar.JarFile)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 TestHelpers.findFile (me.tatarka.TestHelpers.findFile)6 TestHelpers.writeFile (me.tatarka.TestHelpers.writeFile)6 ContainerConfig (com.github.dockerjava.api.model.ContainerConfig)5 FileWriter (java.io.FileWriter)5 IOException (java.io.IOException)5 PrintWriter (java.io.PrintWriter)5 Path (java.nio.file.Path)5 BuildTask (org.gradle.testkit.runner.BuildTask)5