Package org.fest.swing.junit.xml

Examples of org.fest.swing.junit.xml.XmlNode


  @Test
  public void should_add_system_output() {
    formatter.startTestSuite(new JUnitTest("test"));
    formatter.setSystemOutput(CONSOLE_OUTPUT);
    XmlNode systemOutNode = root().child(1);
    assertThat(systemOutNode.name()).isEqualTo("system-out");
    assertThat(systemOutNode.text()).isEqualTo(CONSOLE_OUTPUT);
  }
View Full Code Here


*/
public class XmlOutputWriter_writeWithDOMElementWriter_Test extends XmlOutputWriter_TestCase {

  @Test
  public void should_throw_BuildException_if_something_goes_wrong() {
    XmlNode xmlNode = createMock(XmlNode.class);
    MyDOMElementWriter xmlWriter = new MyDOMElementWriter();
    try {
      writer.write(xmlNode, new ByteArrayOutputStream(), xmlWriter);
      fail("expecting exception");
    } catch (BuildException expected) {
View Full Code Here

      @Override protected void codeToTest() {
        writer.writeScreenshot(errorNode, test);
        assertThat(root.size()).isEqualTo(2);
        assertThat(root.child(0)).isEqualTo(errorNode);
        XmlNode secondChild = root.child(1);
        assertThat(secondChild.name()).isEqualTo("screenshot");
        assertThat(secondChild.text()).isEqualTo(encodeBase64(image));
      }
    }.run();
  }
View Full Code Here

  @Test
  public void should_write_suite_statisticsAndWriteXmlToOutputStream() {
    formatter.endTestSuite(suite);
    assertThatStatisticsWereAddedToXml();
    XmlNode root = root();
    assertThatThereAreNoPropertiesIn(root);
    assertThat(textIn(output)).isEqualTo(textOf(root));
  }
View Full Code Here

    assertThatThereAreNoPropertiesIn(root());
    assertThat(output.toByteArray()).isEmpty();
  }

  private void assertThatStatisticsWereAddedToXml() {
    XmlNode root = root();
    assertThat(root.attributeCount()).isEqualTo(7);
    assertThat(root.valueOfAttribute("errors")).isEqualTo("6");
    assertThat(root.valueOfAttribute("failures")).isEqualTo("8");
    assertThat(root.valueOfAttribute("tests")).isEqualTo("18");
    double time = parseDouble(root.valueOfAttribute("time"));
    assertThat(time).isGreaterThanOrEqualTo(0d);
    assertThatSuiteAndEnvironmentInfoWereAddedTo(root);
  }
View Full Code Here

  @Ignore("this test passes only when run individually")
  public void should_write_error_in_XML_document_if_ScreenshotWriter_could_not_be_created() {
    headlessAWT(true); // force an ImageException to be thrown
    try {
      formatter.startTestSuite(new JUnitTest());
      XmlNode root = formatter.xmlRootNode();
      assertThat(root.size()).isEqualTo(2);
      XmlNode errorNode = root.child(1);
      assertThat(errorNode.name()).isEqualTo("error");
    } finally {
      headlessAWT(false);
    }
  }
View Full Code Here

  @Test
  public void should_take_screenshot_when_test_fails() {
    final ScreenshotXmlWriter writer = createMock(ScreenshotXmlWriter.class);
    updateWriterInFormatter(writer);
    final junit.framework.Test test = failingTest();
    final XmlNode errorElement = createMock(XmlNode.class);
    new EasyMockTemplate(writer) {
      @Override protected void expectations() {
        writer.writeScreenshot(errorElement, test);
        expectLastCall().once();
      }
View Full Code Here

public class TestXmlNodeWriter_addNewTestXmlNode_Test extends TestXmlNodeWriter_TestCase {

  @Test
  public void should_add_test_node_as_child() {
    final TestStub test = new TestStub("hello");
    final XmlNode newNode = mockXmlNode();
    new EasyMockTemplate(targetNode) {
      @Override protected void expectations() {
        XmlAttributes attributes = attributes(name(ATTR_NAME).value("hello"),
                                              name(ATTR_CLASSNAME).value(TestStub.class.getName()));
        expect(targetNode.addNewNode(TESTCASE, attributes)).andReturn(newNode);
View Full Code Here

  }

  @Test
  public void should_add_test_node_as_child_and_set_test_name_to_unknown_if_test_name_is_null() {
    final TestStub test = new TestStub(null);
    final XmlNode newNode = mockXmlNode();
    new EasyMockTemplate(targetNode) {
      @Override protected void expectations() {
        XmlAttributes attributes = attributes(name(ATTR_NAME).value("unknown"),
                                              name(ATTR_CLASSNAME).value(TestStub.class.getName()));
        expect(targetNode.addNewNode(TESTCASE, attributes)).andReturn(newNode);
View Full Code Here

  @Test
  public void should_add_system_error() {
    formatter.startTestSuite(new JUnitTest("test"));
    formatter.setSystemError(CONSOLE_OUTPUT);
    XmlNode systemErrNode = root().child(1);
    assertThat(systemErrNode.name()).isEqualTo("system-err");
    assertThat(systemErrNode.text()).isEqualTo(CONSOLE_OUTPUT);
  }
View Full Code Here

TOP

Related Classes of org.fest.swing.junit.xml.XmlNode

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.