You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Karan Malhi <ka...@gmail.com> on 2010/07/15 15:21:36 UTC

Running all tests in a package

Is it possible to only run all tests contained in a specific package?

-- 
Karan Singh Malhi

Re: Running all tests in a package

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Jul 15, 2010 at 9:46 AM, Karan Malhi <ka...@gmail.com> wrote:
> I did try the naming pattern, something like
> mvn test -Dtest=Check*
> However, I have inner classes in my test cases and some of them start with
> the word Check. Surefire starts thinking that the inner class is also a test
> case and errors out because it cannot find a test method to run

If you want to dig into the source, it probably wouldn't be too hard
to add another parameter like -DtestPkg=..., or to modify the
-Dtest=... one to understand a different pattern that means match on a
package.  -Dtest=pkg:org.example.stuff .

See if there's already something in JIRA, if not you can add it and
then post to the dev list to discuss it with the developers to see if
they'd be receptive to such a patch.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Running all tests in a package

Posted by Karan Malhi <ka...@gmail.com>.
Thanks Wendy,

I did try the naming pattern, something like
mvn test -Dtest=Check*
However, I have inner classes in my test cases and some of them start with
the word Check. Surefire starts thinking that the inner class is also a test
case and errors out because it cannot find a test method to run

On Thu, Jul 15, 2010 at 9:29 AM, Wendy Smoak <ws...@gmail.com> wrote:

> On Thu, Jul 15, 2010 at 9:21 AM, Karan Malhi <ka...@gmail.com>
> wrote:
> > Is it possible to only run all tests contained in a specific package?
>
> You can configure includes/excludes in the Surefire plugin.
>
> http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html
>
> I guess you want to do this on the command line though.  I'm only
> aware of -Dtest=... which iirc matches on the class, not the package.
>
> http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html
>  I suppose if you had a naming pattern per package you could get them
> that way.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Karan Singh Malhi

Re: Running all tests in a package

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Jul 15, 2010 at 9:21 AM, Karan Malhi <ka...@gmail.com> wrote:
> Is it possible to only run all tests contained in a specific package?

You can configure includes/excludes in the Surefire plugin.
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html

I guess you want to do this on the command line though.  I'm only
aware of -Dtest=... which iirc matches on the class, not the package.
http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html
 I suppose if you had a naming pattern per package you could get them
that way.

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org