James Gosling slings a pie in the face of a Bill Gates impersonator.

Software testing is actually something that we have always done since we learned how to program, we have used it homework and projects from program classes, for example, in fundamentals of programing and POO. The purpose of testing is to verify that your program o software is doing or it does exactly what is intended to do and also to look for bugs that happens on particular cases.

“JUnit promotes the idea of “first testing then coding”, which emphasizes on setting up the test data for a piece of code that can be tested first and then implemented”

In java, JUnit is  used as a library by importing the necessary classes an then creating a constructor of the test and implementing methods that call an instance of the class you want to test that are used to execute specific method of the tested class. The goal for each of those testing methods is to assert the expect behavior comparing the the expected value and the actual value. You can use any data type: from data primitive (such as int, char, float, etc.) to arrays of any type, any objects and nulls.

A Unit Test Case is a part of code, which ensures that another part of code (method) works as expected. To achieve the desired results quickly, a test framework is required and JUnit is perfect for that.

A formal written unit test case is characterized by a known input and an expected output, which is worked out before the test is executed. The known input should test a precondition and the expected output should test a post-condition.

There must be at least two unit test cases for each requirement − one positive test and one negative test. If a requirement has sub-requirements, each sub-requirement must have at least two test cases as positive and negative.



Types of Software Testing – Complete List