Tips for migrating from TestNG to JUnit5?

I was working on making a API automation framework prototype for a project I’m working on. It’s a small framework which started out a POC and I’ve been extending it a bit over time. Anyway, I initially went with TestNG, but I recently had a meeting a few architect guys from the company and they suggested that I should consider migrating to JUnit.

Their reasoning behind this is the fact that the company is a big enterprise with established policies on tools which should be used, and JUnit is what’s used, it would be approved by the architecture board a lot easier than TestNG - which is not being used. I also read (somewhere on LinkedIn) that John Ferguson Smart suggests that JUnit5 is now more powerful than TestNG, which was not the case with older versions of JUnit - Cedric Beust originally made TestNG to make up for JUnits shortcomings.

As my API testing framework is pretty small and still in its infants stages I believe that this will not be a painful refactor, especially considering the similarities between the two testing frameworks, and besides I think it will be a good opportunity to leaner more about JUnit with some hands-on experience!

If any of the MoT friends had similar experiences, I’d love to hear them, or some advice on who to proceed in this kind of situation, any pitfalls to watch out for, I would be most grateful!

I used more TestNG then Junit but after I saw a Video Course from Corina Pip about Junit I think I will give it a try for the next project ( @mirza - you can find it on TAU since I know you are there as well :D).

Considering the below article and the fact that as you mentioned it is a small framework at the moment there should not be any issue in the switch.

Have a look at the table in this article where they do a feature comparison between TestNG and Junit

1 Like

Thanks @restertest I’ll check out both!

I also found a few promising courses on Pluralsight

I’m checking out the first one, at the moment, I think it should be smooth sailing!