You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lisa <ap...@purpleblade.net> on 2007/01/28 02:05:51 UTC

how to skip all tests but still run explicitly

I want to turn off all tests for a project but still be able to force a run
for all tests in a single class file by using a param on the mvn command
line but can not figure out how to do this.

I edited the pom.xml and specified to turn off all tests, however when I
type:


mvn -Dtest=BootStrapTest clean test

the test does not run.  I explicitly told it to run all tests in
BootStrapTest, but apparently this does not override all the
<skip>true</true> attrib.  

Is there a way to override the <skip> while running maven from the command
line?

Here is my <build> section
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                    <useFile>false</useFile>
                </configuration>
            </plugin>
        </plugins>
    </build>

any help would be greatly appreciated.


Lisa
-- 
View this message in context: http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8671878
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: how to skip all tests but still run explicitly

Posted by Lisa <ap...@purpleblade.net>.
If you have examples of how to create a profile (inside the pom itself) and
specify this profile on the command line, it would be greatly appreciated.

I am pouring over the documentation and looking for something that is
applicable.

Thanks


Lisa



Wayne Fay wrote:
> 
> Have you tried -Dmaven.test.skip=false? Not sure it will work, but
> there's a good chance it will. But then I think it will run all tests.
> 
> Probably you shouldn't use config-skip if you actually want to run
> some test(s)... Instead I'd use profiles to specify the exact test or
> set of tests you want to run.
> 
> Wayne
> 
> On 1/27/07, Lisa <ap...@purpleblade.net> wrote:
>>
>> I want to turn off all tests for a project but still be able to force a
>> run
>> for all tests in a single class file by using a param on the mvn command
>> line but can not figure out how to do this.
>>
>> I edited the pom.xml and specified to turn off all tests, however when I
>> type:
>>
>>
>> mvn -Dtest=BootStrapTest clean test
>>
>> the test does not run.  I explicitly told it to run all tests in
>> BootStrapTest, but apparently this does not override all the
>> <skip>true</true> attrib.
>>
>> Is there a way to override the <skip> while running maven from the
>> command
>> line?
>>
>> Here is my <build> section
>>     <build>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-surefire-plugin</artifactId>
>>                 <configuration>
>>                     <skip>true</skip>
>>                     <useFile>false</useFile>
>>                 </configuration>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>> any help would be greatly appreciated.
>>
>>
>> Lisa
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8671878
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8673335
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: how to skip all tests but still run explicitly

Posted by Lisa <ap...@purpleblade.net>.
so I have this in my pom.xml to skip all tests:

    <!-- skip running all tests in this project.  Do not change this -->
    <!-- run tests explicitely -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                    <useFile>false</useFile>
                </configuration>
            </plugin>
        </plugins>
    </build>

BUT, I want to run a test explicitly and thought this would work (and
override the pom file settings but apparently the command line options DO
NOT override the pom file settings


mvn -Dmaven.test.skip=false -Dtest=DeleteDatabaseTableTest clean test

So I want to make it difficult to run the tests and all tests are excluded
by default but the pom filter (skip = true) should not override any command
line options.

Is this the default behaviour of Maven ? (pom file overrides any command
line switches?)


Thanks


Lisa


Wayne Fay wrote:
> 
> Have you tried -Dmaven.test.skip=false? Not sure it will work, but
> there's a good chance it will. But then I think it will run all tests.
> 
> Probably you shouldn't use config-skip if you actually want to run
> some test(s)... Instead I'd use profiles to specify the exact test or
> set of tests you want to run.
> 
> Wayne
> 
> On 1/27/07, Lisa <ap...@purpleblade.net> wrote:
>>
>> I want to turn off all tests for a project but still be able to force a
>> run
>> for all tests in a single class file by using a param on the mvn command
>> line but can not figure out how to do this.
>>
>> I edited the pom.xml and specified to turn off all tests, however when I
>> type:
>>
>>
>> mvn -Dtest=BootStrapTest clean test
>>
>> the test does not run.  I explicitly told it to run all tests in
>> BootStrapTest, but apparently this does not override all the
>> <skip>true</true> attrib.
>>
>> Is there a way to override the <skip> while running maven from the
>> command
>> line?
>>
>> Here is my <build> section
>>     <build>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-surefire-plugin</artifactId>
>>                 <configuration>
>>                     <skip>true</skip>
>>                     <useFile>false</useFile>
>>                 </configuration>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>> any help would be greatly appreciated.
>>
>>
>> Lisa
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8671878
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8673329
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: how to skip all tests but still run explicitly

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/27/07, Lisa <ap...@purpleblade.net> wrote:

> The tests in question run some database insertion code, so I want all tests
> to be ignored by default if someone comes into the directory and runs a
> build.
>
> I do not want it mucking up the database, but I do want to provide the
> ability to run some specific tests for those people who know what they are
> doing and know the magic command to type.

What you're describing are integration tests, which often require
special setup and don't usually get run on every build.

Consider moving these tests to a separate module, and don't include it
in the list of <modules> in the parent pom.  (Is this already a
multi-module project?)

The "magic command" to run these test would either be to change into
that module directory and run 'mvn test' or 'mvn test
-Dtest=ClassName' or to add a profile to the parent pom that picks up
this module when activated.

-- 
Wendy

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


Re: how to skip all tests but still run explicitly

Posted by Lisa <ap...@purpleblade.net>.
yes, I am familiar with this, but what I want is:
  1.  a pom file that excludes all tests by default
  2.  the ability to force all tests with a specific class by using -D
switch

Currently I have not figured out how to do this.  I know how to use the skip
tag and exclude by pattern but then if I do that I can not force a specific
class to run on demand because it gets filtered or skipped.

The tests in question run some database insertion code, so I want all tests
to be ignored by default if someone comes into the directory and runs a
build.

I do not want it mucking up the database, but I do want to provide the
ability to run some specific tests for those people who know what they are
doing and know the magic command to type.

Lisa



Wayne Fay wrote:
> 
> Have you tried -Dmaven.test.skip=false? Not sure it will work, but
> there's a good chance it will. But then I think it will run all tests.
> 
> Probably you shouldn't use config-skip if you actually want to run
> some test(s)... Instead I'd use profiles to specify the exact test or
> set of tests you want to run.
> 
> Wayne
> 
> On 1/27/07, Lisa <ap...@purpleblade.net> wrote:
>>
>> I want to turn off all tests for a project but still be able to force a
>> run
>> for all tests in a single class file by using a param on the mvn command
>> line but can not figure out how to do this.
>>
>> I edited the pom.xml and specified to turn off all tests, however when I
>> type:
>>
>>
>> mvn -Dtest=BootStrapTest clean test
>>
>> the test does not run.  I explicitly told it to run all tests in
>> BootStrapTest, but apparently this does not override all the
>> <skip>true</true> attrib.
>>
>> Is there a way to override the <skip> while running maven from the
>> command
>> line?
>>
>> Here is my <build> section
>>     <build>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-surefire-plugin</artifactId>
>>                 <configuration>
>>                     <skip>true</skip>
>>                     <useFile>false</useFile>
>>                 </configuration>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>> any help would be greatly appreciated.
>>
>>
>> Lisa
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8671878
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8673310
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: how to skip all tests but still run explicitly

Posted by Wayne Fay <wa...@gmail.com>.
Have you tried -Dmaven.test.skip=false? Not sure it will work, but
there's a good chance it will. But then I think it will run all tests.

Probably you shouldn't use config-skip if you actually want to run
some test(s)... Instead I'd use profiles to specify the exact test or
set of tests you want to run.

Wayne

On 1/27/07, Lisa <ap...@purpleblade.net> wrote:
>
> I want to turn off all tests for a project but still be able to force a run
> for all tests in a single class file by using a param on the mvn command
> line but can not figure out how to do this.
>
> I edited the pom.xml and specified to turn off all tests, however when I
> type:
>
>
> mvn -Dtest=BootStrapTest clean test
>
> the test does not run.  I explicitly told it to run all tests in
> BootStrapTest, but apparently this does not override all the
> <skip>true</true> attrib.
>
> Is there a way to override the <skip> while running maven from the command
> line?
>
> Here is my <build> section
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <configuration>
>                     <skip>true</skip>
>                     <useFile>false</useFile>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>
> any help would be greatly appreciated.
>
>
> Lisa
> --
> View this message in context: http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8671878
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: how to skip all tests but still run explicitly

Posted by Lisa <ap...@purpleblade.net>.
Thanks, I am new to Maven and not sure I understand profiles completely yet,
but will do some research on exactly how to do this.

Lisa



Wendy Smoak-3 wrote:
> 
> On 1/27/07, Lisa <ap...@purpleblade.net> wrote:
> 
>> I want to turn off all tests for a project but still be able to force a
>> run
>> for all tests in a single class file by using a param on the mvn command
>> line but can not figure out how to do this.
> 
> Try putting the "skip" config in a profile that is activated by the
> absence of a system property.  Then if you do supply the property, the
> profile will not be active.
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-skip-all-tests-but-still-run-explicitly-tf3129739s177.html#a8673213
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: how to skip all tests but still run explicitly

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/27/07, Lisa <ap...@purpleblade.net> wrote:

> I want to turn off all tests for a project but still be able to force a run
> for all tests in a single class file by using a param on the mvn command
> line but can not figure out how to do this.

Try putting the "skip" config in a profile that is activated by the
absence of a system property.  Then if you do supply the property, the
profile will not be active.

-- 
Wendy

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