aspose file tools
The moose likes IDEs, Version Control and other tools and the fly likes TestNG in Netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "TestNG in Netbeans" Watch "TestNG in Netbeans" New topic

TestNG in Netbeans

Tina Smith
Ranch Hand

Joined: Jul 21, 2011
Posts: 208

I'm using Netbeans IDE 7.2 for a class (required) and I've integrated with TestNG, but it's not working right. By not right, I have four (so far) test cases and a test suite that runs all 4 test cases. The cases are all located in the same file. When I run the suite through Netbeans, the console output and test output tells me it ran exactly two of my four test cases, and that they all passed.

But that's wrong. One of the cases is a no-op, so it should pass. The second case though is very clearly failing. I've stepped through the test case and the assert statement *should* fail, and the line of code where the assert is tested is in fact reached, and either Assert.assertTrue( false ); is returning true (doubtful) or Netbeans is doing something weird.

The test looks like this. It just runs a program and checks the value of the printed output.

I run just that test, I get this output in the console:
[TestNG] Running:
Command line suite

Could not connect to time server. Error is: Address already in use: JVM_Bind
Java Result: 1

and a green bar in the test results. I don't understand this. It runs perfectly (all four tests and fails) in eclipse. Gives me the same error message, except I don't get the "Java Result: 1" but I think that's netbeans-specific output. Given that it works in eclipse I'm inclined to look at Netbeans as the source of the problem.

Has anyone ever seen this before or have any ideas why the test might be inexplicably passing? My initial guess would be that TestNG is getting terminated and flagged as passed because 'it didn't fail' - that would explain why only two tests are run, but it doesn't explain why it works in Eclipse and not Netbeans.

Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
jQuery in Action, 2nd edition
subject: TestNG in Netbeans