0

I created my functional tests with JUnit 4 and Selenium Webdriver and it works.
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);
    }   
  } 
}
guerda
  • 23,388
  • 27
  • 97
  • 146
dév
  • 1
  • 1
  • 2

3 Answers3

0

Maybe you can use some sort of scenario recorder. I know that Gatling 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.

  • I don't understand what you mean ! – dév Apr 24 '13 at 14:31
  • You can use [JMeter proxy](http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf). The idea is to execute your selenium tests on your browser configured to use the JMeter proxy. This way, when the tests execute, all the requests will be saved by JMeter Proxy, and you're done ;) –  May 01 '13 at 09:37
0

You can now use webdriver natively in JMeter with a plugin: http://jmeter-plugins.org/wiki/WebDriverSampler/

Ophir Prusak
  • 1,437
  • 13
  • 20
-1

I think the problem is

driver = new FirefoxDriver();

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

Alban
  • 1