Original reprint: Http://www.blogjava.net/qileilove/archive/2014/06/05/414423.html preparation: selenium-server-standalone-2.* the file. The jar is copied to the JMETER Class Library installation directory%jmeter_home%/lib/, and you do not need to start selenium server. Jmeter JUnit Sampler Package The selenium test case into a. jar file and copy it to the%jmeter_home%/lib/junit/directory, note: The test case should inherit testcase or The Seleniumtestcase class, which allows the jmeter to get to the test case, and the test method name should begin with testing. Create the test group and JUnit Sampler testing plan in JMeter, and select the test case name in JUnit sampler, select the test method and run it. Of course, you can also set additional parameters as required. A test case example:
Import Junit.framework.testcase;import org.openqa.selenium.*;import Org.junit.before;import Org.junit.Test;import Org.junit.after;import Org.openqa.selenium.webdriver;import Org.openqa.selenium.webelement;import Org.openqa.selenium.firefox.firefoxdriver;import Org.openqa.selenium.firefox.firefoxprofile;public class Selenium Extends TestCase {webdriver driver; @Beforepublic void SetUp () {Firefoxprofile profile = new Firefoxprofile (); .... driver = new Firefoxdriver (profile);} @Testpublic void Testselenium_test () throws Exception {...} @Afterpublic void TearDown () {driver.quit ();}} |
JMeter Selenium Automation code for pressure measurement