I am developing web application in PHP and I want to test signup functionality, only my php scripts not GUI because GUI is not yet developed properly. Recently I came through Selenium. After hitting my head against wall, I realized it is useful only for GUI testing. If want to test I should go through PHPUnit only. Am I correct ?? Or any suggestions ??
3 Answers
As a general rule you should have a mixture of unit tests integration tests and GUI tests in your application. People often refer to the automation testing triangle to guide them, this basically states that you should have a large number of unit tests, a smaller number of integration tests, an even smaller number of GUI tests and at the tip of the triangle, a small number of manual tests. All of these tests have a different purpose, your unit tests will test isolated “units” of functionality to prove that they work in isolation whereas your GUI tests will test your whole system.
Comments
If you like to test functionalities of your Web Application and not the graphical representation of your web application you see in your browser, you should use PHPUnit.
If you also use MVC frameworks like symfony or zend framework to build your web application, appliyng PHPUNit-Tests is straight forward. Identitfy your Unit, which contains your functionality and write a corresponding TestCase.
In your case the "sign-up" functionality might be an action within an MVC-Controller, so you have to write a MVC-Controller-Unit-Test like this one for example: http://www.phpriot.com/manual/zf/zend.test.phpunit.testing