private String doRunAndGetErrorLog(String content) throws Exception { WikiPage testPage = crawler.addPage(root, PathParser.parse("TestPage"), content); request.setResource(testPage.getName()); Response response = responder.makeResponse(context, request); MockResponseSender sender = new MockResponseSender(); sender.doSending(response); String results = sender.sentData(); assertHasRegexp("ErrorLog", results); WikiPage errorLog = errorLogsParentPage.getChildPage(testPage.getName()); return errorLog.getData().getContent(); }
@Test public void testSimpleRun() throws Exception { doSimpleRun(passFixtureTable()); assertSubString(testPage.getName(), results); assertSubString("Test Results", results); assertSubString("class", results); assertNotSubString("ClassNotFoundException", results); }
@Test public void testHasExitValueHeader() throws Exception { WikiPage testPage = crawler.addPage( root, PathParser.parse("TestPage"), classpathWidgets() + passFixtureTable()); request.setResource(testPage.getName()); Response response = responder.makeResponse(context, request); MockResponseSender sender = new MockResponseSender(); sender.doSending(response); String results = sender.sentData(); assertSubString("Exit-Code: 0", results); }
@Test public void testFixtureThatCrashes() throws Exception { responder.setFastTest(false); WikiPage testPage = crawler.addPage( root, PathParser.parse("TestPage"), classpathWidgets() + crashFixtureTable()); request.setResource(testPage.getName()); Response response = responder.makeResponse(context, request); MockResponseSender sender = new MockResponseSender(); sender.doSending(response); String results = sender.sentData(); assertSubString("ErrorLog", results); }
@Test public void testEmptyTestPage() throws Exception { PageData data = root.getData(); data.setContent(classpathWidgets()); root.commit(data); testPage = crawler.addPage(root, PathParser.parse("EmptyTestPage")); request.setResource(testPage.getName()); response = responder.makeResponse(context, request); sender = new MockResponseSender(); sender.doSending(response); sender.sentData(); WikiPagePath errorLogPath = PathParser.parse("ErrorLogs.EmptyTestPage"); WikiPage errorLogPage = crawler.getPage(root, errorLogPath); String errorLogContent = errorLogPage.getData().getContent(); assertNotSubString("Exception", errorLogContent); }
private void doSimpleRunWithTags(String fixtureTable, String tags) throws Exception { String simpleRunPageName = "TestPage"; testPage = crawler.addPage( root, PathParser.parse(simpleRunPageName), classpathWidgets() + fixtureTable); if (tags != null) { PageData pageData = testPage.getData(); pageData.setAttribute(PageData.PropertySUITES, tags); testPage.commit(pageData); } request.setResource(testPage.getName()); responder.turnOffChunkingForTests(); response = responder.makeResponse(context, request); sender = new MockResponseSender(); sender.doSending(response); results = sender.sentData(); }