开发者

what is the difference between Junit 3, Junit 4, TestNG

开发者 https://www.devze.com 2023-03-26 17:39 出处:网络
what is the difference between JUnit 3, JUnit 4, TestNG in selenium how selenium is implemented differently in these three testing fra开发者_C百科meworks?

what is the difference between JUnit 3, JUnit 4, TestNG in selenium how selenium is implemented differently in these three testing fra开发者_C百科meworks?

Can any one explain clearly..

Thanks in Advance..


  1. TestNG handles dependency between test cases. If one test case failure causes the failure of a group of test cases it skips that group and executes the rest of the test suite. The group that has dependency on the failed test cases is reported as skipped NOT failed.

    In Junit, one test case failure can cause a bunch of test cases to fail in the test suite. There is no option of skipping the set of dependent test cases. The dependent test cases are also reported as failures. For example, suppose there is a test case to test login and the next 10 test cases need to perform a transaction after login. If the login test case fails the other 10 test cases will also fail.

  2. In TestNG groups can be defined. Groups are specific subsets of the test suite. We can choose to run only a specific subset of the test suite say database related test cases instead of running the entire test suite. This can be done as below:

    In the test case we define two groups DBTestcase and deprecated as below:

    @Test(groups = {"DBTestcase", "deprecated"})
    public void testMethod2()
    {
    
    }
    

    In Junit for a long time it was not possible to run a specific subset of the test cases. We can either run the entire suite or run each test case individually. Junit 4.8 introduced a new feature called “Categories” to overcome this limitation. However groups are much easier to configure in TestNG.

    Thus if you have junit 3.x series you cannot define groups. However junit 4.8 and above supports it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号