[testng-users] TestNG and Surefire

35 views
Skip to first unread message

mane_uk

unread,
Feb 8, 2012, 7:11:34 AM2/8/12
to testng...@googlegroups.com

Hi all,

I have previously asked a question on this Forum about
NullPointerException error coming up once I converted my JUnit test into
TestNG -
http://old.nabble.com/Getting-and-NullPointerError-when-converting-JUnit-to-TestNG-td33251900.html
NullPointerException Error question .

After doing loads of tests I found out that the error won't come up if I
delete in my pom.xml the <groups> from the <configuration> in my surefire
(see below).

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<!-- <groups>functest</groups> -->
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
...

The POM.xml above works but once that I put back the groups it won't
work. The NullPointerErrorException comes up again when running my "mvn
clean test". I have tried changing the surefire version to 2.10 and 2.12 -
as I was using 2.11 and read that the 2.11 version was having some problem
with TestNG - but it also didn't work. I am using TestNG 6.3.1.

Any ideas on how to fix it please?

Thanks
--
View this message in context: http://old.nabble.com/TestNG-and-Surefire-tp33285466p33285466.html
Sent from the testng-users mailing list archive at Nabble.com.

Krishnan Mahadevan

unread,
Feb 8, 2012, 7:33:57 AM2/8/12
to testng...@googlegroups.com
The following works for me

<plugin> 
 <groupId>org.apache.maven.plugins</groupId> 
 <artifactId>maven-surefire-plugin</artifactId> 
 <version>2.6</version> 
 <configuration> 
         <groups>datatest</groups> 
 </configuration> 
</plugin>

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


mane_uk

unread,
Feb 8, 2012, 8:46:24 AM2/8/12
to testng...@googlegroups.com

Tried 2.6 but I didn't work as soon as I got the groups in it.

Any other ideas? Thks

--
View this message in context: http://old.nabble.com/TestNG-and-Surefire-tp33285466p33286041.html

mane_uk

unread,
Feb 8, 2012, 9:53:38 AM2/8/12
to testng...@googlegroups.com

Just one more point to extend my previous question... I have found out that
it doesn't seem to be running anything that I enter as <configuration>. I
have tried including an specific file but it didn't run the file. I tried
including the following on my POM:

<configuration>
<includes>
<include>"**/*Test.java"</include>
</includes>
</configuration>

and it didn't run any of my files on "mvn clean test" even though all files'
names finish in Test.
Any ideas please? Thks


mane_uk wrote:
>
> Tried 2.6 but it didn't work as soon as I got the groups in it.
> Which version of testng were you using?

--
View this message in context: http://old.nabble.com/TestNG-and-Surefire-tp33285466p33286552.html

mane_uk

unread,
Feb 8, 2012, 11:44:33 AM2/8/12
to testng...@googlegroups.com

Cedric,

My project is huge and have loads of dependencies so I wouldn't be able
to only partially send it as it would not work but most of all,
unfortunately, it is a company policy that I can't post any complete code
outside work. Sorry.

I do understand this will probably make it almost impossible for you to
help me out but is there any path that I can try and follow to correct this
error that happens every time I enter any information in the maven-surefire
<configuration>? Any tests?

Other point to note is that if I run the code on eclipse it works ok.
Just breaks when I run on command line "mvn clean test".

Thanks


Please email me a zipped version of your project (as small as possible) so
I can try to reproduce this here.

Thanks.

--
Cédric
--
View this message in context: http://old.nabble.com/TestNG-and-Surefire-tp33285466p33287451.html

Cédric Beust ♔

unread,
Feb 8, 2012, 11:03:26 AM2/8/12
to testng...@googlegroups.com
Please email me a zipped version of your project (as small as possible) so I can try to reproduce this here.

Thanks.

-- 
Cédric




Cédric Beust ♔

unread,
Feb 8, 2012, 1:22:05 PM2/8/12
to testng...@googlegroups.com
Can you create a project from scratch that shows the problem?

-- 
Cédric




Mark Derricutt

unread,
Feb 13, 2012, 5:04:28 AM2/13/12
to testng...@googlegroups.com
If this is the same problem you had last time you asked, it looked at thou it was because you were running with groups, and your @BeforeMethod method didn't have a group specifier.


--
"Great artists are extremely selfish and arrogant things" — Steven Wilson, Porcupine Tree



2012/2/9 Cédric Beust ♔ <ced...@beust.com>

mane_uk

unread,
Feb 23, 2012, 9:12:13 AM2/23/12
to testng...@googlegroups.com

Spot on Mark, this was the problem... I have just included alwaysrun=true on
my @BeforeMethod and it is working now.

Cheers

--
View this message in context: http://old.nabble.com/TestNG-and-Surefire-tp33285466p33378040.html

Reply all
Reply to author
Forward
0 new messages