use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory 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("test/data/twist_xunit/failing/TWIST_TEST--scenarios.AFailingTest.xml"))));
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);
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory 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);
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory 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);
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class AntJUnitReportRDFizerTest method testDoesNotHandleNonJUnitXMLFile.
@Test
public void testDoesNotHandleNonJUnitXMLFile() throws DocumentException {
String invalidXML = "<?xml version='1.0' encoding='UTF-8' ?><foo/>";
AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
assertFalse(junitRDFizer.canHandle(document(invalidXML)));
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class AntJUnitGRDDLTest method setUp.
@Before
public void setUp() throws Exception {
InputStream xunitXMLStream = new ByteArrayInputStream(minimalXUnitXML.getBytes());
XSLTTransformerRegistry xsltTransformerRegistry = new XSLTTransformerRegistry();
transformer = new GRDDLTransformer(xsltTransformerRegistry, XSLTTransformerRegistry.XUNIT_ANT_JUNIT_GRDDL_XSL);
minimalDataGraph = transformer.transform(xunitXMLStream, new InMemoryTempGraphFactory());
}
Aggregations