Why use JUnit for testing?

后端 未结 11 1474
忘掉有多难
忘掉有多难 2020-12-12 09:59

Maybe my question is a newbie one, but I can not really understand the circumstances under which I would use junit?

Whether I write simple applications or larger one

11条回答
  •  半阙折子戏
    2020-12-12 10:13

    JUnit is a unit testing framework for the Java Programming Language. It is important in the test driven development, and is one of a family of unit testing frameworks collectively known as xUnit.

    JUnit promotes the idea of "first testing then coding", which emphasis on setting up the test data for a piece of code which can be tested first and then can be implemented . This approach is like "test a little, code a little, test a little, code a little..." which increases programmer productivity and stability of program code that reduces programmer stress and the time spent on debugging.

    Features JUnit is an open source framework which is used for writing & running tests.

    Provides Annotation to identify the test methods.

    Provides Assertions for testing expected results.

    Provides Test runners for running tests.

    JUnit tests allow you to write code faster which increasing quality

    JUnit is elegantly simple. It is less complex & takes less time.

    JUnit tests can be run automatically and they check their own results and provide immediate feedback. There's no need to manually comb through a report of test results.

    JUnit tests can be organized into test suites containing test cases and even other test suites.

    Junit shows test progress in a bar that is green if test is going fine and it turns red when a test fails.

提交回复
热议问题