Search in sources :

Example 6 with Graph

use of com.thoughtworks.studios.shine.semweb.Graph in project gocd by gocd.

the class AntJUnitReportRDFizerForTwistReportTest method canReadTwistTestWithFailingOutput.

@Test
public void canReadTwistTestWithFailingOutput() throws Exception {
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(FileUtils.readFileToString(new File("src/test-shared/resources/twist_xunit/failing/TWIST_TEST--scenarios.AFailingTest.xml"), UTF_8)));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "PREFIX xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'ShineReadsCruiseStagesCompletedFeed.scn'^^xsd:string . " + "_:testCase xunit:testCaseName 'ShineReadsCruiseStagesCompletedFeed.scn'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'false'^^xsd:boolean " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) File(java.io.File) Test(org.junit.Test)

Example 7 with Graph

use of com.thoughtworks.studios.shine.semweb.Graph in project gocd by gocd.

the class AntJUnitReportRDFizerForTwistReportTest method canReadTwistTestWithErrorOutput.

@Test
public void canReadTwistTestWithErrorOutput() throws Exception {
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(FileUtils.readFileToString(new File("src/test-shared/resources/twist_xunit/errors/TWIST_TEST--scenarios.AErrorTest.xml"), UTF_8)));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "PREFIX xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'ShineReadsCruiseStagesCompletedFeed.scn'^^xsd:string . " + "_:testCase xunit:testCaseName 'ShineReadsCruiseStagesCompletedFeed.scn'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'true'^^xsd:boolean " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) File(java.io.File) Test(org.junit.Test)

Example 8 with Graph

use of com.thoughtworks.studios.shine.semweb.Graph in project gocd by gocd.

the class AntJUnitReportRDFizerTest method testLoadingPassingJUnit.

@Test
public void testLoadingPassingJUnit() throws Exception {
    String passingTestXML = "<?xml version='1.0' encoding='UTF-8' ?>" + "<testsuite name='com.example.TheTest'>" + "<testcase classname='com.example.TheTest' name='testSomething' />" + "</testsuite>";
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(passingTestXML));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "prefix xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'com.example.TheTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'testSomething'^^xsd:string . " + "OPTIONAL { ?testCase xunit:hasFailure ?failure } . " + "FILTER (!bound(?failure)) " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Example 9 with Graph

use of com.thoughtworks.studios.shine.semweb.Graph in project gocd by gocd.

the class AntJUnitReportRDFizerTest method testLoadingFailingJUnit.

@Test
public void testLoadingFailingJUnit() throws Exception {
    String failingTestXML = "<?xml version='1.0' encoding='UTF-8' ?>" + "<testsuite errors='1' failures='1' hostname='fake-host-name' name='com.example.TheTest' tests='1' time='1.058' timestamp='2009-12-25T00:34:36'>" + "<testcase classname='com.example.TheTest' name='testSomething' time='0.011'>" + "<failure message='foo' type='junit.framework.AssertionFailedError'>junit.framework.AssertionFailedError: foo" + "\tat com.example.TheTest.testSomething(TheTest.java:96)" + "</failure>" + "</testcase>" + "</testsuite>";
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(failingTestXML));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "PREFIX xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'com.example.TheTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'testSomething'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'false'^^xsd:boolean " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Example 10 with Graph

use of com.thoughtworks.studios.shine.semweb.Graph in project gocd by gocd.

the class NUnitRDFizerTest method testLoadingPassingJUnit.

@Test
public void testLoadingPassingJUnit() throws Exception {
    String passingTestXML = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" + "<!--This file represents the results of running a test suite-->" + "<test-results name=\"/home/erik/coding/test/nunittests/Tests.dll\" total=\"4\" failures=\"1\" not-run=\"0\" date=\"2007-07-27\" time=\"11:18:43\">" + "  <environment nunit-version=\"2.2.8.0\" clr-version=\"2.0.50727.42\" os-version=\"Unix 2.6.18.4\" platform=\"Unix\" cwd=\"/home/erik/coding/test/nunittests\" machine-name=\"akira.ramfelt.se\" user=\"erik\" user-domain=\"akira.ramfelt.se\" />" + "  <culture-info current-culture=\"sv-SE\" current-uiculture=\"sv-SE\" />" + "  <test-suite name=\"/home/erik/coding/test/nunittests/Tests.dll\" success=\"False\" time=\"0.404\" asserts=\"0\">" + "    <results>" + "      <test-suite name=\"AnotherNS\" success=\"True\" time=\"0.001\" asserts=\"0\">" + "        <results>" + "          <test-suite name=\"AnotherNS.OtherMainClassTest\" success=\"True\" time=\"0.001\" asserts=\"0\">" + "            <results>" + "              <test-case name=\"AnotherNS.OtherMainClassTest.TestPropertyValueAgain\" executed=\"True\" success=\"True\" time=\"0.001\" asserts=\"1\" />" + "            </results>" + "          </test-suite>" + "        </results>" + "      </test-suite>" + "    </results>" + "  </test-suite>" + "</test-results>";
    Graph graph = nUnitRDFizer.importFile("http://job", document(passingTestXML));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "prefix xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'AnotherNS.OtherMainClassTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'TestPropertyValueAgain'^^xsd:string . " + "OPTIONAL { ?testCase xunit:hasFailure ?failure } . " + "FILTER (!bound(?failure)) " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) Test(org.junit.Test)

Aggregations

Graph (com.thoughtworks.studios.shine.semweb.Graph)41 Test (org.junit.Test)26 InMemoryTempGraphFactory (com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)18 File (java.io.File)7 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)5 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)5 InputStream (java.io.InputStream)5 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Date (java.util.Date)4 Pipeline (com.thoughtworks.go.domain.Pipeline)3 Stage (com.thoughtworks.go.domain.Stage)3 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 StageXmlViewModel (com.thoughtworks.go.server.domain.xml.StageXmlViewModel)3 XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)3 Modification (com.thoughtworks.go.domain.materials.Modification)2 GoGRDDLResourceRDFizer (com.thoughtworks.studios.shine.cruise.GoGRDDLResourceRDFizer)2 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)2 IOException (java.io.IOException)2 Transformer (javax.xml.transform.Transformer)2