-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpecificationViewGeneratorTest.java
40 lines (34 loc) · 1.51 KB
/
SpecificationViewGeneratorTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.exubero.jbehave.specification;
import org.jbehave.core.embedder.Embedder;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static com.exubero.jbehave.specification.JBehaveSpecificationBuilder.aSpecificationBuilderWithSteps;
import static com.exubero.jbehave.specification.SpecificationPage.specificationPageFrom;
import static org.junit.Assert.assertTrue;
public class SpecificationViewGeneratorTest {
private static File specificationFile;
@BeforeClass
public static void buildSpecificationHtml() throws Throwable {
StorySteps storySteps = new StorySteps();
try {
aSpecificationBuilderWithSteps(storySteps)
.withSpecificationTitle("Example Specifications")
.run();
} catch (Embedder.RunningStoriesFailed ex) {
// This is not a problem - the example stories have deliberate errors
}
specificationFile = new File("build/reports/jbehave/specification.html");
assertTrue(specificationFile.exists());
}
@Test
public void htmlContainsSummaryStatistics() throws IOException {
try(SpecificationPage specificationPage = specificationPageFrom(specificationFile)) {
specificationPage.assertStatisticsExists();
specificationPage.assertStatisticsStoryCount(7);
specificationPage.assertStatisticsScenarioCount(17);
specificationPage.assertStatisticsScenarioFailedCount(2);
}
}
}