Linux Automation Framework
Novell Cool Solutions: Feature
By Yatin P. Manerker
Digg This -
Posted: 2 Nov 2006
- Basic block Diagram of the Framework
- Explanation of Block
- Configuring the Automation Server for Framework
- Using the Tool
- Design Details
- Script Details
- Customizing the Tool
It is often noticed that if you want to run the automated test on a remote server then one thing you require is an agent running on the server so that all of the commands given from the controller is executed on the server. The agent is the small piece of code which resides on the test server and activates a port on the test server, so the commands given from the controller will be executed on the test server.
I have designed a small framework which will not require any agent running on the test server machines. The need for implementing such a tool occurs mostly in case of testing an application which requires the installation of a fresh OS for each phase of testing. This happens when the server itself is in the development stage or an application running on the server is changing continuously for each iteration and which requires the server should be freshly installed. When the OS (build) itself is changing, then the agent which is configured on the OS needs to be configured again and again for each new installation.
This framework will be used to start any test on a Linux server without having any agent running on the server. Different scripts can be plugged into the framework.
* Note: All operations are performed using ssh.
2. Basic Block Diagram of the Framework:
3. Explanation of Block:
The Automation server has all of the scripts it requires to test the remote server. From the client machine all the details about the test can be entered . The Automation server will take all the input parameters and it will contact the remote test server. Once authentication is done, the automation server will transfer the script to the test server and it will start the script on the test server.
Test results will be sent back to the user once the test is completed.
* Note: Sendmail code should be there in test script.
4. Configuring the automation server for framework:
For configuring this tool you should have SLES9 server with Apache installed.
- Step 1: Create a directory called automation-framework in /srv/www/htdocs
- Step 2: Extract the tar ball (html)and copy to /srv/www/htodocs/automation-framework
- Step 3: Extract the tar ball (scripts) to /scripts locations. Create a directory called /scripts.
- Step 4: Start apache server
- Step 5: From any client open the web page http://<IP address of the automation server>/automation-framework
5. Using the tool:
From any client machine open the automation framework page.
Enter the IP address, and password of the remote server. Select the script and substitute the parameters for the type of test. For arguments of the script, refer to link "click here". Enter the email id if you want notification through mail. Click submit.
The following page shows the output results.
Note: This is the output results. This tool will give the notification of the test which is running on the server. Your scripts should have a code to mail the output results.
6. Design details:
The front end of the tool is designed using HTML and PHP. There are some PHP shell functions which are used.
Expect is used in back end. The Expect script will take the input from the web page as parameters and it will contact the test server, copy the required script in the server, and execute.
7. Script details:
Scripts are divided into two types:
- Front end scripts
- Test scripts
- index.php (Index page which opens when you goto the automation link)
- submit.php (Display the results)
- usage.txt (Displays the usage of various scripts and their parameters)
- run1.exp (Expect scripts which will take the input parameters from the web page)
Note: In this script password of the automation server should be there. Currently it will show "novell" as the password. Replace novell with the password of the automation server.
- mail.pl (This script will take the email id entered in the first page and it will send the mail to the users notifying the start of the test on remote server)
Here are some sample PERL scripts for creating data sets. When the scripts are executed from the command prompt, it will ask for different inputs as parameters. The parameters are supplied from the front end HTML page.
8. Customizing the tool
This can be easily done in the following way:
- If you want to add New scripts in the tool. Copy the script to the script location. Add the entry in the index.php file for the script. <select name= "Script">
- Goto usage.txt file and enter the usage of the tool
- Goto submit.php file and make a new entry in the "if loop" for new script.
Any test scripts can be plugged in the automation framework.
- PHP -shell: http://us3.php.net/shell_exec
- Expect: http://aspn.activestate.com/ASPN/docs/ActiveTcl/8.4/expect4win/ex_usage.html
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com