34294

How can i use my Junit test (selenium webdriver) with Jmeter

Question:

I created my functional tests with JUnit 4 and Selenium Webdriver and it works.<br /> Now I want to use this test with JMeter for performance tests.

I copied selenium-server-standalone-2.0b2.jar at JMeter’s library, then I exported my test from Eclipse to .jar file.

And this my selenium test

public class TestLoginWithFF { private WebDriver driver; private String baseUrl; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://localhost:8080/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void test() throws Exception { driver.get(baseUrl + "/pages/accueil/login.xhtml#loaded"); driver.findElement(By.id("login")).clear(); driver.findElement(By.id("login")).sendKeys("admin"); driver.findElement(By.id("password")).clear(); driver.findElement(By.id("password")).sendKeys("admin"); driver.findElement(By.id("loginButton")).click(); } @After public void tearDown() throws Exception { //driver.quit(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } } }

Answer1:

Maybe you can use some sort of scenario recorder. I know that <a href="http://gatling-tool.org" rel="nofollow">Gatling</a> provides such feature. JMeter should have it to.

The idea is to execute your tests through the recorder so that they'll be recorded in JMeter language, ready to be used.

Answer2:

You can now use webdriver natively in JMeter with a plugin: <a href="http://jmeter-plugins.org/wiki/WebDriverSampler/" rel="nofollow">http://jmeter-plugins.org/wiki/WebDriverSampler/</a>

Answer3:

I think the problem is

driver = new FirefoxDriver();

Comment out this line; then JMeter will know your method.

Recommend

  • Cannot execute custom Selenium assert function from user-extensions.js file, when running Python RC
  • Powershell command to compare AD user group memberships to a baseline
  • Hadoop - HDFS - Command to see how a file's splits
  • Pinvoking adwapi.dll - cryptDecrypt and cryptEncrypt functions, weird problem
  • Finding if conditions in .java file
  • Java/ JDBC – Multi Parameter Search Best Practice
  • javascript class property not set in success function of ajax call [duplicate]
  • java.io.EOFException: End of input at line 1 column 1
  • how to do a GET request using retrofit2?
  • Record real IP address on using phoenix in the nginx upstream
  • Android: Alternative to onSensorChanged? no ACCELEROMETER data when phone is lying on its back on a
  • Java out of memory errors on large WSDLs (play framework)
  • iText 7: How to build a paragraph mixing different fonts?
  • Retrofit 2 error: NetworkOnMainThreadException
  • How to include Web reference endpoint configuration in another project
  • RxJava,Retrofit Error :Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
  • Git cleanup/garbage collection on remote VSO git repository
  • Insert into database using onclick function
  • Can I display google adwords (AdView) in javafx on android
  • Align navbar back button on right side
  • How to add date and time under each post in guestbook in google app engine
  • How to set/get protobuf's extension field in Go?
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Validaiting emails with Net.Mail MailAddress
  • sending/ receiving email in Java
  • How to set my toolbar fixed while scrolling android
  • Web-crawler for facebook in python
  • Akka Routing: Reply's send to router ends up as dead letters
  • AT Commands to Send SMS not working in Windows 8.1
  • Cannot Parse HTML Data Using Android / JSOUP
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • JTable with a ScrollPane misbehaving
  • Java static initializers and reflection
  • apache spark aggregate function using min value
  • unknown Exception android
  • Sorting a 2D array using the second column C++
  • Observable and ngFor in Angular 2
  • failed to connect to specific WiFi in android programmatically
  • Unable to use reactive element in my shiny app
  • How can I use threading to 'tick' a timer to be accessed by other threads?