当前位置:网站首页>Using JMeter for web side automated testing
Using JMeter for web side automated testing
2022-06-22 02:48:00 【Test plus】
Preface
be familiar with jmeter I think all of you know that ,jmeter It is a tool for server-side performance testing .jmeter You can do it Web End to end automated testing , This feature is something I just learned recently , Personally, I think it is more interesting . Refer to some articles on the Internet , Text just try to experience how to use .
download WebDriver rely on
Core or need WebDriver Dependency to start web pages .
- Download address (https://jmeter-plugins.org/downloads/old/)JMeterPlugins-WebDriver-1.1.2 .
2. take JMeterPlugins-WebDriver-1.1.2\lib\ext Medium *.jar copy to D:\apache-jmeter-2.13\lib\ext Next .
3. take JMeterPlugins-WebDriver-1.1.2\lib Medium *.jar copy to D:\apache-jmeter-2.13\lib Next .
Add a plug-in configuration component
again jmeter after , In the configuration component, you can see Chromdriver Driver Config, Description: the plug-in configuration is successful .
Configure local Chrome Driver Address ,Chrome Driver You need to download it in advance .
add to WebDriver Sampler
Select... In the sampler WebDriver Sampler Sampler .
WebDriver Sampler The sampler supports multiple languages (java、beanshell、js), We use js Language to write automated test code .
Testing process : Open the web page -> Click on the search -> Input text -> Click finish
code snippet
var pkg = JavaImporter(org.openqa.selenium); //WebDriver classes
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait); //WebDriver classes
var wait = new support_ui.WebDriverWait(WDS.browser, );
var timeunit = java.util.concurrent.TimeUnit
WDS.sampleResult.sampleStart(); //captures sampler's start time
WDS.sampleResult.getLatency();
WDS.log.info("Sample started");
WDS.browser.get('http://duckduckgo.com'); //opens website specified in 'http://duckduckgo.com'
WDS.log.info("Sample ended - navigated to duckduckgo.com");
var searchField = WDS.browser.findElement(pkg.By.id('search_form_input_homepage')); //saves search field into searchField
searchField.click(); //clicks search field
searchField.sendKeys(['blazemeter']); //types word "blazemeter" in field
WDS.log.info("Searched for BlazeMeter");
var button = WDS.browser.findElement(pkg.By.id('search_button_homepage')); //Find Search button
button.click(); //Click Search Button
WDS.log.info("Clicked on the search button");
var link = WDS.browser.findElement(pkg.By.cssSelector('#r1-0 > div > h2 > a.result__a > b')); //also saves selector as variable but uses CSS.
link.click(); //Click the search result's Link
// Set the total request timeout for the entire transaction
WDS.browser.manage().timeouts().pageLoadTimeout(,timeunit.SECONDS);
WDS.sampleResult.sampleEnd();When debugging scripts , open debug Logs are convenient for debugging .
summary
be based on jmeter Extensions for WebDriver And combine it with js Write test cases , Can achieve WEB End to end automated testing .jmeter Yes, inheritance can be provided Samlper Sampler development extended sampler ,WebDriver The principle of plug-in development is also based on this feature . But the use of jmeter do WEB End to end automated testing can be done but is not suitable for . So if you have the ability to develop , Let's write an automated script .
边栏推荐
- EMC輻射發射整改-原理案例分析
- Day16QtQLabel2021-10-22
- Vscode custom template, take notes with the template?!
- Creating and extending XFS file system based on LVM
- 2022年买理财产品买三个月还是半年?
- C++ primer Chapter 2 summary of variables and basic types
- JS special effects in the construction of animated web pages
- 【一起上水硕系列】Day Two
- Must the database primary key be self incremented? What scenarios do not suggest self augmentation?
- Li Kou today's question 1108 IP address invalidation
猜你喜欢
![[3. binary integer and floating point number]](/img/82/6c3ef250b90d875cddaebc5bd4a4b8.png)
[3. binary integer and floating point number]

Wechat applet film and television review and exchange platform system graduation design completion (7) Interim inspection report

C++ primer Chapter 2 summary of variables and basic types

Technical exploration: 360 digital subjects won the first place in the world in ICDAR OCR competition

关于PMP考试,你想知道的知识都在这里了

Ioerror: no translation files found for default language zh cn Solutions for

Live broadcast on June 22 | zhanzhihui, South China Institute of Technology: evolutionary computing for expensive optimization

从数据库的分类说起,一文了解图数据库

Right and left vertical time axis with serial number

The brand, products and services are working together. What will Dongfeng Nissan do next?
随机推荐
【8、一维前缀和】
EMC rectification tips
Microblog closes publishing multiple part-time fraud information illegal accounts: how to crack down on data fraud
Graphacademy course explanation: Fundamentals of neo4j graph data science
UnionPay payment return merchant nignx post request 405
With the acceleration of industry wide digital transformation, what kind of storage will be more popular?
PMP pre exam guide on June 25, you need to do these well
In 2022, the number of mobile banking users in Q1 will reach 650million, and ESG personal financial product innovation will be strengthened
从数据库的分类说起,一文了解图数据库
关于PMP考试,你想知道的知识都在这里了
Unity3d post process volume profile
GetEmptyBlcoksPre Info
Wechat applet film and television comment exchange platform system graduation design (3) background function
Zap grammar sugar
【9. 子矩阵和】
[pit encountered in docekr learning]
FPGA-Xilinx 7系列FPGA DDR3硬件设计规则
【7. 高精度除法】
Flash back when GoLand starts
Day17QtQLcdNumber2021-10-22