Kayser
Kayser

Reputation: 6694

JUnit Developer moving to TestNG. What should I know?

I am writing my test cases since many years with JUnit. Now I'm interested in starting developing with TestNG. What are the main things that are likely to trip me up when designing/coding TestNG classes.? Will I miss asserThat?

Upvotes: 1

Views: 504

Answers (1)

Cedric Beust
Cedric Beust

Reputation: 15608

The only thing I would recommend is to use the AssertJUnit class for your asserts and not TestNG's Assert, because the argument order is not the same and it will probably annoy you :-) Also, TestNG uses BeforeMethod instead of Before.

Other than that, it should be trivial for you to transition. If you're using Eclipse, the TestNG plug-in will convert all your JUnit 3 tests (and JUnit 4 to some extent) in one click, so you might want to start with that.

Some of the features you might want to look into first are:

  • Groups
  • Dependencies (if you have a need for them)
  • Running your tests in parallel

Finally, while you don't have to create a testng.xml file to get started, I suggest you go ahead and do that because it will open up all the features that TestNG has to offer right away.

If you have any further questions, feel free to email the testng-users mailing-list.

Good luck!

Upvotes: 4

Related Questions