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 Thu, 17 Oct 2013 23:09:53 GMT
The reason is that I want this suite to be reusable.  Its purpose is to
allow different servers to run different integration tests based on the
system properties given when it runs.  It was inspired by this article:
http://blog.tradeshift.com/just-add-servers/

All it does is look for all the integration testss and runs a portion of
them.  This functionality needs to be reused in many projects that have
long running integration tests.


On Thu, Oct 17, 2013 at 3:51 PM, Russell Gold <russ@gold-family.us> wrote:

> OK, so you're doing something a bit unusual - is there some particular
> reason that you are not compiling these tests in the project where you want
> to run them? That's the usual way, and everything is set up to work with
> that assumption.
>
> But if your tests are built separately by another maven project, all you
> need to do is make the jar that contains the test into a test dependency of
> the project where you want to run it.
>
>
> On Oct 17, 2013, at 6:36 PM, Dan Kaplan <dank@mirthcorp.com> wrote:
>
> > Yeah this is a JUnit annotation.
> > http://junit.sourceforge.net/javadoc/org/junit/runner/RunWith.html  I am
> > passing in
> > http://junit.sourceforge.net/javadoc/org/junit/runners/AllTests.htmlinto
> > that annotation.  org.junit.runners.AllTests is a test runner.  It calls
> > the suite() method on the pojo I've created.  I'm trying to figure out
> how
> > to say, "run this suite" in maven even though the class is in a jar.  I
> > only want to run this suite.  But "includes" only lets me specify file
> > patterns instead of classpath patterns, as far as I can tell.
> >
> >
> >
> >
> > On Thu, Oct 17, 2013 at 3:20 PM, Russell Gold <russ@gold-family.us>
> wrote:
> >
> >> Hi Dan,
> >>
> >> Is this the JUnit annotation, that you mean? And your tests use it to
> >> refer to a test runner?
> >>
> >> Your description is a bit confusing, since in JUnit, you use the
> @RunWith
> >> annotation on a test class to refer to another class which IS a test
> >> runner. You don't annotate a POJO with it, as far as I can tell.
> >>
> >> Now if you do mean a test runner that your test classes are referring
> to,
> >> you just need to make it  a maven artifact and add it to your test
> >> dependencies.
> >>
> >> Regards,
> >> Russ
> >>
> >> On Oct 17, 2013, at 4:49 PM, Dan Kaplan <dank@mirthcorp.com> wrote:
> >>
> >>> Minor correction:  This isn't a test runner, but a pojo with the
> @RunWith
> >>> annotation on it.
> >>>
> >>>
> >>> On Thu, Oct 17, 2013 at 1:23 PM, Dan Kaplan <dank@mirthcorp.com>
> wrote:
> >>>
> >>>> I've made my own test runner for integration tests that I want to
> >> execute,
> >>>> but I've put it in a reusable jar.  I'm trying to tell failsafe to use
> >> it
> >>>> but I'm not sure how to because [the documentation for includes][1]
> >> says:
> >>>>
> >>>>> A list of <include> elements specifying the tests (by pattern)
that
> >>>> should be included in testing. When not specified and when the test
> >>>> parameter is not specified, the default includes will be
> >>>>
> >>>>>   <includes>
> >>>>    <include>**/IT*.java</include>
> >>>>    <include>**/*IT.java</include>
> >>>>    <include>**/*ITCase.java</include>
> >>>>   </includes>
> >>>>
> >>>>> Each include item may also contain a comma-separated sublist of
> items,
> >>>> which will be treated as multiple  <include> entries.
> >>>>   This parameter is ignored if the TestNG suiteXmlFiles parameter is
> >>>> specified.
> >>>>
> >>>> But this test runner is in the classpath, not on the filesystem.  How
> >> can
> >>>> I tell failsafe to use my class runner and only my class runner?
> >>>>
> >>>> [1]:
> >>>>
> >>
> http://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#includes
> >>>>
> >>>> --
> >>>> Thanks,
> >>>> Dan
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> 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.
> >>
> >> -----------------
> >> Author, Getting Started with Apache Maven <
> >> http://www.packtpub.com/getting-started-with-apache-maven/video>
> >>
> >> Come read my webnovel, Take a Lemon <http://www.takealemon.com>,
> >> and listen to the Misfile radio play <
> >> http://www.fuzzyfacetheater.com/misfile/>!
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> > --
> > 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.
>
> -----------------
> Author, Getting Started with Apache Maven <
> http://www.packtpub.com/getting-started-with-apache-maven/video>
>
> Come read my webnovel, Take a Lemon <http://www.takealemon.com>,
> and listen to the Misfile radio play <
> http://www.fuzzyfacetheater.com/misfile/>!
>
>
>
>
>
>
>
>


-- 
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