You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Behrang Saeedzadeh <be...@gmail.com> on 2009/03/05 04:54:24 UTC

Using TestNG with Maven

Hi,

When creating a new Maven project using archetype:create maven by default
uses JUnit as the unit testing framework. Is it possible to override this on
the command line to use TestNG instead?

Thanks in advance,
Behrang
-- 
View this message in context: http://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427290.html
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: Using TestNG with Maven

Posted by Behrang Saeedzadeh <be...@gmail.com>.
That was my reply to Rusty's message. Otherwise, this is what I replied to
Brett:

> Are there any alternatives to the archetype plugin for creating projects,
> that either use TestNG or let 
> users choose TestNG on the commandline?

After which came the Brett's reply that you quoted. :-)

Cheers,
Behi


Wayne Fay wrote:
> 
>> That's exactly the kind of thing I don't want to do. That's why I asked
>> about
>> overriding this default "on the command line".
> 
> This is why Brett wrote:
>>>>> Not in the archetype - however you can create your own archetypes.
> 
> You'll need to make your own archetype. Feel free to specify whatever
> testing library you wish to use in the behi-maven-archetype.
> 
> Wayne
> 
> ---------------------------------------------------------------------
> 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://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427436.html
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: Using TestNG with Maven

Posted by Wayne Fay <wa...@gmail.com>.
> That's exactly the kind of thing I don't want to do. That's why I asked about
> overriding this default "on the command line".

This is why Brett wrote:
>>>> Not in the archetype - however you can create your own archetypes.

You'll need to make your own archetype. Feel free to specify whatever
testing library you wish to use in the behi-maven-archetype.

Wayne

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


Re: Using TestNG with Maven

Posted by Brett Porter <br...@apache.org>.
Archetype is the plugin to do this, you will just need to create your  
own template. You only need to do it once, deploy it into the  
repository, and then you can use it over and over:

http://maven.apache.org/plugins/maven-archetype-plugin/advanced-usage.html

Cheers,
Brett

On 05/03/2009, at 3:34 PM, Behrang Saeedzadeh wrote:

>
> That's exactly the kind of thing I don't want to do. That's why I  
> asked about
> overriding this default "on the command line".
>
>
>
> Rusty Wright wrote:
>>
>> After you create the project, open the file pom.xml and find the  
>> lines
>>
>>    <dependency>
>>      <groupId>junit</groupId>
>>      <artifactId>junit</artifactId>
>>      <version>3.8.1</version>
>>      <scope>test</scope>
>>    </dependency>
>>
>> and replace them with
>>
>>        <dependency>
>>            <groupId>org.testng</groupId>
>>            <artifactId>testng</artifactId>
>>            <version>5.8</version>
>>            <scope>test</scope>
>>            <classifier>jdk15</classifier>
>>        </dependency>
>>
>> Adding these <dependency> things to your pom.xml file is a regular
>> activity.
>>
>> Also see
>>
>>  http://www.exist.com/better-build-maven
>>
>>  http://www.sonatype.com/book/reference/public-book.html
>>
>>
>> Behrang Saeedzadeh wrote:
>>> Are there any alternatives to the archetype plugin for creating  
>>> projects,
>>> that either use TestNG or let users choose TestNG on the  
>>> commandline?
>>>
>>> - Behi
>>>
>>>
>>> Brett Porter-2 wrote:
>>>> Not in the archetype - however you can create your own archetypes.
>>>>
>>>> Note that all is required by default is to switch the dependency to
>>>> testng.
>>>>
>>>> - Brett
>>>>
>>>> On 05/03/2009, at 2:54 PM, Behrang Saeedzadeh wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> When creating a new Maven project using archetype:create maven by
>>>>> default
>>>>> uses JUnit as the unit testing framework. Is it possible to  
>>>>> override
>>>>> this on
>>>>> the command line to use TestNG instead?
>>>>>
>>>>> Thanks in advance,
>>>>> Behrang
>>>>> -- 
>>>>> View this message in context:
>>>>> http://n2.nabble.com/Using-TestNG-with-Maven- 
>>>>> tp2427290p2427290.html
>>>>> 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
>>>>>
>>>> --
>>>> Brett Porter
>>>> brett@apache.org
>>>> http://blogs.exist.com/bporter/
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427394.html
> 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
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


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


Re: Using TestNG with Maven

Posted by Behrang Saeedzadeh <be...@gmail.com>.
That's exactly the kind of thing I don't want to do. That's why I asked about
overriding this default "on the command line".



Rusty Wright wrote:
> 
> After you create the project, open the file pom.xml and find the lines
> 
>     <dependency>
>       <groupId>junit</groupId>
>       <artifactId>junit</artifactId>
>       <version>3.8.1</version>
>       <scope>test</scope>
>     </dependency>
> 
> and replace them with
> 
>         <dependency>
>             <groupId>org.testng</groupId>
>             <artifactId>testng</artifactId>
>             <version>5.8</version>
>             <scope>test</scope>
>             <classifier>jdk15</classifier>
>         </dependency>
> 
> Adding these <dependency> things to your pom.xml file is a regular
> activity.
> 
> Also see
> 
>   http://www.exist.com/better-build-maven
> 
>   http://www.sonatype.com/book/reference/public-book.html
> 
> 
> Behrang Saeedzadeh wrote:
>> Are there any alternatives to the archetype plugin for creating projects,
>> that either use TestNG or let users choose TestNG on the commandline?
>> 
>> - Behi
>> 
>> 
>> Brett Porter-2 wrote:
>>> Not in the archetype - however you can create your own archetypes.
>>>
>>> Note that all is required by default is to switch the dependency to  
>>> testng.
>>>
>>> - Brett
>>>
>>> On 05/03/2009, at 2:54 PM, Behrang Saeedzadeh wrote:
>>>
>>>> Hi,
>>>>
>>>> When creating a new Maven project using archetype:create maven by  
>>>> default
>>>> uses JUnit as the unit testing framework. Is it possible to override  
>>>> this on
>>>> the command line to use TestNG instead?
>>>>
>>>> Thanks in advance,
>>>> Behrang
>>>> -- 
>>>> View this message in context:
>>>> http://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427290.html
>>>> 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
>>>>
>>> --
>>> Brett Porter
>>> brett@apache.org
>>> http://blogs.exist.com/bporter/
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427394.html
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: Using TestNG with Maven

Posted by Rusty Wright <ru...@gmail.com>.
After you create the project, open the file pom.xml and find the lines

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

and replace them with

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>5.8</version>
            <scope>test</scope>
            <classifier>jdk15</classifier>
        </dependency>

Adding these <dependency> things to your pom.xml file is a regular activity.

Also see

  http://www.exist.com/better-build-maven

  http://www.sonatype.com/book/reference/public-book.html


Behrang Saeedzadeh wrote:
> Are there any alternatives to the archetype plugin for creating projects,
> that either use TestNG or let users choose TestNG on the commandline?
> 
> - Behi
> 
> 
> Brett Porter-2 wrote:
>> Not in the archetype - however you can create your own archetypes.
>>
>> Note that all is required by default is to switch the dependency to  
>> testng.
>>
>> - Brett
>>
>> On 05/03/2009, at 2:54 PM, Behrang Saeedzadeh wrote:
>>
>>> Hi,
>>>
>>> When creating a new Maven project using archetype:create maven by  
>>> default
>>> uses JUnit as the unit testing framework. Is it possible to override  
>>> this on
>>> the command line to use TestNG instead?
>>>
>>> Thanks in advance,
>>> Behrang
>>> -- 
>>> View this message in context:
>>> http://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427290.html
>>> 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
>>>
>> --
>> Brett Porter
>> brett@apache.org
>> http://blogs.exist.com/bporter/
>>
>>
>> ---------------------------------------------------------------------
>> 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: Using TestNG with Maven

Posted by Behrang Saeedzadeh <be...@gmail.com>.
Are there any alternatives to the archetype plugin for creating projects,
that either use TestNG or let users choose TestNG on the commandline?

- Behi


Brett Porter-2 wrote:
> 
> Not in the archetype - however you can create your own archetypes.
> 
> Note that all is required by default is to switch the dependency to  
> testng.
> 
> - Brett
> 
> On 05/03/2009, at 2:54 PM, Behrang Saeedzadeh wrote:
> 
>>
>> Hi,
>>
>> When creating a new Maven project using archetype:create maven by  
>> default
>> uses JUnit as the unit testing framework. Is it possible to override  
>> this on
>> the command line to use TestNG instead?
>>
>> Thanks in advance,
>> Behrang
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427290.html
>> 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
>>
> 
> --
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
> 
> 
> ---------------------------------------------------------------------
> 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://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427350.html
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: Using TestNG with Maven

Posted by Brett Porter <br...@apache.org>.
Not in the archetype - however you can create your own archetypes.

Note that all is required by default is to switch the dependency to  
testng.

- Brett

On 05/03/2009, at 2:54 PM, Behrang Saeedzadeh wrote:

>
> Hi,
>
> When creating a new Maven project using archetype:create maven by  
> default
> uses JUnit as the unit testing framework. Is it possible to override  
> this on
> the command line to use TestNG instead?
>
> Thanks in advance,
> Behrang
> -- 
> View this message in context: http://n2.nabble.com/Using-TestNG-with-Maven-tp2427290p2427290.html
> 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
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


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