I\'m trying to run JUnit test with JMeter 2.7. However, when selecting the test classes in the drop down of the JUnit sampler, they don\'t show up. As I found out, that\'s b
Did you check the option that JUnit sampler has to search for v4 tests?
I've tried and this works for a simple project I've created with JUnit 4, it filters only tests with the @Test annotations even those classes doesn't extend TestCase class.
As Teinacher wrote, JUnit test will show up in JMeter after copying all project dependencies (all .jar files) into JMeter's /lib directory (JMeter restart is needed).
With Jmeter 4.0, instead of you put dependencies in JMeter's lib folder you could specify paths to dependencies locations via the “user.classpath” property. This property lives in the “user.properties” file under the /bin folder of your JMeter installation.
A path item can either be a jar file or a directory. Any jar file in such a directory will be automatically included, jar files in sub directories are ignored.
When adding paths pay attention and use your platform path separator (java.io.File.separatorChar in Java) to separate multiple paths:
#Example for windows (; separator)
#user.classpath=../classes;../lib;../app1/jar1.jar;../app2/jar2.jar
#Example for linux (:separator)
#user.classpath=../classes:../lib:../app1/jar1.jar:../app2/jar2.jar
user.classpath=C:/git/adf-bpm-autotesting-tool/libs;C:/git/adf-bpm-autotesting-tool/libs/selenium-tools;C:/git/adf-bpm-autotesting-tool/libs/selenium-2.52.0;C:/git/adf-bpm-autotesting-tool/libs/selenium-2.52.0/libs
As a correct result while jmeter gui starts you will see in jmeter.log records like that:
2019-04-08 18:51:46,871 INFO o.a.j.JMeter: Adding to classpath and loader: C:/git/adf-bpm-autotesting-tool/libs
2019-04-08 18:51:46,872 INFO o.a.j.JMeter: Adding to classpath and loader: C:/git/adf-bpm-autotesting-tool/libs/selenium-tools
2019-04-08 18:51:46,873 INFO o.a.j.JMeter: Adding to classpath and loader: C:/git/adf-bpm-autotesting-tool/libs/selenium-2.52.0
2019-04-08 18:51:46,873 INFO o.a.j.JMeter: Adding to classpath and loader: C:/git/adf-bpm-autotesting-tool/libs/selenium-2.52.0/libs
After that in JUnit Request Sample you will found all you junit tests.
You must put your junit classes in lib/junit folder as you did and dependencies in lib folder.
You shouldn't use fatjar as sometimes these tools removed files from meta-inf or only keep one from all jars, spring pûts one in each of its jars .
Add all your jars one by one in lib folder.
Check jmeter logs to see if you have any exception .
If it still fails, ask a question on jmeter user list and if you don't get any answer create a simple test case and open a bug.