Tuesday, 26 January 2016

How to write and execute the basic JUnit test case in Jdeveloper 12C

Requirement:  I have a String str=“My name is Susanto“. I want compare str with some other String and want to test if both the Strings are same. If both the Strings are same then it will give the ioutput as true else the output will be false.
Solution: To write and execute the basic JUnit test case in JDeveloper 12C follow the steps as shown below:
Step 1: Create a new Java Desktop Application and name it as Client.
Step 2:  Right click the application and create a Test Suite. Name the Test Suite as AllTests.java and the write the below codes in it:
Step 3: Right click the Client application and create a new AllTestsTest.java class as shown below:
Step 4: Right click and run the AllTestsTest.java file. If the output is true then both the strings are same else if the output is false then both the strings are different.
Thus in this case we will get the output as true which means that the strings are same.
Hence, the solution to our requirement.

Thanks & Regards,

Susanto Paul