Search in sources :

Example 81 with BuildResult

use of org.gradle.testkit.runner.BuildResult in project crnk-framework by crnk-project.

the class GradleDeltaspikeTest method test.

@Test
public void test() throws IOException {
    testFolder.create();
    root = testFolder.getRoot();
    saveFile("test_build.gradle", "build.gradle");
    saveFile("test_settings.gradle", "settings.gradle");
    saveFile("META-INF/beans.xml", "src/main/resources/META-INF/beans.xml");
    saveFile("TestModuleProducer.template", "src/main/java/io/crnk/gen/typescript/TestModuleProducer.java");
    GradleRunner runner = GradleRunner.create();
    runner = runner.withPluginClasspath();
    // List<File> files = Arrays.asList(new File("C:\\projects\\oss\\crnk-framework\\crnk-gen-typescript\\build\\classes\\main"));
    runner = runner.withProjectDir(root);
    // TODO move to assembleTypescript once ngrx-json-api released
    runner = runner.withArguments("generateTypescript");
    BuildResult build = runner.build();
    System.out.println(build.getOutput());
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) GradleRunner(org.gradle.testkit.runner.GradleRunner) Test(org.junit.Test)

Example 82 with BuildResult

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

the class ReportTaskTest method runReportWithFailureExpected.

@Test
public void runReportWithFailureExpected() {
    BuildResult result = GradleRunner.create().withProjectDir(new File("src/integrationTest/resources/build/failure_report")).withArguments(":report").withPluginClasspath().buildAndFail();
    assertThat(taskOutputContainsFileContent("/results/expected/report_failure.txt", result), is(true));
}
Also used : BuildResult(org.gradle.testkit.runner.BuildResult) File(java.io.File) Test(org.testng.annotations.Test)

Example 83 with BuildResult

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

the class VerifyTaskTest method runVerifyWithMissingInput.

@Test(dataProvider = "getProjectDir")
public void runVerifyWithMissingInput(String projectDir) {
    BuildResult result = GradleRunner.create().withProjectDir(new File(projectDir)).withArguments(":verify").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 84 with BuildResult

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

the class VerifyTaskTest method runVerify.

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

Example 85 with BuildResult

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

the class VerifyTaskTest method runVerifyWithRegexp.

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

Aggregations

BuildResult (org.gradle.testkit.runner.BuildResult)143 File (java.io.File)62 TestTemplate (org.junit.jupiter.api.TestTemplate)60 Test (org.junit.Test)47 Test (org.junit.jupiter.api.Test)20 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 BufferedReader (java.io.BufferedReader)4