简体   繁体   中英

How to run webdriver and JMeter code in Eclipse using Java

Below is my requirement : (1)I need to do UI performance testing . (2)At the end of the test I want jmx file to be generated,I do have the batch file that will convert it to jtl and then to html report.

Answers not known : (1)I did browse through a lot of links that explained how to execute webdriver code using JUnit in JMeter. However I don't want to do that[run webdriver code in JMeter] and want my code to be a standalone code using HTMLUnit(headless browser) performing authentication and then the remaining click actions[Click on multiple links] ....Behind the scenes jmeter should record performance of every page and at end of test ,dump the results.Also it should be irrespective of testng /junit .Does anyone know if this is possible and can redirect me to the appropriate link.Thanks!

JMeter has nothing in common with the UI performance testing, as per JMeter main page :

JMeter is not a browser , it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

Both JUnit and TestNG automatically record function execution duration, you can build your test in such a way that measurable actions would be annotated with @Test annotation so the time will be automatically recorded.

In addition you can consider using Navigation Timing API from your WebDriver tests in order to get more information regarding page loading events.


If you still want to run JMeter tests from Java code - check out Five Ways To Launch a JMeter Test without Using the JMeter GUI article, it covers both running existing .jmx file and creating a new JMeter test purely using JMeter API from Java, however it is not applicable for your use case. The recommended way is to:

  1. Create the main load using JMeter
  2. Measure client-side performance using Selenium

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM