How to use JUnit with Apache Jmeter

  1. Write your JUnit test and jar the classes
  2. Copy and paste the jar files into jmeter/lib/junit directory
  3. Start JMeter
  4. Select Test Plan
  5. Right click Add → Thread Group
  6. Select Thread Group
  7. Right click Add → Sampler → JUnit Request
  8. Enter my unit test in the name
  9. Enter the package of your JUnit test
  10. Select the class you want to test
  11. Select a method to test
  12. Enter test successful in success message
  13. Enter 1000 in success code
  14. Enter test failed in failure message
  15. Enter 0001 in failure code
  16. Select the Thread Group
  17. Right click Add → Listener → View Results Tree
Couple of Things
1. JUnit test class should have a default constructor
2. In the Test plan add the jar to the class path



3. Check the JUnit 4 annotations


4. How to create a jar file for the projectmvn -DskipTests test-compile jar:test-jar install

Hope this helps :)








No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days