maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Kaplan <d...@mirthcorp.com>
Subject Re: Maven: How can I run/include a class in a jar with the failsafe plugin?
Date Fri, 18 Oct 2013 16:42:11 GMT
I tried using that, but it "didn't work".  Probably because "includes"
still looks on the file system?


On Thu, Oct 17, 2013 at 11:10 PM, Andreas Gudian
<andreas.gudian@gmail.com>wrote:

> Check the "dependenciesToScan" property in the latest Failsafe version. It
> tells the plugin to scan for the test class patterns in the specified
> artifacts.
>
>
> Am Freitag, 18. Oktober 2013 schrieb Dan Kaplan :
>
> > I've found an "ok" solution.  I just extend the class in the module I
> plan
> > to run the tests in and include the child.  It works the way I want.
> >
> >
> > On Thu, Oct 17, 2013 at 4:58 PM, Dan Kaplan <dank@mirthcorp.com> wrote:
> >
> > > RunWith:
> > >
> > >  * When a class is annotated with <code>&#064;RunWith</code>
or
> extends a
> > > class annotated
> > >  * with <code>&#064;RunWith</code>, JUnit will invoke the class
it
> > > references to run the
> > >  * tests in that class instead of the runner built into JUnit. We added
> > > this feature late
> > >  * in development. While it seems powerful we expect the runner API to
> > > change as we learn
> > >  * how people really use it. Some of the classes that are currently
> > > internal will likely
> > >  * be refined and become public.
> > >  *
> > >  * For example, suites in JUnit 4 are built using RunWith, and a custom
> > > runner named Suite
> > >
> > > AllTests:
> > >
> > > Runner for use with JUnit 3.8.x-style AllTests classes
> > >  * (those that only implement a static <code>suite()</code>
> > >  * method). For example:
> > >  * <pre>
> > >  * &#064;RunWith(AllTests.class)
> > >  * public class ProductTests {
> > >  *    public static junit.framework.Test suite() {
> > >  *       ...
> > >  *    }
> > >  * }
> > >
> > > So this class will use AllTests as a runner.  All tests will call the
> > > suite() method on this class.  The suite() method collects integration
> > > tests from the classpath and runs them.  I'm sorry I'm not answering
> > > directly, but I can't because I don't know what terminology to use.
>  I'll
> > > show you some of the code:
> > >
> > > @RunWith(AllTests.class)
> > > public class DistributedIntegrationTestRunner {
> > >
> > >     private static Logger log =
> > > LoggerFactory.getLogger(DistributedIntegrationTestRunner.class);
> > >
> > >     public static TestSuite suite() {
> > >         TestSuite suite = new TestSuite();
> > >
> > >         ClassesFinder classesFinder = new
> > > ClasspathFinderFactory().create(true,
> > >                 new String[]{".*IntegrationTest.*"},
> > >                 new SuiteType[]{SuiteType.TEST_CLASSES},
> > >                 new Class[]{Object.class},
> > >                 new Class[]{},
> > >                 "java.class.path");
> > >
> > >         int nodeNumber = systemPropertyInteger("node.number", "0");
> > >         int totalNodes = systemPropertyInteger("total.nodes", "1");
> > >
> > >         List<Class<?>> allTestsSorted =
> getAllTestsSorted(classesFinder);
> > >         allTestsSorted = filterIgnoredTests(allTestsSorted);
> > >         List<Class<?>> myTests = getMyTests(allTestsSorted, nodeNumber,
> > > totalNodes);
> > >         log.info("There are " + allTestsSorted.size() + " tests to
> > choose
> > > from and I'm going to run " + myTests.size() + " of them.");
> > >         for (Class<?> myTest : myTests) {
> > >             log.info("I will run " + myTest.getName());
> > >             suite.addTest(new JUnit4TestAdapter(myTest));
> > >         }
> > >
> > >         return suite;
> > >     }
> > >
> > >
> > > None of my tests use the @RunWith annotation, only this class does.  I
> > > don't think I can add that to the tests because
> > DistributedIntegrationTestRunner
> > > does not implement Runner so the code won't compile if I put
> > > @RunWith(DistributedIntegrationTestRunner.class) on a test.  Even if it
> > > would work, I don't want to have to put that annotation on every test
> > > because someone will forget and their tests will be silently skipped.
> > >
> > > *If* this class is in the same project as the rest of the integration
> > > tests, I can put this in the pom.xml:
> > >
> > >             <plugi
>



-- 
Thanks,
Dan

-- 
CONFIDENTIALITY NOTICE: The information contained in this electronic 
transmission may be confidential. If you are not an intended recipient, be 
aware that any disclosure, copying, distribution or use of the information 
contained in this transmission is prohibited and may be unlawful. If you 
have received this transmission in error, please notify us by email reply 
and then erase it from your computer system.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message