use of ru.yandex.qatools.allure.annotations.Stories in project hale by halestudio.
the class SurfaceGeometryTest method testSurfaceArcsGml32_grid.
/**
* Test surface geometries read from a GML 3.2 file
*
* @throws Exception if an error occurs
*/
@Stories("Arcs")
@Test
public void testSurfaceArcsGml32_grid() throws Exception {
InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/surface/sample-surface-arcs.xml").toURI(), gridConfig);
// three instance expected
ResourceIterator<Instance> it = instances.iterator();
try {
List<GeometryProperty<?>> geoms = new ArrayList<>();
assertTrue("First sample feature missing", it.hasNext());
Instance instance1 = it.next();
geoms.addAll(checkSingleGeometry(instance1, null));
assertTrue("Second sample feature missing", it.hasNext());
Instance instance2 = it.next();
geoms.addAll(checkSingleGeometry(instance2, null));
assertTrue("Third sample feature missing", it.hasNext());
Instance instance3 = it.next();
geoms.addAll(checkSingleGeometry(instance3, null));
assertEquals("Unexpected number of geometries", 3, geoms.size());
Geometry geom1 = geoms.get(0).getGeometry();
Geometry geom2 = geoms.get(1).getGeometry();
Geometry geom3 = geoms.get(2).getGeometry();
Envelope envelope = new Envelope();
envelope.expandToInclude(geom1.getEnvelopeInternal());
envelope.expandToInclude(geom2.getEnvelopeInternal());
envelope.expandToInclude(geom3.getEnvelopeInternal());
PaintSettings settings = new PaintSettings(envelope, 1000, 10);
SVGPainter svg = new SVGPainter(settings);
svg.setColor(Color.BLACK);
svg.drawGeometry(geom1);
svg.setColor(Color.BLUE);
svg.drawGeometry(geom2);
svg.setColor(Color.RED);
svg.drawGeometry(geom3);
saveDrawing(svg);
// ensure that polygons could be created
assertTrue(Polygon.class.isAssignableFrom(geom1.getClass()));
assertTrue(Polygon.class.isAssignableFrom(geom2.getClass()));
assertTrue(Polygon.class.isAssignableFrom(geom3.getClass()));
// XXX how to test?
// assertTrue("Geometries intersect", geom1.touches(geom2));
// assertTrue("Geometries intersect", geom2.touches(geom3));
} finally {
it.close();
}
}
use of ru.yandex.qatools.allure.annotations.Stories in project hale by halestudio.
the class SurfaceGeometryTest method testSurfaceArcsGml32.
/**
* Test surface geometries read from a GML 3.2 file
*
* @throws Exception if an error occurs
*/
@Stories("Arcs")
@Test
public void testSurfaceArcsGml32() throws Exception {
InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/surface/sample-surface-arcs.xml").toURI(), InterpolationConfigurations.segment(maxPositionalError));
// three instance expected
ResourceIterator<Instance> it = instances.iterator();
try {
List<GeometryProperty<?>> geoms = new ArrayList<>();
assertTrue("First sample feature missing", it.hasNext());
Instance instance1 = it.next();
geoms.addAll(checkSingleGeometry(instance1, null));
assertTrue("Second sample feature missing", it.hasNext());
Instance instance2 = it.next();
geoms.addAll(checkSingleGeometry(instance2, null));
assertTrue("Third sample feature missing", it.hasNext());
Instance instance3 = it.next();
geoms.addAll(checkSingleGeometry(instance3, null));
assertEquals("Unexpected number of geometries", 3, geoms.size());
Geometry geom1 = geoms.get(0).getGeometry();
Geometry geom2 = geoms.get(1).getGeometry();
Geometry geom3 = geoms.get(2).getGeometry();
Envelope envelope = new Envelope();
envelope.expandToInclude(geom1.getEnvelopeInternal());
envelope.expandToInclude(geom2.getEnvelopeInternal());
envelope.expandToInclude(geom3.getEnvelopeInternal());
PaintSettings settings = new PaintSettings(envelope, 1000, 10);
SVGPainter svg = new SVGPainter(settings);
svg.setColor(Color.BLACK);
svg.drawGeometry(geom1);
svg.setColor(Color.BLUE);
svg.drawGeometry(geom2);
svg.setColor(Color.RED);
svg.drawGeometry(geom3);
saveDrawing(svg);
// ensure that polygons could be created
assertTrue(Polygon.class.isAssignableFrom(geom1.getClass()));
assertTrue(Polygon.class.isAssignableFrom(geom2.getClass()));
assertTrue(Polygon.class.isAssignableFrom(geom3.getClass()));
// XXX how to test?
// intersection area cannot be computed
// double interArea1 = geom1.intersection(geom2).getArea();
// double interArea2 = geom2.intersection(geom3).getArea();
} finally {
it.close();
}
}
use of ru.yandex.qatools.allure.annotations.Stories in project allure-cucumberjvm by allure-framework.
the class AllureRunListener method testSuiteStarted.
public void testSuiteStarted(Description description, String suiteName) throws IllegalAccessException {
String[] annotationParams = findFeatureByScenarioName(suiteName);
// Create feature and story annotations. Remove unnecessary words from it
Features feature = getFeaturesAnnotation(new String[] { annotationParams[0].split(":")[1].trim() });
Stories story = getStoriesAnnotation(new String[] { annotationParams[1].split(":")[1].trim() });
// If it`s Scenario Outline, add example string to story name
if (description.getDisplayName().startsWith("|") || description.getDisplayName().endsWith("|")) {
story = getStoriesAnnotation(new String[] { annotationParams[1].split(":")[1].trim() + " " + description.getDisplayName() });
}
String uid = generateSuiteUid(suiteName);
TestSuiteStartedEvent event = new TestSuiteStartedEvent(uid, story.value()[0]);
event.setTitle(story.value()[0]);
// Add feature and story annotations
Collection<Annotation> annotations = new ArrayList<>();
for (Annotation annotation : description.getAnnotations()) {
annotations.add(annotation);
}
annotations.add(story);
annotations.add(feature);
AnnotationManager am = new AnnotationManager(annotations);
am.update(event);
event.withLabels(AllureModelUtils.createTestFrameworkLabel("CucumberJVM"));
getLifecycle().fire(event);
}
Aggregations