Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 273481070B for ; Fri, 18 Oct 2013 18:12:40 +0000 (UTC) Received: (qmail 47070 invoked by uid 500); 18 Oct 2013 18:12:37 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 46233 invoked by uid 500); 18 Oct 2013 18:12:30 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 46209 invoked by uid 99); 18 Oct 2013 18:12:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 18:12:28 +0000 X-ASF-Spam-Status: No, hits=3.3 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,TRACKER_ID X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [206.46.173.1] (HELO vms173001pub.verizon.net) (206.46.173.1) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 18:12:22 +0000 Received: from gold-family.us ([unknown] [96.245.192.29]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0MUV00328MJ7JOF1@vms173001.mailsrvcs.net> for users@maven.apache.org; Fri, 18 Oct 2013 13:11:32 -0500 (CDT) Received: from durendal.home (durendal.home [192.168.1.8]) by gold-family.us (Postfix) with ESMTP id DDAFC11D115E for ; Fri, 18 Oct 2013 14:17:40 -0400 (EDT) From: Russell Gold Content-type: multipart/alternative; boundary="Apple-Mail=_F222C2F1-D27B-4733-BA24-40A53C3DDBEA" Message-id: <17C71EDE-5AC5-46D2-B5F3-BDD519FD218A@gold-family.us> MIME-version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: Maven: How can I run/include a class in a jar with the failsafe plugin? Date: Fri, 18 Oct 2013 14:11:30 -0400 References: <0FE8B62D-A8BE-4620-BF05-2B0E1E0F0E91@gold-family.us> <78CE45F5-30F6-4DDA-8407-EE35C61D0864@gold-family.us> To: "Maven Users List" In-reply-to: X-Mailer: Apple Mail (2.1510) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_F222C2F1-D27B-4733-BA24-40A53C3DDBEA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii It should be looking in the class path, not the file system. On Oct 18, 2013, at 12:42 PM, Dan Kaplan wrote: > I tried using that, but it "didn't work". Probably because "includes" > still looks on the file system? >=20 >=20 > On Thu, Oct 17, 2013 at 11:10 PM, Andreas Gudian > wrote: >=20 >> Check the "dependenciesToScan" property in the latest Failsafe = version. It >> tells the plugin to scan for the test class patterns in the specified >> artifacts. >>=20 >>=20 >> Am Freitag, 18. Oktober 2013 schrieb Dan Kaplan : >>=20 >>> 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. >>>=20 >>>=20 >>> On Thu, Oct 17, 2013 at 4:58 PM, Dan Kaplan = wrote: >>>=20 >>>> RunWith: >>>>=20 >>>> * When a class is annotated with @RunWith or >> extends a >>>> class annotated >>>> * with @RunWith, 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 >>>>=20 >>>> AllTests: >>>>=20 >>>> Runner for use with JUnit 3.8.x-style AllTests classes >>>> * (those that only implement a static suite() >>>> * method). For example: >>>> *
>>>> * @RunWith(AllTests.class)
>>>> * public class ProductTests {
>>>> *    public static junit.framework.Test suite() {
>>>> *       ...
>>>> *    }
>>>> * }
>>>>=20
>>>> 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:
>>>>=20
>>>> @RunWith(AllTests.class)
>>>> public class DistributedIntegrationTestRunner {
>>>>=20
>>>>    private static Logger log =3D
>>>> LoggerFactory.getLogger(DistributedIntegrationTestRunner.class);
>>>>=20
>>>>    public static TestSuite suite() {
>>>>        TestSuite suite =3D new TestSuite();
>>>>=20
>>>>        ClassesFinder classesFinder =3D new
>>>> ClasspathFinderFactory().create(true,
>>>>                new String[]{".*IntegrationTest.*"},
>>>>                new SuiteType[]{SuiteType.TEST_CLASSES},
>>>>                new Class[]{Object.class},
>>>>                new Class[]{},
>>>>                "java.class.path");
>>>>=20
>>>>        int nodeNumber =3D systemPropertyInteger("node.number", =
"0");
>>>>        int totalNodes =3D systemPropertyInteger("total.nodes", =
"1");
>>>>=20
>>>>        List> allTestsSorted =3D
>> getAllTestsSorted(classesFinder);
>>>>        allTestsSorted =3D filterIgnoredTests(allTestsSorted);
>>>>        List> myTests =3D 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));
>>>>        }
>>>>=20
>>>>        return suite;
>>>>    }
>>>>=20
>>>>=20
>>>> 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.
>>>>=20
>>>> *If* this class is in the same project as the rest of the =
integration
>>>> tests, I can put this in the pom.xml:
>>>>=20
>>>>            >=20
>=20
>=20
>=20
> --=20
> Thanks,
> Dan
>=20
> --=20
> CONFIDENTIALITY NOTICE: The information contained in this electronic=20=

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

-----------------
Author, Getting Started with Apache Maven =


Come read my webnovel, Take a Lemon ,=20
and listen to the Misfile radio play =
!








--Apple-Mail=_F222C2F1-D27B-4733-BA24-40A53C3DDBEA--