NPE in SuiteRunner

12 views
Skip to first unread message

Wujek Srujek

unread,
Sep 10, 2010, 10:08:19 AM9/10/10
to testng-users
Hi
I updated to 5.14 and here is a bit that I see on the command line.
This is run using maven. After this message the test suite proceeds
normally. Maybe this will be interesting to invastigate:

Running TestSuite
[TestRunner] Starting executor with time out:2147483647 milliseconds.
Exception in thread "pool-1-thread-1" java.lang.NullPointerException
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:67)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
at org.testng.internal.thread.ThreadUtil
$CountDownLatchedRunnable.run(ThreadUtil.java:151)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Wujek

Cédric Beust ♔

unread,
Sep 10, 2010, 11:15:59 AM9/10/10
to testng...@googlegroups.com
Hi Wujek,

Is there any way that I could reproduce this behavior on my machine? I don't see how an NPE is possible at this line...

-- 
Cédric



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




--
Cédric


Wujek Srujek

unread,
Sep 10, 2010, 12:15:57 PM9/10/10
to testng-users
Hi Cedrik,

so the problems seems to be when there is a suite that has no test
run. Please see the below code in SuiteRunerWorker, lines 52-70, with
the faulty line 67 as in the stack trace, with my comments (// Wujek):

if (xmlSuite.getVerbose() > 0) {
// SuiteResultCounts counts = new SuiteResultCounts();
// counts.calculateResultCounts(xmlSuite, suiteRunnerMap);
for (ISuiteResult isr : m_suiteRunner.getResults().values())
{ // Wujek: if there are no results, this for loop will
never be executed, and the m_verboseOutput field will remain null
m_verboseOutput =
new
StringBuilder("\n===============================================\n")
.append(xmlSuite.getName());
passed += isr.getTestContext().getPassedTests().size();
failed += isr.getTestContext().getFailedTests().size();
skipped += isr.getTestContext().getSkippedTests().size();
confFailures +=
isr.getTestContext().getFailedConfigurations().size();
confSkips +=
isr.getTestContext().getSkippedConfigurations().size();
}
total += passed + failed + skipped;

m_verboseOutput.append("\nTotal tests run:
") // Wujek: this is line 67 and
m_verboseOutput is null as there were no tests runs
.append(total)
.append(", Failures: ").append(failed)
.append(", Skips: ").append(skipped);;


The problem for us was that we use verbose = 2, and we have a few test
XML files and one that has them all. As this project is not finished
yet, some files specify test packages that have no tests yet - that's
when the NPE happens - please read the above comments. Here is code
that simulates this:

TestNG tng = new TestNG();
XmlSuite suite = new XmlSuite();
tng.setXmlSuites(Arrays.asList(suite));
tng.run();

This is very specific, I guess it will only happen when there are no
test run for a given suite, like for us.

Is this enough to reproduce?

Regards,
Wujek


On Sep 10, 5:15 pm, Cédric Beust ♔ <ced...@beust.com> wrote:
> Hi Wujek,
>
> Is there any way that I could reproduce this behavior on my machine? I don't
> see how an NPE is possible at this line...
>
> --
> Cédric
>
> On Fri, Sep 10, 2010 at 7:08 AM, Wujek Srujek
> <wujek.sru...@googlemail.com>wrote:
>
>
>
> > Hi
> > I updated to 5.14 and here is a bit that I see on the command line.
> > This is run using maven. After this message the test suite proceeds
> > normally. Maybe this will be interesting to invastigate:
>
> > Running TestSuite
> > [TestRunner] Starting executor with time out:2147483647 milliseconds.
> > Exception in thread "pool-1-thread-1" java.lang.NullPointerException
> >        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:67)
> >        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
> >        at org.testng.internal.thread.ThreadUtil
> > $CountDownLatchedRunnable.run(ThreadUtil.java:151)
> >        at java.util.concurrent.ThreadPoolExecutor
> > $Worker.runTask(ThreadPoolExecutor.java:886)
> >        at java.util.concurrent.ThreadPoolExecutor
> > $Worker.run(ThreadPoolExecutor.java:908)
> >        at java.lang.Thread.run(Thread.java:619)
>
> > Wujek
>
> > --
> > 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<testng-users%2Bunsu...@googlegroups.com>
> > .

Nalin Makar

unread,
Sep 10, 2010, 9:20:08 PM9/10/10
to testng...@googlegroups.com
Hi Wujek,

Fix for this has been checked in: http://github.com/nullin/testng/commit/14e2b690e232509158528eeea231f6b9747746fe

If possible, download the source of github to compile your own jar and give it a shot.

-nalin

To unsubscribe from this group, send email to testng-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages