JUnit Execution Procedure - JUnit

What are the execution procedure of methods in JUnit?

Let’s discuss about the execution procedure of methods in JUnit. Following methods are the execution procedure of the JUnit test API methods with example.
Create a java class file named ExecutionProcedureJunit.java in C:\>JUNIT_WORKSPACE to test annotation.
Let’s create a java class file named TestRunner.java in C:\>JUNIT_WORKSPACE to execute annotations.
Compile the Test case and Test Runner classes using javac.
Now run the Test Runner, which will run the test case defined in the provided Test Case class.
Verify the output.
Now see the above output. The execution procedure is as follows −
  • First of all, the beforeClass() method executes only once.
  • The afterClass() method executes only once.
  • The before() method executes for each test case, but before executing the test case.
  • The after() method executes for each test case, but after the execution of test case.
  • In between before() and after(), each test case executes

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JUnit Topics