I am learnning TestNG recently from googled some TestNG tutorials, I found TestNG is really cool unit test framework. I am confused Junit and TestNG which one is best?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
Members have full access to the forums. Advertisements are removed for registered users.
I personally use JUnit in my online classes, and in my guide. I don't do that because I contemplate it WIgreater' than TestNG. I-do it since we ponder over it easier to utilize and realize than TestNG, and that it has greater records online.
In my own experience of production function, I've just utilised TestNG on one task. On other assignments JUnit was the test rendering tool that people utilized. Therefore I scale from that, that folks are more prone to expertise JUnit experience in their day to day career, than TestNG expertise. Which encounter is useful to draw upon, when learning.
TestNG and JUnit are both much the same regarding straightforward behavior, thus most of the thing you need to know on my training applies to both tools.
I've caused TestNG on one undertaking. And on that project, it was just the exam crew which used it. Everybody else employed JUnit. The test staff applied it due to its marketing as a "Practical" examination tool, and not simply a Device check tool. e.g. the adding and dependencies etc. This was years back and there have been sizeable variations between the methods now. I do believe JUnit was however JUnit v 3 as well as the TestNG ebook had just been released. Furthermore the folks choosing weren't specifically seasoned inside the check rendering frameworks. In-fact, it was we that thought we would use it, since I noticed many people on-line expressing it was better for Ipurposeful' testing e.g GUI testing and API s/w testing.
Ultimately, we migrated up to JUnit. Not because TestNG was 'bad', but since JUnit was a better fit for our purposes, approach and atmosphere:
JUnit 4 arrived on the scene
We're able to do just about what we needed in both device
Our designers realized and employ JUnit consequently we could use their expertise
It decreased one obstacle from getting provided code ownership using the improvement team
JUnit documents on-line was better to use and comprehend compared to TestNG book
In my own production work currently, we try to retain my exam code as straightforward as I may, and so I frequently avoid the sophisticated features of JUnit, and the sophisticated features of TestNG, meaning there is less to tell apart between these.
After I go through the servicing and records over-time, we see JUnit as having withstood more adjust and preservation than TestNG, with JUnit deliberately wanting to give attention to its main strengths and assign 'area' operation (e.g. Claims and corresponding) off to Hamcrest. Thereby keeping it simpler.
JUnit data-driven assessment is not uncomplicated. But I found TestNG knowledge companies were not that simple to have my mind around once I began sometimes. But JUnit data-driven may just about what I want, and that I can often try JUnit params easily think I need to produce it easier.
Consequently, to summarise, I use JUnit on my coaching because:
I take advantage of it in production
Most of the production clubs I have caused use JUnit
I do believe JUnit is easier for novices to work well with
JUnit has more online learning resources to simply help
I think the fundamental JUnit abilities you discover are transferrable to TestNG, if you utilize that in your website.
Experience absolve to assess the options that come with both on your website and produce your own informed selection, once you've learned the fundamentals of the automated you need to do.