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

Re: [junit] @RunWith more than one runner?

Expand Messages
  • Bill Shannon
    The way I have it set up, MyTest1 and MyTest2 are not discovered by the normal runner, so they never run by themselves. But otherwise, yes, MyTest1 does not
    Message 1 of 12 , Jan 12, 2010
    View Source
    • 0 Attachment
      The way I have it set up, MyTest1 and MyTest2 are not discovered by
      the normal runner, so they never run by themselves. But otherwise,
      yes, MyTest1 does not run as part of MyTestSuite and MyTest2 does run
      as part of MyTestSuite.

      Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it still runs.


      David Saff wrote on 01/11/10 06:32 PM:
      >
      >
      > Bill,
      >
      > I would expect what you're trying to do to work if you and I both
      > understand correctly how subclassing Suite works.
      >
      > So you're saying that if MyTest1 has RunWith(Parameterized), and
      > MyTest2 does not, then:
      >
      > MyTest1 runs by itself
      > MyTest2 runs by itself
      > MyTest1 does not run as part of MyTestSuite
      > MyTest2 does run as part of MyTestSuite
      >
      > Do I have that right? If so, what if MyTest2 is annotated with
      > @RunWith(JUnit4.class) [which _should_ be a no-op?]
      >
      > David Saff
      >
      > On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon <Bill.Shannon@...
      > <mailto:Bill.Shannon%40sun.com>> wrote:
      > > I created a Suite that allows me to run tests in a separate class loader.
      > > I use it like this:
      > >
      > > @RunWith(ClassLoaderSuite.class)
      > > @SuiteClasses({ MyTest1.class, MyTest2.class })
      > > @TestClass(ClassToTest.class)
      > > public class MyTestSuite {
      > > }
      > >
      > > If I want one of those tests to be parameterized, should I expect to
      > > be able to do:
      > >
      > > @RunWith(Parameterized.class)
      > > public class MyTest1 {
      > > ...
      > > }
      > >
      > > It doesn't seem to work.
      > >
      > > What would I have to do in ClassLoaderSuite to make this work?
      > >
      > > FYI, you can find ClassLoaderSuite.java at:
      > >
      > http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
      > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      >
      >
    • Bill Shannon
      Anyone have any ideas?
      Message 2 of 12 , Jan 14, 2010
      View Source
      • 0 Attachment
        Anyone have any ideas?

        Bill Shannon wrote on 01/12/2010 11:04 AM:
        > The way I have it set up, MyTest1 and MyTest2 are not discovered by
        > the normal runner, so they never run by themselves. But otherwise,
        > yes, MyTest1 does not run as part of MyTestSuite and MyTest2 does run
        > as part of MyTestSuite.
        >
        > Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it still
        > runs.
        >
        >
        > David Saff wrote on 01/11/10 06:32 PM:
        >>
        >>
        >> Bill,
        >>
        >> I would expect what you're trying to do to work if you and I both
        >> understand correctly how subclassing Suite works.
        >>
        >> So you're saying that if MyTest1 has RunWith(Parameterized), and
        >> MyTest2 does not, then:
        >>
        >> MyTest1 runs by itself
        >> MyTest2 runs by itself
        >> MyTest1 does not run as part of MyTestSuite
        >> MyTest2 does run as part of MyTestSuite
        >>
        >> Do I have that right? If so, what if MyTest2 is annotated with
        >> @RunWith(JUnit4.class) [which _should_ be a no-op?]
        >>
        >> David Saff
        >>
        >> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon <Bill.Shannon@...
        >> <mailto:Bill.Shannon%40sun.com>> wrote:
        >> > I created a Suite that allows me to run tests in a separate class
        >> loader.
        >> > I use it like this:
        >> >
        >> > @RunWith(ClassLoaderSuite.class)
        >> > @SuiteClasses({ MyTest1.class, MyTest2.class })
        >> > @TestClass(ClassToTest.class)
        >> > public class MyTestSuite {
        >> > }
        >> >
        >> > If I want one of those tests to be parameterized, should I expect to
        >> > be able to do:
        >> >
        >> > @RunWith(Parameterized.class)
        >> > public class MyTest1 {
        >> > ...
        >> > }
        >> >
        >> > It doesn't seem to work.
        >> >
        >> > What would I have to do in ClassLoaderSuite to make this work?
        >> >
        >> > FYI, you can find ClassLoaderSuite.java at:
        >> >
        >> http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
        >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
        >>
        >> >
        >> >
        >> > ------------------------------------
        >> >
        >> > Yahoo! Groups Links
        >> >
        >> >
        >> >
        >> >
        >>
        >>
        >
      • David Saff
        Bill, Jens recently posted a helpful bug with Suite and Parameterized. It s possible the behavior you re seeing is related. Can you reduce your problem down
        Message 3 of 12 , Jan 19, 2010
        View Source
        • 0 Attachment
          Bill,

          Jens recently posted a helpful bug with Suite and Parameterized. It's
          possible the behavior you're seeing is related. Can you reduce your
          problem down to a small amount of code you can share? Thanks,

          David Saff

          On Thu, Jan 14, 2010 at 10:17 PM, Bill Shannon <Bill.Shannon@...> wrote:
          > Anyone have any ideas?
          >
          > Bill Shannon wrote on 01/12/2010 11:04 AM:
          >> The way I have it set up, MyTest1 and MyTest2 are not discovered by
          >> the normal runner, so they never run by themselves.  But otherwise,
          >> yes, MyTest1 does not run as part of MyTestSuite and MyTest2 does run
          >> as part of MyTestSuite.
          >>
          >> Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it still
          >> runs.
          >>
          >>
          >> David Saff wrote on 01/11/10 06:32 PM:
          >>>
          >>>
          >>> Bill,
          >>>
          >>> I would expect what you're trying to do to work if you and I both
          >>> understand correctly how subclassing Suite works.
          >>>
          >>> So you're saying that if MyTest1 has RunWith(Parameterized), and
          >>> MyTest2 does not, then:
          >>>
          >>> MyTest1 runs by itself
          >>> MyTest2 runs by itself
          >>> MyTest1 does not run as part of MyTestSuite
          >>> MyTest2 does run as part of MyTestSuite
          >>>
          >>> Do I have that right? If so, what if MyTest2 is annotated with
          >>> @RunWith(JUnit4.class) [which _should_ be a no-op?]
          >>>
          >>> David Saff
          >>>
          >>> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon <Bill.Shannon@...
          >>> <mailto:Bill.Shannon%40sun.com>> wrote:
          >>>  > I created a Suite that allows me to run tests in a separate class
          >>> loader.
          >>>  > I use it like this:
          >>>  >
          >>>  > @RunWith(ClassLoaderSuite.class)
          >>>  > @SuiteClasses({ MyTest1.class, MyTest2.class })
          >>>  > @TestClass(ClassToTest.class)
          >>>  > public class MyTestSuite {
          >>>  > }
          >>>  >
          >>>  > If I want one of those tests to be parameterized, should I expect to
          >>>  > be able to do:
          >>>  >
          >>>  > @RunWith(Parameterized.class)
          >>>  > public class MyTest1 {
          >>>  > ...
          >>>  > }
          >>>  >
          >>>  > It doesn't seem to work.
          >>>  >
          >>>  > What would I have to do in ClassLoaderSuite to make this work?
          >>>  >
          >>>  > FYI, you can find ClassLoaderSuite.java at:
          >>>  >
          >>> http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
          >>> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
          >>>
          >>>  >
          >>>  >
          >>>  > ------------------------------------
          >>>  >
          >>>  > Yahoo! Groups Links
          >>>  >
          >>>  >
          >>>  >
          >>>  >
          >>>
          >>>
          >>
          >
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
        • Bill Shannon
          I heard from someone else off-list that, due to the design of JUnit runners, this almost certainly isn t going to work. All of the relevant code is part of an
          Message 4 of 12 , Jan 19, 2010
          View Source
          • 0 Attachment
            I heard from someone else off-list that, due to the design of JUnit
            runners, this almost certainly isn't going to work.

            All of the relevant code is part of an existing open source project,
            and I can tell you how to reproduce the problem with that code. Is
            that sufficient?

            Or are you looking for a completely standalone project that demonstrates
            the problem?

            I guess I'm not sure whether you're still confused about what it is I'm
            trying to do, or whether you're sure it *should* work and you want a
            reproducible test case so that you can debug it. In the latter case,
            how would you like me to deliver that? (Note that my experience with
            JUnit is limited. For instance, I've only ever run it as part of a
            maven project.)


            David Saff wrote on 01/19/10 06:37 AM:
            >
            >
            > Bill,
            >
            > Jens recently posted a helpful bug with Suite and Parameterized. It's
            > possible the behavior you're seeing is related. Can you reduce your
            > problem down to a small amount of code you can share? Thanks,
            >
            > David Saff
            >
            > On Thu, Jan 14, 2010 at 10:17 PM, Bill Shannon <Bill.Shannon@...
            > <mailto:Bill.Shannon%40sun.com>> wrote:
            > > Anyone have any ideas?
            > >
            > > Bill Shannon wrote on 01/12/2010 11:04 AM:
            > >> The way I have it set up, MyTest1 and MyTest2 are not discovered by
            > >> the normal runner, so they never run by themselves. But otherwise,
            > >> yes, MyTest1 does not run as part of MyTestSuite and MyTest2 does run
            > >> as part of MyTestSuite.
            > >>
            > >> Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it still
            > >> runs.
            > >>
            > >>
            > >> David Saff wrote on 01/11/10 06:32 PM:
            > >>>
            > >>>
            > >>> Bill,
            > >>>
            > >>> I would expect what you're trying to do to work if you and I both
            > >>> understand correctly how subclassing Suite works.
            > >>>
            > >>> So you're saying that if MyTest1 has RunWith(Parameterized), and
            > >>> MyTest2 does not, then:
            > >>>
            > >>> MyTest1 runs by itself
            > >>> MyTest2 runs by itself
            > >>> MyTest1 does not run as part of MyTestSuite
            > >>> MyTest2 does run as part of MyTestSuite
            > >>>
            > >>> Do I have that right? If so, what if MyTest2 is annotated with
            > >>> @RunWith(JUnit4.class) [which _should_ be a no-op?]
            > >>>
            > >>> David Saff
            > >>>
            > >>> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon <Bill.Shannon@...
            > <mailto:Bill.Shannon%40sun.com>
            > >>> <mailto:Bill.Shannon%40sun.com>> wrote:
            > >>> > I created a Suite that allows me to run tests in a separate class
            > >>> loader.
            > >>> > I use it like this:
            > >>> >
            > >>> > @RunWith(ClassLoaderSuite.class)
            > >>> > @SuiteClasses({ MyTest1.class, MyTest2.class })
            > >>> > @TestClass(ClassToTest.class)
            > >>> > public class MyTestSuite {
            > >>> > }
            > >>> >
            > >>> > If I want one of those tests to be parameterized, should I expect to
            > >>> > be able to do:
            > >>> >
            > >>> > @RunWith(Parameterized.class)
            > >>> > public class MyTest1 {
            > >>> > ...
            > >>> > }
            > >>> >
            > >>> > It doesn't seem to work.
            > >>> >
            > >>> > What would I have to do in ClassLoaderSuite to make this work?
            > >>> >
            > >>> > FYI, you can find ClassLoaderSuite.java at:
            > >>> >
            > >>>
            > http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
            > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
            > >>>
            > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
            > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>
            > >>>
            > >>> >
            > >>> >
            > >>> > ------------------------------------
            > >>> >
            > >>> > Yahoo! Groups Links
            > >>> >
            > >>> >
            > >>> >
            > >>> >
            > >>>
            > >>>
            > >>
            > >
            > >
            > >
            > > ------------------------------------
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > >
            >
            >
          • David Saff
            Bill, Nothing you ve said so far seems impossible, so I am indeed just trying to replicate the bug you re facing, for debugging. Steps to reproduce on
            Message 5 of 12 , Jan 19, 2010
            View Source
            • 0 Attachment
              Bill,

              Nothing you've said so far seems impossible, so I am indeed just
              trying to replicate the bug you're facing, for debugging. Steps to
              reproduce on open-source code are a great start. Thanks,

              David Saff

              On Tue, Jan 19, 2010 at 12:50 PM, Bill Shannon <Bill.Shannon@...> wrote:
              > I heard from someone else off-list that, due to the design of JUnit
              > runners, this almost certainly isn't going to work.
              >
              > All of the relevant code is part of an existing open source project,
              > and I can tell you how to reproduce the problem with that code.  Is
              > that sufficient?
              >
              > Or are you looking for a completely standalone project that demonstrates
              > the problem?
              >
              > I guess I'm not sure whether you're still confused about what it is I'm
              > trying to do, or whether you're sure it *should* work and you want a
              > reproducible test case so that you can debug it.  In the latter case,
              > how would you like me to deliver that?  (Note that my experience with
              > JUnit is limited.  For instance, I've only ever run it as part of a
              > maven project.)
              >
              >
              > David Saff wrote on 01/19/10 06:37 AM:
              >>
              >>
              >> Bill,
              >>
              >> Jens recently posted a helpful bug with Suite and Parameterized. It's
              >> possible the behavior you're seeing is related. Can you reduce your
              >> problem down to a small amount of code you can share? Thanks,
              >>
              >> David Saff
              >>
              >> On Thu, Jan 14, 2010 at 10:17 PM, Bill Shannon <Bill.Shannon@...
              >> <mailto:Bill.Shannon%40sun.com>> wrote:
              >>  > Anyone have any ideas?
              >>  >
              >>  > Bill Shannon wrote on 01/12/2010 11:04 AM:
              >>  >> The way I have it set up, MyTest1 and MyTest2 are not discovered by
              >>  >> the normal runner, so they never run by themselves.  But otherwise,
              >>  >> yes, MyTest1 does not run as part of MyTestSuite and MyTest2 does run
              >>  >> as part of MyTestSuite.
              >>  >>
              >>  >> Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it still
              >>  >> runs.
              >>  >>
              >>  >>
              >>  >> David Saff wrote on 01/11/10 06:32 PM:
              >>  >>>
              >>  >>>
              >>  >>> Bill,
              >>  >>>
              >>  >>> I would expect what you're trying to do to work if you and I both
              >>  >>> understand correctly how subclassing Suite works.
              >>  >>>
              >>  >>> So you're saying that if MyTest1 has RunWith(Parameterized), and
              >>  >>> MyTest2 does not, then:
              >>  >>>
              >>  >>> MyTest1 runs by itself
              >>  >>> MyTest2 runs by itself
              >>  >>> MyTest1 does not run as part of MyTestSuite
              >>  >>> MyTest2 does run as part of MyTestSuite
              >>  >>>
              >>  >>> Do I have that right? If so, what if MyTest2 is annotated with
              >>  >>> @RunWith(JUnit4.class) [which _should_ be a no-op?]
              >>  >>>
              >>  >>> David Saff
              >>  >>>
              >>  >>> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon <Bill.Shannon@...
              >> <mailto:Bill.Shannon%40sun.com>
              >>  >>> <mailto:Bill.Shannon%40sun.com>> wrote:
              >>  >>>  > I created a Suite that allows me to run tests in a separate class
              >>  >>> loader.
              >>  >>>  > I use it like this:
              >>  >>>  >
              >>  >>>  > @RunWith(ClassLoaderSuite.class)
              >>  >>>  > @SuiteClasses({ MyTest1.class, MyTest2.class })
              >>  >>>  > @TestClass(ClassToTest.class)
              >>  >>>  > public class MyTestSuite {
              >>  >>>  > }
              >>  >>>  >
              >>  >>>  > If I want one of those tests to be parameterized, should I expect to
              >>  >>>  > be able to do:
              >>  >>>  >
              >>  >>>  > @RunWith(Parameterized.class)
              >>  >>>  > public class MyTest1 {
              >>  >>>  > ...
              >>  >>>  > }
              >>  >>>  >
              >>  >>>  > It doesn't seem to work.
              >>  >>>  >
              >>  >>>  > What would I have to do in ClassLoaderSuite to make this work?
              >>  >>>  >
              >>  >>>  > FYI, you can find ClassLoaderSuite.java at:
              >>  >>>  >
              >>  >>>
              >> http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
              >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
              >>  >>>
              >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
              >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>
              >>  >>>
              >>  >>>  >
              >>  >>>  >
              >>  >>>  > ------------------------------------
              >>  >>>  >
              >>  >>>  > Yahoo! Groups Links
              >>  >>>  >
              >>  >>>  >
              >>  >>>  >
              >>  >>>  >
              >>  >>>
              >>  >>>
              >>  >>
              >>  >
              >>  >
              >>  >
              >>  > ------------------------------------
              >>  >
              >>  > Yahoo! Groups Links
              >>  >
              >>  >
              >>  >
              >>  >
              >>
              >>
              >
              >
              >
              > ------------------------------------
              >
              > Yahoo! Groups Links
              >
              >
              >
              >
            • Bill Shannon
              Ok, here s how I reproduced the problem using JavaMail. You can find JavaMail at http://kenai.com/projects/javamail. You ll need to check out the source code
              Message 6 of 12 , Jan 19, 2010
              View Source
              • 0 Attachment
                Ok, here's how I reproduced the problem using JavaMail.

                You can find JavaMail at http://kenai.com/projects/javamail.
                You'll need to check out the source code using Mercurial.
                You'll find instruction here:
                http://kenai.com/projects/javamail/pages/BuildInstructions

                Most of the tests are in the workspace at
                mail/src/test/java/javax/mail/internet.

                Here's what I did to test this...

                InternetAddressTest.java is a parameterized test. Copy it to IA.java,
                then change IA.java so that all instances of "InternetAddressTest"
                are changed to "IA". Edit the constructor or the data() method to
                include a println so you can see when the test is actually being run.

                ParameterListTestSuite.java uses my ClassLoaderSuite, and contains a
                list of tests to run in a separate class loader. Edit it and add
                IA.class to the list.

                Now run "mvn" in the "mail" directory. The IA.java test won't
                be run.

                Let me know if that's not clear enough, or if you have trouble reproducing
                it.

                Thanks for your help!


                David Saff wrote on 01/19/2010 07:02 PM:
                >
                >
                > Bill,
                >
                > Nothing you've said so far seems impossible, so I am indeed just
                > trying to replicate the bug you're facing, for debugging. Steps to
                > reproduce on open-source code are a great start. Thanks,
                >
                > David Saff
                >
                > On Tue, Jan 19, 2010 at 12:50 PM, Bill Shannon <Bill.Shannon@...
                > <mailto:Bill.Shannon%40sun.com>> wrote:
                > > I heard from someone else off-list that, due to the design of JUnit
                > > runners, this almost certainly isn't going to work.
                > >
                > > All of the relevant code is part of an existing open source project,
                > > and I can tell you how to reproduce the problem with that code. Is
                > > that sufficient?
                > >
                > > Or are you looking for a completely standalone project that demonstrates
                > > the problem?
                > >
                > > I guess I'm not sure whether you're still confused about what it is I'm
                > > trying to do, or whether you're sure it *should* work and you want a
                > > reproducible test case so that you can debug it. In the latter case,
                > > how would you like me to deliver that? (Note that my experience with
                > > JUnit is limited. For instance, I've only ever run it as part of a
                > > maven project.)
                > >
                > >
                > > David Saff wrote on 01/19/10 06:37 AM:
                > >>
                > >>
                > >> Bill,
                > >>
                > >> Jens recently posted a helpful bug with Suite and Parameterized. It's
                > >> possible the behavior you're seeing is related. Can you reduce your
                > >> problem down to a small amount of code you can share? Thanks,
                > >>
                > >> David Saff
                > >>
                > >> On Thu, Jan 14, 2010 at 10:17 PM, Bill Shannon <Bill.Shannon@...
                > <mailto:Bill.Shannon%40sun.com>
                > >> <mailto:Bill.Shannon%40sun.com>> wrote:
                > >> > Anyone have any ideas?
                > >> >
                > >> > Bill Shannon wrote on 01/12/2010 11:04 AM:
                > >> >> The way I have it set up, MyTest1 and MyTest2 are not discovered by
                > >> >> the normal runner, so they never run by themselves. But otherwise,
                > >> >> yes, MyTest1 does not run as part of MyTestSuite and MyTest2
                > does run
                > >> >> as part of MyTestSuite.
                > >> >>
                > >> >> Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it
                > still
                > >> >> runs.
                > >> >>
                > >> >>
                > >> >> David Saff wrote on 01/11/10 06:32 PM:
                > >> >>>
                > >> >>>
                > >> >>> Bill,
                > >> >>>
                > >> >>> I would expect what you're trying to do to work if you and I both
                > >> >>> understand correctly how subclassing Suite works.
                > >> >>>
                > >> >>> So you're saying that if MyTest1 has RunWith(Parameterized), and
                > >> >>> MyTest2 does not, then:
                > >> >>>
                > >> >>> MyTest1 runs by itself
                > >> >>> MyTest2 runs by itself
                > >> >>> MyTest1 does not run as part of MyTestSuite
                > >> >>> MyTest2 does run as part of MyTestSuite
                > >> >>>
                > >> >>> Do I have that right? If so, what if MyTest2 is annotated with
                > >> >>> @RunWith(JUnit4.class) [which _should_ be a no-op?]
                > >> >>>
                > >> >>> David Saff
                > >> >>>
                > >> >>> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon
                > <Bill.Shannon@... <mailto:Bill.Shannon%40sun.com>
                > >> <mailto:Bill.Shannon%40sun.com>
                > >> >>> <mailto:Bill.Shannon%40sun.com>> wrote:
                > >> >>> > I created a Suite that allows me to run tests in a separate
                > class
                > >> >>> loader.
                > >> >>> > I use it like this:
                > >> >>> >
                > >> >>> > @RunWith(ClassLoaderSuite.class)
                > >> >>> > @SuiteClasses({ MyTest1.class, MyTest2.class })
                > >> >>> > @TestClass(ClassToTest.class)
                > >> >>> > public class MyTestSuite {
                > >> >>> > }
                > >> >>> >
                > >> >>> > If I want one of those tests to be parameterized, should I
                > expect to
                > >> >>> > be able to do:
                > >> >>> >
                > >> >>> > @RunWith(Parameterized.class)
                > >> >>> > public class MyTest1 {
                > >> >>> > ...
                > >> >>> > }
                > >> >>> >
                > >> >>> > It doesn't seem to work.
                > >> >>> >
                > >> >>> > What would I have to do in ClassLoaderSuite to make this work?
                > >> >>> >
                > >> >>> > FYI, you can find ClassLoaderSuite.java at:
                > >> >>> >
                > >> >>>
                > >>
                > http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                > >>
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>
                > >> >>>
                > >>
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                > >>
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>>
                > >> >>>
                > >> >>> >
                > >> >>> >
                > >> >>> > ------------------------------------
                > >> >>> >
                > >> >>> > Yahoo! Groups Links
                > >> >>> >
                > >> >>> >
                > >> >>> >
                > >> >>> >
                > >> >>>
                > >> >>>
                > >> >>
                > >> >
                > >> >
                > >> >
                > >> > ------------------------------------
                > >> >
                > >> > Yahoo! Groups Links
                > >> >
                > >> >
                > >> >
                > >> >
                > >>
                > >>
                > >
                > >
                > >
                > > ------------------------------------
                > >
                > > Yahoo! Groups Links
                > >
                > >
                > >
                > >
                >
                >
              • David Saff
                Bill, Thanks for that. Can you also create a bug to track it at github? I ll try to take a deeper look soon. David Saff
                Message 7 of 12 , Jan 20, 2010
                View Source
                • 0 Attachment
                  Bill,

                  Thanks for that. Can you also create a bug to track it at github?
                  I'll try to take a deeper look soon.

                  David Saff

                  On Tue, Jan 19, 2010 at 11:00 PM, Bill Shannon <Bill.Shannon@...> wrote:
                  > Ok, here's how I reproduced the problem using JavaMail.
                  >
                  > You can find JavaMail at http://kenai.com/projects/javamail.
                  > You'll need to check out the source code using Mercurial.
                  > You'll find instruction here:
                  > http://kenai.com/projects/javamail/pages/BuildInstructions
                  >
                  > Most of the tests are in the workspace at
                  > mail/src/test/java/javax/mail/internet.
                  >
                  > Here's what I did to test this...
                  >
                  > InternetAddressTest.java is a parameterized test.  Copy it to IA.java,
                  > then change IA.java so that all instances of "InternetAddressTest"
                  > are changed to "IA".  Edit the constructor or the data() method to
                  > include a println so you can see when the test is actually being run.
                  >
                  > ParameterListTestSuite.java uses my ClassLoaderSuite, and contains a
                  > list of tests to run in a separate class loader.  Edit it and add
                  > IA.class to the list.
                  >
                  > Now run "mvn" in the "mail" directory.  The IA.java test won't
                  > be run.
                  >
                  > Let me know if that's not clear enough, or if you have trouble reproducing
                  > it.
                  >
                  > Thanks for your help!
                  >
                  >
                  > David Saff wrote on 01/19/2010 07:02 PM:
                  >>
                  >>
                  >> Bill,
                  >>
                  >> Nothing you've said so far seems impossible, so I am indeed just
                  >> trying to replicate the bug you're facing, for debugging. Steps to
                  >> reproduce on open-source code are a great start. Thanks,
                  >>
                  >> David Saff
                  >>
                  >> On Tue, Jan 19, 2010 at 12:50 PM, Bill Shannon <Bill.Shannon@...
                  >> <mailto:Bill.Shannon%40sun.com>> wrote:
                  >>  > I heard from someone else off-list that, due to the design of JUnit
                  >>  > runners, this almost certainly isn't going to work.
                  >>  >
                  >>  > All of the relevant code is part of an existing open source project,
                  >>  > and I can tell you how to reproduce the problem with that code.  Is
                  >>  > that sufficient?
                  >>  >
                  >>  > Or are you looking for a completely standalone project that demonstrates
                  >>  > the problem?
                  >>  >
                  >>  > I guess I'm not sure whether you're still confused about what it is I'm
                  >>  > trying to do, or whether you're sure it *should* work and you want a
                  >>  > reproducible test case so that you can debug it.  In the latter case,
                  >>  > how would you like me to deliver that?  (Note that my experience with
                  >>  > JUnit is limited.  For instance, I've only ever run it as part of a
                  >>  > maven project.)
                  >>  >
                  >>  >
                  >>  > David Saff wrote on 01/19/10 06:37 AM:
                  >>  >>
                  >>  >>
                  >>  >> Bill,
                  >>  >>
                  >>  >> Jens recently posted a helpful bug with Suite and Parameterized. It's
                  >>  >> possible the behavior you're seeing is related. Can you reduce your
                  >>  >> problem down to a small amount of code you can share? Thanks,
                  >>  >>
                  >>  >> David Saff
                  >>  >>
                  >>  >> On Thu, Jan 14, 2010 at 10:17 PM, Bill Shannon <Bill.Shannon@...
                  >> <mailto:Bill.Shannon%40sun.com>
                  >>  >> <mailto:Bill.Shannon%40sun.com>> wrote:
                  >>  >>  > Anyone have any ideas?
                  >>  >>  >
                  >>  >>  > Bill Shannon wrote on 01/12/2010 11:04 AM:
                  >>  >>  >> The way I have it set up, MyTest1 and MyTest2 are not discovered by
                  >>  >>  >> the normal runner, so they never run by themselves.  But otherwise,
                  >>  >>  >> yes, MyTest1 does not run as part of MyTestSuite and MyTest2
                  >> does run
                  >>  >>  >> as part of MyTestSuite.
                  >>  >>  >>
                  >>  >>  >> Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it
                  >> still
                  >>  >>  >> runs.
                  >>  >>  >>
                  >>  >>  >>
                  >>  >>  >> David Saff wrote on 01/11/10 06:32 PM:
                  >>  >>  >>>
                  >>  >>  >>>
                  >>  >>  >>> Bill,
                  >>  >>  >>>
                  >>  >>  >>> I would expect what you're trying to do to work if you and I both
                  >>  >>  >>> understand correctly how subclassing Suite works.
                  >>  >>  >>>
                  >>  >>  >>> So you're saying that if MyTest1 has RunWith(Parameterized), and
                  >>  >>  >>> MyTest2 does not, then:
                  >>  >>  >>>
                  >>  >>  >>> MyTest1 runs by itself
                  >>  >>  >>> MyTest2 runs by itself
                  >>  >>  >>> MyTest1 does not run as part of MyTestSuite
                  >>  >>  >>> MyTest2 does run as part of MyTestSuite
                  >>  >>  >>>
                  >>  >>  >>> Do I have that right? If so, what if MyTest2 is annotated with
                  >>  >>  >>> @RunWith(JUnit4.class) [which _should_ be a no-op?]
                  >>  >>  >>>
                  >>  >>  >>> David Saff
                  >>  >>  >>>
                  >>  >>  >>> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon
                  >> <Bill.Shannon@... <mailto:Bill.Shannon%40sun.com>
                  >>  >> <mailto:Bill.Shannon%40sun.com>
                  >>  >>  >>> <mailto:Bill.Shannon%40sun.com>> wrote:
                  >>  >>  >>>  > I created a Suite that allows me to run tests in a separate
                  >> class
                  >>  >>  >>> loader.
                  >>  >>  >>>  > I use it like this:
                  >>  >>  >>>  >
                  >>  >>  >>>  > @RunWith(ClassLoaderSuite.class)
                  >>  >>  >>>  > @SuiteClasses({ MyTest1.class, MyTest2.class })
                  >>  >>  >>>  > @TestClass(ClassToTest.class)
                  >>  >>  >>>  > public class MyTestSuite {
                  >>  >>  >>>  > }
                  >>  >>  >>>  >
                  >>  >>  >>>  > If I want one of those tests to be parameterized, should I
                  >> expect to
                  >>  >>  >>>  > be able to do:
                  >>  >>  >>>  >
                  >>  >>  >>>  > @RunWith(Parameterized.class)
                  >>  >>  >>>  > public class MyTest1 {
                  >>  >>  >>>  > ...
                  >>  >>  >>>  > }
                  >>  >>  >>>  >
                  >>  >>  >>>  > It doesn't seem to work.
                  >>  >>  >>>  >
                  >>  >>  >>>  > What would I have to do in ClassLoaderSuite to make this work?
                  >>  >>  >>>  >
                  >>  >>  >>>  > FYI, you can find ClassLoaderSuite.java at:
                  >>  >>  >>>  >
                  >>  >>  >>>
                  >>  >>
                  >> http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                  >>  >>
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>
                  >>  >>  >>>
                  >>  >>
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                  >>  >>
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                  >> <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>>
                  >>  >>  >>>
                  >>  >>  >>>  >
                  >>  >>  >>>  >
                  >>  >>  >>>  > ------------------------------------
                  >>  >>  >>>  >
                  >>  >>  >>>  > Yahoo! Groups Links
                  >>  >>  >>>  >
                  >>  >>  >>>  >
                  >>  >>  >>>  >
                  >>  >>  >>>  >
                  >>  >>  >>>
                  >>  >>  >>>
                  >>  >>  >>
                  >>  >>  >
                  >>  >>  >
                  >>  >>  >
                  >>  >>  > ------------------------------------
                  >>  >>  >
                  >>  >>  > Yahoo! Groups Links
                  >>  >>  >
                  >>  >>  >
                  >>  >>  >
                  >>  >>  >
                  >>  >>
                  >>  >>
                  >>  >
                  >>  >
                  >>  >
                  >>  > ------------------------------------
                  >>  >
                  >>  > Yahoo! Groups Links
                  >>  >
                  >>  >
                  >>  >
                  >>  >
                  >>
                  >>
                  >
                  >
                  >
                  > ------------------------------------
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                • Bill Shannon
                  Done. http://github.com/KentBeck/junit/issues/issue/73
                  Message 8 of 12 , Jan 20, 2010
                  View Source
                  • 0 Attachment
                    Done. http://github.com/KentBeck/junit/issues/issue/73

                    David Saff wrote on 01/20/2010 06:02 AM:
                    >
                    >
                    > Bill,
                    >
                    > Thanks for that. Can you also create a bug to track it at github?
                    > I'll try to take a deeper look soon.
                    >
                    > David Saff
                    >
                    > On Tue, Jan 19, 2010 at 11:00 PM, Bill Shannon <Bill.Shannon@...
                    > <mailto:Bill.Shannon%40sun.com>> wrote:
                    > > Ok, here's how I reproduced the problem using JavaMail.
                    > >
                    > > You can find JavaMail at http://kenai.com/projects/javamail.
                    > <http://kenai.com/projects/javamail.>
                    > > You'll need to check out the source code using Mercurial.
                    > > You'll find instruction here:
                    > > http://kenai.com/projects/javamail/pages/BuildInstructions
                    > <http://kenai.com/projects/javamail/pages/BuildInstructions>
                    > >
                    > > Most of the tests are in the workspace at
                    > > mail/src/test/java/javax/mail/internet.
                    > >
                    > > Here's what I did to test this...
                    > >
                    > > InternetAddressTest.java is a parameterized test. Copy it to IA.java,
                    > > then change IA.java so that all instances of "InternetAddressTest"
                    > > are changed to "IA". Edit the constructor or the data() method to
                    > > include a println so you can see when the test is actually being run.
                    > >
                    > > ParameterListTestSuite.java uses my ClassLoaderSuite, and contains a
                    > > list of tests to run in a separate class loader. Edit it and add
                    > > IA.class to the list.
                    > >
                    > > Now run "mvn" in the "mail" directory. The IA.java test won't
                    > > be run.
                    > >
                    > > Let me know if that's not clear enough, or if you have trouble
                    > reproducing
                    > > it.
                    > >
                    > > Thanks for your help!
                    > >
                    > >
                    > > David Saff wrote on 01/19/2010 07:02 PM:
                    > >>
                    > >>
                    > >> Bill,
                    > >>
                    > >> Nothing you've said so far seems impossible, so I am indeed just
                    > >> trying to replicate the bug you're facing, for debugging. Steps to
                    > >> reproduce on open-source code are a great start. Thanks,
                    > >>
                    > >> David Saff
                    > >>
                    > >> On Tue, Jan 19, 2010 at 12:50 PM, Bill Shannon <Bill.Shannon@...
                    > <mailto:Bill.Shannon%40sun.com>
                    > >> <mailto:Bill.Shannon%40sun.com>> wrote:
                    > >> > I heard from someone else off-list that, due to the design of JUnit
                    > >> > runners, this almost certainly isn't going to work.
                    > >> >
                    > >> > All of the relevant code is part of an existing open source project,
                    > >> > and I can tell you how to reproduce the problem with that code. Is
                    > >> > that sufficient?
                    > >> >
                    > >> > Or are you looking for a completely standalone project that
                    > demonstrates
                    > >> > the problem?
                    > >> >
                    > >> > I guess I'm not sure whether you're still confused about what it
                    > is I'm
                    > >> > trying to do, or whether you're sure it *should* work and you want a
                    > >> > reproducible test case so that you can debug it. In the latter case,
                    > >> > how would you like me to deliver that? (Note that my experience with
                    > >> > JUnit is limited. For instance, I've only ever run it as part of a
                    > >> > maven project.)
                    > >> >
                    > >> >
                    > >> > David Saff wrote on 01/19/10 06:37 AM:
                    > >> >>
                    > >> >>
                    > >> >> Bill,
                    > >> >>
                    > >> >> Jens recently posted a helpful bug with Suite and Parameterized.
                    > It's
                    > >> >> possible the behavior you're seeing is related. Can you reduce your
                    > >> >> problem down to a small amount of code you can share? Thanks,
                    > >> >>
                    > >> >> David Saff
                    > >> >>
                    > >> >> On Thu, Jan 14, 2010 at 10:17 PM, Bill Shannon
                    > <Bill.Shannon@... <mailto:Bill.Shannon%40sun.com>
                    > >> <mailto:Bill.Shannon%40sun.com>
                    > >> >> <mailto:Bill.Shannon%40sun.com>> wrote:
                    > >> >> > Anyone have any ideas?
                    > >> >> >
                    > >> >> > Bill Shannon wrote on 01/12/2010 11:04 AM:
                    > >> >> >> The way I have it set up, MyTest1 and MyTest2 are not
                    > discovered by
                    > >> >> >> the normal runner, so they never run by themselves. But
                    > otherwise,
                    > >> >> >> yes, MyTest1 does not run as part of MyTestSuite and MyTest2
                    > >> does run
                    > >> >> >> as part of MyTestSuite.
                    > >> >> >>
                    > >> >> >> Adding @RunWith(JUnit4.class) to MyTest2 makes no difference, it
                    > >> still
                    > >> >> >> runs.
                    > >> >> >>
                    > >> >> >>
                    > >> >> >> David Saff wrote on 01/11/10 06:32 PM:
                    > >> >> >>>
                    > >> >> >>>
                    > >> >> >>> Bill,
                    > >> >> >>>
                    > >> >> >>> I would expect what you're trying to do to work if you and
                    > I both
                    > >> >> >>> understand correctly how subclassing Suite works.
                    > >> >> >>>
                    > >> >> >>> So you're saying that if MyTest1 has
                    > RunWith(Parameterized), and
                    > >> >> >>> MyTest2 does not, then:
                    > >> >> >>>
                    > >> >> >>> MyTest1 runs by itself
                    > >> >> >>> MyTest2 runs by itself
                    > >> >> >>> MyTest1 does not run as part of MyTestSuite
                    > >> >> >>> MyTest2 does run as part of MyTestSuite
                    > >> >> >>>
                    > >> >> >>> Do I have that right? If so, what if MyTest2 is annotated with
                    > >> >> >>> @RunWith(JUnit4.class) [which _should_ be a no-op?]
                    > >> >> >>>
                    > >> >> >>> David Saff
                    > >> >> >>>
                    > >> >> >>> On Mon, Jan 11, 2010 at 4:20 PM, Bill Shannon
                    > >> <Bill.Shannon@... <mailto:Bill.Shannon%40sun.com>
                    > <mailto:Bill.Shannon%40sun.com>
                    > >> >> <mailto:Bill.Shannon%40sun.com>
                    > >> >> >>> <mailto:Bill.Shannon%40sun.com>> wrote:
                    > >> >> >>> > I created a Suite that allows me to run tests in a separate
                    > >> class
                    > >> >> >>> loader.
                    > >> >> >>> > I use it like this:
                    > >> >> >>> >
                    > >> >> >>> > @RunWith(ClassLoaderSuite.class)
                    > >> >> >>> > @SuiteClasses({ MyTest1.class, MyTest2.class })
                    > >> >> >>> > @TestClass(ClassToTest.class)
                    > >> >> >>> > public class MyTestSuite {
                    > >> >> >>> > }
                    > >> >> >>> >
                    > >> >> >>> > If I want one of those tests to be parameterized, should I
                    > >> expect to
                    > >> >> >>> > be able to do:
                    > >> >> >>> >
                    > >> >> >>> > @RunWith(Parameterized.class)
                    > >> >> >>> > public class MyTest1 {
                    > >> >> >>> > ...
                    > >> >> >>> > }
                    > >> >> >>> >
                    > >> >> >>> > It doesn't seem to work.
                    > >> >> >>> >
                    > >> >> >>> > What would I have to do in ClassLoaderSuite to make this
                    > work?
                    > >> >> >>> >
                    > >> >> >>> > FYI, you can find ClassLoaderSuite.java at:
                    > >> >> >>> >
                    > >> >> >>>
                    > >> >>
                    > >>
                    > http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>
                    > >> >>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>>
                    > >> >> >>>
                    > >> >>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>
                    > >> >>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>
                    > >>
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231
                    > <http://kenai.com/projects/javamail/sources/mercurial/content/mail/src/test/java/com/sun/mail/test/ClassLoaderSuite.java?rev=231>>>>
                    > >> >> >>>
                    > >> >> >>> >
                    > >> >> >>> >
                    > >> >> >>> > ------------------------------------
                    > >> >> >>> >
                    > >> >> >>> > Yahoo! Groups Links
                    > >> >> >>> >
                    > >> >> >>> >
                    > >> >> >>> >
                    > >> >> >>> >
                    > >> >> >>>
                    > >> >> >>>
                    > >> >> >>
                    > >> >> >
                    > >> >> >
                    > >> >> >
                    > >> >> > ------------------------------------
                    > >> >> >
                    > >> >> > Yahoo! Groups Links
                    > >> >> >
                    > >> >> >
                    > >> >> >
                    > >> >> >
                    > >> >>
                    > >> >>
                    > >> >
                    > >> >
                    > >> >
                    > >> > ------------------------------------
                    > >> >
                    > >> > Yahoo! Groups Links
                    > >> >
                    > >> >
                    > >> >
                    > >> >
                    > >>
                    > >>
                    > >
                    > >
                    > >
                    > > ------------------------------------
                    > >
                    > > Yahoo! Groups Links
                    > >
                    > >
                    > >
                    > >
                    >
                    >
                  Your message has been successfully submitted and would be delivered to recipients shortly.