How to make a automated testing for web applications
来源:互联网 发布:mac注销用户快捷键 编辑:程序博客网 时间:2024/04/30 09:56
As a developer of web application(assume PHP developer),sometimes we have to have a test to the logics code we have done ..In general,someone think of the first way is using PHPUnit.yes here is the purpose i write this article here.so ,how could use PHPUnit to have a test ??? here is some reference below:
Some utilities:
1. Selenium Server (Click here)
2. WebDriver (Click here),it is used for driving the chrome browser by start a process.
3. PHPUnit (Click here)
4. The extension of PHPUnit Selenium..(for my instance,i use composer to install it ...."require-dev":{"phpunit/phpunit-selenium": ">=1.2"})
5. Show Time (something amazing.)
Procedure:
1. Start Selenium Server by executing command : java -Dwebdriver.chrome.driver=./chromedriver -jar selenium-server-standalone-xxx.jar (if an error occur,,maybe the version of java is to low in your local environment ,you need to install the lasted version)
2. after finishing above operations we can write some test cases.
3, here is a simple sample
<?phpnamespace Home\Controller;class WebTest extends \PHPUnit_Extensions_Selenium2TestCase{ protected function setUp() { $this->setBrowser('*chrome'); $this->setBrowserUrl('http://base.domain.com'); } public function testBanUser() { $this->url('/Auth/login.html'); $username = $this->byName('username'); $password = $this->byName('password'); $btn = $this->byClassName('btn'); $username->value('username'); $password->value('password'); $btn->click(); $this->url('/home/user/listusers'); $this->url('/home/user/info/id/1171708'); $banClickId = $this->byId('user-info-status-ban'); $banClickId->click(); // wait for ajax finished sleep(5); $this->refresh(); $banClickIdAgain = $this->byId('user-info-status-ban'); $this->assertTrue('Banned' == $banClickIdAgain->text()); } public function testFake() { $this->assertTrue(1 == 1); }}?>
- How to make a automated testing for web applications
- How to Succeed at Automated Testing
- Professional Pen Testing for Web Applications
- Performance Testing Guidance for Web Applications
- How to develop web applications?
- How to make a Point Grey camera work with DirectShow applications/ Drivers of USB3.0 Cameras
- How to make a terminal alias for Mac OS X
- How to Make a jQuery Plugin - Tutorial for Beginners
- How to make a Web crawler using Java?
- How To Make A Keygen
- How to make a patch
- how-to-make-a-rpg
- How to make a ipcamera
- How to Create Dump File for Applications
- How To Debug Web Applications With Firefox
- patterns & practices Performance Testing Guidance for Web Applications
- A Lazy Pen Tester’s Guide to Testing Flash Applications
- Ten ways to improve testing, performance of Web 2.0 applications
- Python:入门到实现网络爬虫 Day2
- 译文 | 从开发到部署 Docker容器命令总结
- Linux文件寻址
- win10 +keras +gpu
- Multiple dex files define问题另一种解法
- How to make a automated testing for web applications
- tomcat系列之 什么是tomcat
- Java集合深入学习:ArrayList的实现原理
- Python简明教程
- HDOJ2022
- 选项卡的完整代码~~还有一些自己copy
- not1,not2,bind1st和bind2nd详解
- HDOJ2024
- Studio用布局编辑器设计UI界面