@Test public void testPagesForTestSystemAreSurroundedBySuiteSetupAndTeardown() throws Exception { WikiPage slimPage = addTestPage(suite, "AaSlimTest", simpleSlimDecisionTable); WikiPage setUp = crawler.addPage(root, PathParser.parse("SuiteSetUp"), "suite set up"); WikiPage tearDown = crawler.addPage(root, PathParser.parse("SuiteTearDown"), "suite tear down"); testPages = new LinkedList<WikiPage>(); testPages.add(setUp); testPages.add(slimPage); testPages.add(testPage); testPages.add(tearDown); MultipleTestsRunner runner = new MultipleTestsRunner(testPages, context, suite, null); Map<TestSystem.Descriptor, LinkedList<TestPage>> map = runner.makeMapOfPagesByTestSystem(); TestSystem.Descriptor fitDescriptor = TestSystem.getDescriptor(testPage.getData(), context.pageFactory, false); TestSystem.Descriptor slimDescriptor = TestSystem.getDescriptor(slimPage.getData(), context.pageFactory, false); List<TestPage> fitList = map.get(fitDescriptor); List<TestPage> slimList = map.get(slimDescriptor); assertEquals(3, fitList.size()); assertEquals(3, slimList.size()); assertEquals(setUp, fitList.get(0).getSourcePage()); assertEquals(testPage, fitList.get(1).getSourcePage()); assertEquals(tearDown, fitList.get(2).getSourcePage()); assertEquals(setUp, slimList.get(0).getSourcePage()); assertEquals(slimPage, slimList.get(1).getSourcePage()); assertEquals(tearDown, slimList.get(2).getSourcePage()); }
protected void performExecution() throws Exception { String testSystemName = TestSystem.getTestSystemName(data); String testRunner = TestSystem.getTestRunner(data); TestSystem testSystem = testSystemGroup.startTestSystem(testSystemName, testRunner, classPath); if (testSystemGroup.isSuccessfullyStarted()) { addToResponse(HtmlUtil.getHtmlOfInheritedPage("PageHeader", page)); SetupTeardownIncluder.includeInto(data, true); if (data.getContent().length() == 0) addEmptyContentMessage(); testSystem.sendPageData(data); testSystemGroup.bye(); } }
@Test public void testGenerateSuiteMapWithMultipleTestSystems() throws Exception { WikiPage slimPage = addTestPage(suite, "SlimTest", simpleSlimDecisionTable); MultipleTestsRunner runner = new MultipleTestsRunner(testPages, context, suite, null); Map<TestSystem.Descriptor, LinkedList<TestPage>> map = runner.makeMapOfPagesByTestSystem(); TestSystem.Descriptor fitDescriptor = TestSystem.getDescriptor(testPage.getData(), context.pageFactory, false); TestSystem.Descriptor slimDescriptor = TestSystem.getDescriptor(slimPage.getData(), context.pageFactory, false); List<TestPage> fitList = map.get(fitDescriptor); List<TestPage> slimList = map.get(slimDescriptor); assertEquals(1, fitList.size()); assertEquals(1, slimList.size()); assertEquals(testPage, fitList.get(0).getSourcePage()); assertEquals(slimPage, slimList.get(0).getSourcePage()); }