Use of test cases

Before I have written tutorials Jmeter, the latter wrote a Selenium-based tool SeleniumGUI, now simply write a case study for jmetert and SeleniumGUI. Download link: https: //pan.baidu.com/s/1NxYc0q_Vd8_Tg40a6Q7Hhw, extraction code: thor.

This case is based on the preparation of the spring boot and spring MVC, it is to download a jar file. There are two ways to start:

1. double-click the downloaded jar file that can be started, this simple start-up mode, but can not specify parameters, you can not view the log, and locked up more trouble, need to go to the Task Manager, find the process, the process by the end of the task turn off the service, as shown below:

2. cmd command, open the console program, initiated by java -jar shopdemo.jar in the console.

This start-up mode, you can specify parameters in the startup command, such as specifying the memory used by the service and so on. Want to turn off the service, press Ctrl + c, or turn off the console page.

Access Services, open the browser, the address bar: localhost: 8080 you can, of course, you want to access on another computer, open the service to localhost into the ip address of the computer on it. Services of a total of two pages: login page and home page. The following business logic say about the service

Format validate the user name, password, authentication code, there are tips on the page. Validation logic, front end, a rear end there. But then think about it, it seems somewhat redundant back-end verification format, the format is not correct, than to the account, and certainly wrong. Registration function, only need to check the format. But since added, it does not get rid of. The correct user name and password is admin123.

Validation code rule: effective time of 5 minutes. 5 input error, failure force, of course, does not include the error malformed, format error, and are able to get to the logical comparison verification code. On the page, after the effective time or wrong five times, will automatically refresh verification codes.

Home, then have to sign in before they can access. After logging in, you will remain logged in, the time is written dead seven days, and the login page does not tick tick-free login does not matter. To clear logged in, the user name of the home page upper right corner, and then log off point on it. Currently home, it was only this function, the other is dead page.

服务限制了一秒钟,最多处理200个请求。超过的请求,会直接返回一个固定的字符串,至于是什么,大家自己尝试一下,就知道了。

至于获取验证码,提供了一个接口:localhost:8080/getVerifyCodeTest/{verifyKey},verifyKey,就是生成验证码时的verifyKey。使用Jmeter调用接口获取验证码,没什么问题,如果使用SeleniumGUI来获取验证码的话,就需要自己写扩展方法来实现了。扩展方法下载地址:https://pan.baidu.com/s/1VRViDaNRCqpWY9DUmpwMOA,提取码:daq4,下载完后,放到SeleniumGUI的lib/ext目录下,重启SeleniumGUI即可

这样,就可以获取验证码,并输入了。这个方法,不具有通用性,不要去测试别的网站用这个方法,行不通的。

好了,我前面说的业务逻辑,大家可以尝试使用Jmeter和SeleniumGUI来测试一下,有没有问题。不过,一秒钟限制访问200次,这个就只能用Jmeter玩了,SeleniumGUI是没法玩的。

发布了48 篇原创文章 · 获赞 9 · 访问量 4万+

Guess you like

Origin blog.csdn.net/kingzhsh/article/details/103976912