2014-04-25 00:35
题目:没有专门的测试工具,你要如何对一个网页进行压力测试?
解法:拼手速,拼电脑数量呗。快捷键+复制粘贴网址,狂搞一番。话说回来,有脚本语言的情况下,直接写个脚本来模拟大量的访问行为肯定是更合理的,手速再快比不过程序。没有工具时,应该想着如何制造工具,而不是赤手空拳去搞。
代码:
1 // 12.4 How would you load test a webpage, if you're not allowed to use any test tools? 2 // Answer: 3 // As far as what I've learned, load testing is a testing method which puts the system under limited resources and exposes it to excessive pressure. 4 // 1. Browser side: 5 // 1.a. Use a PC with low configuration, but it must sufficient to see the webpage. 6 // 1.b. Use various browsers to see their different performances. 7 // 1.c. Open multiple instances of this webpage, see if it fails to respond. 8 // 2. Server side: 9 // 2.a. Deploy the web server on a server(maybe a PC) with low configuration. 10 // 2.b. Try to visit it with multiple clients(many users at the same time). 11 // 2.c. If the system includes some storage, try to fill it up with POST or GET actions on the webpage. 12 int main() 13 { 14 return 0; 15 }