In this post, we will learn how to create a Calculator Java class with simple features like add, subtract, multiply and divide methods. Later, we will learn how to test this class with JUnit framework. Things you need: 1.JDK installed on your computer. 2. IDE like Eclipse or IntelliJ. (Note that you can also create […]
In this post, we will look at a simple calculator test case example for writing JUnit tests. Also, this post helps beginners to understand writing and executing JUnit tests. Calculator with simple mathematical functions like add,subtract, multiply and divide.
In this post, we will discuss working with JUnit in Eclipse IDE. Eclipse has a lot of support for JUnit that makes creating and working with JUnit tests easy. To create a test class, right click on your new class, select the package where you want to create it in Project Explorer.
In this post, we will discuss assumptions in JUnit tests. Before executing a tests we can check out assumption/s about the test using the Assume and its methods. If all the assumptions pass then the test is executed for pass /fail. Furthermore, if the assumptions fail then the test is ignored.
In this post, we will see how to create JUnit Test Suite in Eclipse. If we have several test classes, we can combine them into a single test suite. Running a test suite executes all test classes in the suite in the specified order. A test suite may also contain other test suites.
In this post, we will discuss @RunWith Annotation. When a class is annotated with @RunWith or extends a class annotated with it, JUnit will invoke the class that it references to run the tests in that class instead of the runner built with JUnit.
In this post, we will discuss JUnit Test Execution Order Example. The test methods are of simple calculator test cases. It is also not certain what order JUnit will run the test cases. The order may change on a different JVM or platform. By design, JUnit does not specify the execution order of test method […]
In this post, we will see some JUnit @Test Annotation Examples. We can mark the test method in JUnit with @Test annotation. Example test method shown below:
In this post, we will discuss @Theory and @DataPoint JUnit Annotations. A Theory is a method that is executed against several data inputs called data points. To make a test method a theory we can mark it with @Theory annotation. In addition, to create a data point we need to create a public field in […]
In this post, you will learn how to write a simple JUnit test using BlueJ IDE.BlueJ is a free Java Development Environment designed for beginners. It is used by millions worldwide. ( https://bluej.org/ )