Package fitnesse.testrunner

Examples of fitnesse.testrunner.WikiTestPage


    clock = new DateAlteringClock(testTime).freeze();

    WikiPage root = InMemoryPage.makeRoot("RooT");
    FitNesseContext context = FitNesseUtil.makeTestContext(root);
    WikiPage suitePage = root.addChildPage("SuitePage");
    testPage = new WikiTestPage(suitePage.addChildPage("TestPage"), null);
    writers = new LinkedList<StringWriter>();
    formatter = new SuiteHistoryFormatter(context, suitePage, new TestXmlFormatter.WriterFactory() {
      @Override
      public Writer getWriter(FitNesseContext context, WikiPage page, TestSummary counts, long time) throws IOException {
        StringWriter w = new StringWriter();
View Full Code Here


  }
 
  @Test
  public void processTestResultsShouldBuildUpCurrentResultAndFinalSummary() throws Exception {
    FitNesseContext context = mock(FitNesseContext.class);
    WikiTestPage page = new WikiTestPage(new WikiPageDummy("name", "content", null), null);
    page.getData().setAttribute(PageData.PropertySUITES, "tag1");
    WriterFactory writerFactory = mock(WriterFactory.class);
    final TestResult testResult = new TestResult();
    TestXmlFormatter formatter = new TestXmlFormatter(context , page.getSourcePage(), writerFactory) {
      @Override
      protected TestResult newTestResult() {
        return testResult;
      }
    };
    final long startTime = clock.currentClockTimeInMillis();

    formatter.testOutputChunk("outputChunk");

    formatter.testStarted(page);

    clock.elapse(27);

    TestSummary summary = new TestSummary(9,8,7,6);
    formatter.testComplete(page, summary);
    assertThat(formatter.testResponse.getFinalCounts(), equalTo(new TestSummary(0,1,0,0)));
    assertThat(formatter.testResponse.getResults().size(), is(1));
    assertThat(formatter.testResponse.getResults().get(0), is(testResult));
    assertThat(testResult.startTime, is(startTime));
    assertThat(testResult.content, is("outputChunk"));
    assertThat(testResult.right, is("9"));
    assertThat(testResult.wrong, is("8"));
    assertThat(testResult.ignores, is("7"));
    assertThat(testResult.exceptions, is("6"));
    assertThat(testResult.runTimeInMillis, is("27"));
    assertThat(testResult.relativePageName, is(page.getName()));
    assertThat(testResult.tags, is("tag1"));
  }
View Full Code Here

  }


  @Test
  public void testCompleteShouldAddPageAndSummaryAndTimingToResponse() throws Exception {
    WikiTestPage page = new WikiTestPage(new WikiPageDummy("page", "content", null), null);
    TestSummary summary = new TestSummary(1, 2, 3, 4);

    ChunkedResponse response = mock(ChunkedResponse.class);
    TestTextFormatter formatter = new TestTextFormatter(response);
    formatter.testStarted(page);
View Full Code Here

  }

  @Test
  public void testTotalTimingShouldAppearInSummary() throws Exception {
    formatter.announceNumberTestsToRun(1);
    WikiTestPage firstPage = new WikiTestPage(new WikiPageDummy("page1", "content", null), variableSource);
    formatter.testStarted(firstPage);
    formatter.testComplete(firstPage, new TestSummary(1, 2, 3, 4));
    clock.elapse(900);
    formatter.close();
    assertSubString("<strong>Assertions:</strong> 1 right, 2 wrong, 3 ignored, 4 exceptions (0" + getDecimalSeparator() + "900 seconds)", pageBuffer.toString());
View Full Code Here

  @Test
  public void testIndividualTestTimingsShouldAppearInSummary() throws Exception {
    TimeMeasurement totalTimeMeasurement = newConstantElapsedTimeMeasurement(900).start();
    formatter.announceNumberTestsToRun(2);
    WikiTestPage firstPage = new WikiTestPage(new WikiPageDummy("page1", "content", null), variableSource);
    WikiTestPage secondPage = new WikiTestPage(new WikiPageDummy("page2", "content", null), variableSource);
    formatter.testStarted(firstPage);
    clock.elapse(670);
    formatter.testComplete(firstPage, new TestSummary(1, 2, 3, 4));
    formatter.testStarted(secondPage);
    clock.elapse(890);
View Full Code Here

      try {
        output = new StringBuilder(512);
        testSystem = getTestSystem();
        testSystem.start();
        testSystem.runTests(new WikiTestPage(page, null));
      } catch (IOException e) {
        slimException = e;
      } finally {
        try {
          if (testSystem != null) testSystem.bye();
View Full Code Here

  private WikiTestPage mockWikiTestPage() {
    WikiPage mock = mock(WikiPage.class);
    when(mock.isRoot()).thenReturn(true);
    when(mock.getName()).thenReturn("WikiPage");
    when(mock.getPageCrawler()).thenReturn(new PageCrawlerImpl(mock));
    return new WikiTestPage(mock, null);
  }
View Full Code Here

    jf.setResultsRepository(mockResultsRepository);
  }

  @Test
  public void getFullPath_WalksUpWikiPageParentsAndBuildsFullPathToPage() throws Exception{
    WikiTestPage wp = buildNestedTestPage();
    assertEquals(nestedPageName, wp.getFullPath());
  }
View Full Code Here

  private WikiTestPage buildNestedTestPage() throws Exception {
    WikiPageDummy root = new WikiPageDummy("root", null, null);
    WikiPageDummy parent=new WikiPageDummy("ParentTest",null, root);
    WikiPageDummy wp=new WikiPageDummy("ChildTest",null, parent);
    return new WikiTestPage(wp, variableSource);
  }
View Full Code Here

    return new WikiTestPage(wp, variableSource);
  }

  @Test
  public void newTestStarted_SwitchesResultRepositoryToCurrentTest() throws Exception{
    WikiTestPage wp=buildNestedTestPage();
    jf.testStarted(wp);
    verify(mockResultsRepository).open(nestedPageName);
  }
View Full Code Here

TOP

Related Classes of fitnesse.testrunner.WikiTestPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.