group-icon
Software Testing Squad
All About Software Testing In One Place!
128 Members
Join this group to post and comment.
Soubhik Maji
Soubhik Maji
Computer Science
20 Jan 2019

Junit testing in Eclipse

Software testing :Basic Junit test in java 



   Junit test case -------


1.Create a junit test  case by right clicking over your package .


2.create instance of your class .


3.pass the appropriate parameters and call the appropriate methods .


4.Store the the return from the function in appropriate variables .For example let's call that variable output.


5.Use the following functions to check whether you got your appropriate output 

 assertEquals(25,output);


6.You will get some green color for successful test and a red color for failed test cases.


---------------------------------------------------

Junit test suite 


1.Suppose you have written multiple junit test cases and you want to run them all together , you use Junit test suite .Suite representative of a bunch of test cases .


2.Here also you go to your package right click select junit test suite  ..select the package where your test cases reside ...select the  test cases you want 


3.Then you select the junit test cases you want to run .Then do the usual .


4.You get  a class . For now you don't need to do anything . 


5.Just safe compile and run.


6.It will show the results of the tests whether both were successfully or some variation.


Shruthi Pillai
Shruthi Pillai
Information Technology
3mos ago

JUnit is a Regression Testing Framework used by developers to implement unit testing in Java .

JUnit does not require server for testing web application, which makes the testing process fast.

JUnit framework also allows quick and easy generation of test cases and test data.