Category Archives: Junit

ErrorCollector in JUnit

ErrorCollector in JUnit is a rule that allows execution of a test to continue after the first problem is found.   As we have seen in Assertion Tutorial, Program stop execution if an assertion fails in JUnit. So suppose you have included Assertion in the very starting off your Test case and it fails, So … Continue reading ErrorCollector in JUnit

Parameterized Test in JUnit

Learn about the Parameterized Test in JUnit. Test case parameterization is the technique to execute the same Test Case with different input values. Parameterized tests allow developers to run the same tests over and over again using different values.   We will see how to parameterize the Test case in JUnit. There are standard finite … Continue reading Parameterized Test in JUnit

Assertion in JUnit

The assertion in JUnit means “Trust but Verify” Assertion is performed to compare the Actual result with expected result. In JUnit assertion is performed with the help ofAssert Class.   There are a lot of methods in Assert class. Assert is basically a class which contains a lot of methods to validate the data by comparing … Continue reading Assertion in JUnit

Rule Annotation in JUnit

Rule Annotation in JUnit is special Annotation to set the Rule or conditions for JUnit Tests. Rules are used for special handling in JUnit. Rules are used to handle Test Cases in JUnit or Test Suites in JUnit. Rules used for additional validations common for all tests in the class set up resources before each test … Continue reading Rule Annotation in JUnit

JUnit Assume Class

Assume class basically a class which contains those methods which will first check the conditions on which the test will be meaning full. If that condition doesn’t meet then all the tests will be skipped.   This class can also be used to ignore test cases without the use of @Ignore annotation. Let’s see an … Continue reading JUnit Assume Class

Junit Annotations

Let’s learn about JUnit Annotations. JUnit is basically a Java Unit Testing framework which is used to create repeatable tests. It is basically a library wrapped up in a jar files. There are many annotations in JUnit 4 which makes automation easy. It’s easy to create test scripts with the help of annotations. We are … Continue reading Junit Annotations

JUnit Sample Test

Learn how can you write JUnit tests using example JUnit Sample Tests. As we know JUnit is testing framework which is used to create the Unit Test Cases. We will see the example how can you use the JUnit to create the Unit testing test cases.   We first need some Java classes to test … Continue reading JUnit Sample Test

Install JUnit in Eclipse

Let’s see, How can you install JUnit in Eclipse. In order to compile, run and execute the Unit Test cases using JUnit in Eclipse. First, you need to configure JUnit in your eclipse IDE. As a prerequisite, you must have installed at least Java jdk 6 (Download Java from here!). There are few standard steps to setup … Continue reading Install JUnit in Eclipse

JUnit Framework

JUnit Framework is an open source framework designed by Kent Beck, Erich Gamma for the purpose of writing and running test cases for Java Programs. Junit is used to write and run repeatable automated unit tests so that we can be ensured that our code works as expected.   JUnit is used to test the web application without the … Continue reading JUnit Framework