Loading ...
Sorry, an error occurred while loading the content.

Re: [junit] Confusion starting testSuite

Expand Messages
  • Johannes Link
    The TestRunner expects a class with a static suite() method which returns the test suite. In your code you specify the test suite class itself. Johannes
    Message 1 of 4 , Nov 18, 2000
    View Source
    • 0 Attachment
      The TestRunner expects a class with a static suite() method which
      returns the test
      suite. In your code you specify the test suite class itself.

      Johannes

      David Corbin wrote:

      > I'm obviously missing something here. Consider this code
      > public class XSuite extends junit.framework.TestSuite
      > {
      > public static void main (String[] args)
      > {
      > junit.textui.TestRunner.run(new XSuite());
      > }
      > public XSuite()
      > {
      > super("X Suite");
      > addTest(new PackageTestSuite());
      > }
      > }
      >
      > Now, if I invoke this application, all my tests run fine...
      >
      > But, if I invoke "java junit.textui.TestRunner XSuite", it fails with
      >
      > 1) warning(junit.framework.TestSuite$ 1)"No tests found in
      > com.machturtle.tvg.XSuite"
      >
      > In reality, the chain of TestSuites contains 6 tests.
      >
      > What have I done "wrong"?
      > --
    • David Corbin
      ... OK. Now can someone tell me WHY it expects it? Why can t it just use the actual object as-is? ... -- David Corbin Mach Turtle Technologies, Inc.
      Message 2 of 4 , Nov 19, 2000
      View Source
      • 0 Attachment
        Johannes Link wrote:
        >
        > The TestRunner expects a class with a static suite() method which
        > returns the test suite.

        OK. Now can someone tell me WHY it expects it? Why can't it just use
        the actual object as-is?

        >
        > Johannes
        >
        > David Corbin wrote:
        >
        > > I'm obviously missing something here. Consider this code
        > > public class XSuite extends junit.framework.TestSuite
        > > {
        > > public static void main (String[] args)
        > > {
        > > junit.textui.TestRunner.run(new XSuite());
        > > }
        > > public XSuite()
        > > {
        > > super("X Suite");
        > > addTest(new PackageTestSuite());
        > > }
        > > }
        > >
        > > Now, if I invoke this application, all my tests run fine...
        > >
        > > But, if I invoke "java junit.textui.TestRunner XSuite", it fails with
        > >
        > > 1) warning(junit.framework.TestSuite$ 1)"No tests found in
        > > com.machturtle.tvg.XSuite"
        > >
        > > In reality, the chain of TestSuites contains 6 tests.
        > >
        > > What have I done "wrong"?
        > > --
        >
        >
        > To unsubscribe from this group, send an email to:
        > junit-unsubscribe@egroups.com

        --
        David Corbin
        Mach Turtle Technologies, Inc.
        http://www.machturtle.com
        dcorbin@...
      • Johannes Link
        The developers decided that to be their interface of choice. What is the actual object ? You just give a string as parameter which ghas to be interpreted
        Message 3 of 4 , Nov 20, 2000
        View Source
        • 0 Attachment
          The developers decided that to be their interface of choice. What is "the
          actual object"? You just give a string as parameter which ghas to be
          interpreted somehow. No objects involved so far.
          If you want to use your class from TestRunner's main, just add the static
          suite() method and it should work.

          Johannes

          David Corbin wrote:

          > Johannes Link wrote:
          > >
          > > The TestRunner expects a class with a static suite() method which
          > > returns the test suite.
          >
          > OK. Now can someone tell me WHY it expects it? Why can't it just use
          > the actual object as-is?
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.