On a continuation to my previous post regarding Testing Automation Tools, I will try to write the process through which I went while writing the testing scripts.
The application for which I wanted to do the automated testing is a web based application written in PHP on top of Zend Framework. As Zend Framework follows the MVC pattern, we followed the same pattern. For database, we wrote our own layer and didn’t use the layer which Zend Framework provided.
For testing automation I followed the same design rules, which I followed while designing and writing this application. I wrote testing scripts for each entity in their own files. Then I called them in one main file, which I run when I want to run the regression test. Following is an example configuration file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
//include all files, which are required to run the test cases _include("webadmin_login.sah"); _include("webadmin_company.sah"); _include("webadmin_user.sah"); _include("webadmin_group.sah"); _include("webadmin_homepage.sah") _include("webadmin_sysconfig.sah") //global variables _setGlobal("companyname", "Test_1"); // login login("admin", "admin"); // create company info createCompany("Test_1"); createUser("test1_user1"); createUser("test1_user2"); createUser("test1_user3"); createUser("test1_user4"); createGroup("test1_group"); // homepage startAll(); stopAll(); refresh(); // logout logout(); |
I treat this main script as my main configuration file. Where I declare some global variables, call those scripts which I need to run during my test run. I can include the scripts, which I need to run and can exclude those scripts which I don’t need.
I will continue with this series with further updates on how I wrote automated tests for every individual entity.