Test with selenium in "Go" jmeter

Source: Internet
Author: User

JMeterIs the use of very extensive Performance Testing Tools, while Seleniumis a powerful open source web for Throughtworks Company Functional TestingTools.  JMeter and selenium can be used together to achieve automated performance testing of Web pages. There are two ways to invoke the selenium test case in JMeter. You can use Jmeter JUnitSampler or BeanShell sampler, the latter method includes the selenium client and Server, so you do not need to start the server separately. Method OneGet ready work: Copy the file Selenium-server-standalone-2.*.jar to the JMETER Class Library installation directory%jmeter_home%/lib/, and start selenium server manually. Jmeter JUnit Sampler Package The selenium test case into a. jar file and copy it to the%jmeter_home%/lib/junit/directory, note: Test CasesThe TestCase or Seleniumtestcase class should be inherited, allowing JMeter to get to the test case, and the test method name should be TestBeginning. 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:
Package Com.example.tests;import Com.thoughtworks.selenium.*;import Org.junit.before;import org.junit.Test;import Org.junit.after;public class Selenium extends Selenesetestcase {@Beforepublic void SetUp () throws Exception {...} @Testpublic void Testselenium_test () throws Exception {...} @Afterpublic void TearDown () throws Exception {Selenium.stop ();}}
Method TwoPreparation: Copy the file Selenium-server-standalone-2.*.jar to the JMETER Class Library installation directory%jmeter_home%/lib/, 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 ();}}

Test with selenium in "Go" jmeter

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.