Package org.apache.tools.ant.taskdefs.optional.junit

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest


  @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 {
View Full Code Here


*/
public class XmlJUnitResultFormatter_setSystemError_Test extends XmlJUnitResultFormatter_TestCase {

  @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

  @Test
  public void shouldReturnTestClassNameFromVmExitErrorTest() {
    Class<?> vmExitErrorTestClass = staticInnerClass("VmExitErrorTest").in(JUnitTaskMirrorImpl.class).get();
    Object test = constructor().withParameterTypes(String.class, JUnitTest.class, String.class)
                               .in(vmExitErrorTestClass)
                               .newInstance("someMessage", new JUnitTest("testClassName"), "testName");
    assertThat(test).isInstanceOf(junit.framework.Test.class);
    assertThat(Tests.testClassNameFrom((junit.framework.Test)test)).isEqualTo("testClassName");
  }
View Full Code Here

public class XmlJUnitResultFormatter_startTestSuite_Test extends XmlJUnitResultFormatter_TestCase {

  private JUnitTest suite;

  @Override void onSetUp() {
    suite = new JUnitTest("test");
  }
View Full Code Here

      return "localhost";
    }
  }

  final JUnitTest startSuite() {
    JUnitTest suite = new JUnitTest("test");
    formatter.startTestSuite(suite);
    return suite;
  }
View Full Code Here

      }

    if (className == null)
      throw new IllegalArgumentException("Test class name not specified"); //$NON-NLS-1$

    JUnitTest t = new JUnitTest(className);

    // Add/overlay system properties on the properties from the Ant project
    Hashtable p = System.getProperties();
    for (Enumeration _enum = p.keys(); _enum.hasMoreElements();) {
      Object key = _enum.nextElement();
      props.put(key, p.get(key));
    }
    t.setProperties(props);

    EclipseTestRunner runner = new EclipseTestRunner(t, testPluginName, haltError, haltFail);
    transferFormatters(runner);
    runner.run();
    return runner.getRetCode();
View Full Code Here

        }

        for (ModelTestSuite modelSuite: jsWrapper.getModelTestSuites()) {
            GenericDelegator testDelegator = modelSuite.getDelegator();
            TestSuite suite = modelSuite.makeTestSuite();
            JUnitTest test = new JUnitTest();
            test.setName(suite.getName());

            // create the XML logger
            JunitXmlListener xml;
            try {
                xml = new JunitXmlListener(new FileOutputStream(logDir + suite.getName() + ".xml"));
            } catch (FileNotFoundException e) {
                throw new ContainerException(e);
            }

            // per-suite results
            TestResult results = new TestResult();
            results.addListener(new JunitListener());
            results.addListener(xml);

            // add the suite to the xml listener
            xml.startTestSuite(test);
            // run the tests
            suite.run(results);
            test.setCounts(results.runCount(), results.failureCount(), results.errorCount());
            // rollback all entity operations performed by the delegator
            testDelegator.rollback();
            xml.endTestSuite(test);

            // display the results
View Full Code Here

            try
            {
                Enumeration tests = getIndividualTests();
                while (tests.hasMoreElements())
                {
                    JUnitTest test = (JUnitTest) tests.nextElement();
                    if (test.shouldRun(getProject())
                     && !theContainer.isExcluded(test.getName()))
                    {
                        if (theContainer.getToDir() != null)
                        {
                            test.setTodir(theContainer.getToDir());
                        }
                        execute(test);
                    }
                }
            }
View Full Code Here

        CoberturaManager mockMan = EasyMock.createMock(CoberturaManager.class);
        mockMan.inPackage(PerPackageCoverageJUnitFormatter.class.getPackage()
                .getName());
        EasyMock.expectLastCall();

        JUnitTest mockTest = EasyMock.createMock(JUnitTest.class);
        EasyMock.expect(mockTest.getName()).andReturn(
                PerPackageCoverageJUnitFormatter.class.getName());

        EasyMock.replay(mockTest, mockMan);
        CoberturaManager.setInstanceForTesting(mockMan);
        listener.startTestSuite(mockTest);
View Full Code Here

            try
            {
                Enumeration tests = getIndividualTests();
                while (tests.hasMoreElements())
                {
                    JUnitTest test = (JUnitTest) tests.nextElement();
                    if (test.shouldRun(getProject())
                     && !theContainer.isExcluded(test.getName()))
                    {
                        if (theContainer.getToDir() != null)
                        {
                            test.setTodir(theContainer.getToDir());
                        }
                        execute(test);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

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.