JUNIT TESTING by H2kinfosys

Junit testing is a type of unit testing which is implemented in java to accelerate the programming speed and increase the quality of code. This application is integrated with eclipse, Ant, Maven. The important features of Junit testing are:
  1. Fixtures
  2. Text suits
  3. Test Runners
  4. Junit classes
Fixtures:
Fixture is a complete fixed state of set of objects used as a baseline for running tests. The main purpose of test fixtures, is to ensure that there is a well known fixed environment in which we check if the results are repeatable. It has two methods
  1. A setup () method which runs before the test invocation.
  2. A teardown () method which runs after the test method.
Test Suites:
A test suite groups a few test cases and runs them together. The both @Runwith and @suite annotation in Junit are used to run the suite test.
Test Runners:
It is simply used for executing test cases.
Junit classes:
There are some important classes of Junit
  1. Assert: it contains a group of assert methods.
  2. Test case: it may contain a test case which will define the fixture to perform multiple tests.
  3. Test Result: it contains the method which collects the test result of executing test case.
The Junit provides tool for execution of test cases. Junit core classes are used to run these test cases. A method called runclasses is used, which provides org.Junit.runner.Junitcore is used to run the several test classes. The return type of this method is the Result object (org.Junit.runner.Result) which access information about tests.
What is the necessity of Junit Testing in java?
We need Junit testing for following:
  • Mainly, it finds the bugs early in the code and makes the code reliable.
  • Junit is useful for developers who are in test-driven environment.
  • Junit testing forces the programmer to read code more than just writing it.


Comments

Popular posts from this blog

5 Steps to Becoming a Certified Business Analyst

How to perform gap analysis as a Business Analyst

Will qa engineers get replaced?