A Self-Configuring Test Harness for Web Applications
description
Transcript of A Self-Configuring Test Harness for Web Applications
A Self-Configuring Test Harness for Web Applications
Jairo PavaSchool of Computing and
Information SciencesFlorida International University
Courtney EnoexSchool of Applied Sciences and
ArtsSouthern Illinois University
8/1/2008REU Summer Program
Florida International University School of Computing and Information Sciences
Yanelis HernandezPhD Student
Peter J. ClarkeResearch Mentor
• Many web application technologies
• NoNo standard test script language
• ComplexComplex web applications make testing difficult
• MigrationMigration of technologies inefficient
• CostCost of software testing accounts for fifty to seventy-five percent of total development costs
Motivation 2
Presentation Content
• Motivation
• Objectives
• Background
• Problem Statement
• Approach
• Implementation
• Results
• Conclusions / Pending Work
• Acknowledgements
• Questions
3
Background 5
• Testing web application is necessary
• Complex web applications make testing difficult
• Regression testing points to code modification that make previously functional code to fail
• Allows the ability to catch errors as they are introduced
• Subtle changes in code can introduce errors
Test Case ComponentsTest Case Components
ID A name given to each test case
Purpose The aspect of the application that will be tested
SetupCreation testing environment(will not interferewith real settings)
Input Show how the application interacts with the Setup data
Expected output If the output is what was expected, the test passes
Background 6
Literature Review
Ruby on Rails [2]Ruby on Rails [2]• Released in 2004• Provides scaffolding, WEBrick, and Rake
• Helpful tools are ready for use
PHPUnit [3]PHPUnit [3]• Simple pass/fail reporting• Use with PHPUnit Database Extension
• Compare (seeded) database contents with an expected dataset
An Integrated Self-Testing Framework for Autonomic Computing Systems An Integrated Self-Testing Framework for Autonomic Computing Systems • King, et al• Authors developed integrated testing for autonomic systems
4
Testing ToolsTesting Tools
Problem Statement
To develop a web application test harness that dynamically configures its test suite to generate and execute platform specific test scripts.
7
Approach
• FastBooks.com e-commerce web application
• Web Technologies used• Ruby on Rails 1.2• PHP 5
• Testing Tools• Ruby 1.2• PHPUnit 3.2.21
• Code Coverage Analysis Tool• RCOV 0.8.0• Xdebug 2.0.3
8
Approach 9
Approach 10
TestCase(“TC001_ValidateBook_SunnyDay”)
ProcedureEntry(“TC001_PE001”)
CreateAction( Dict.ObjectType, “product”, parameters )
ProcedureEntry(“TC001_PE002”)
InputAction( Dict.VarType, “price”, parameters )
ProcedureEntry(“TC001_PE003”)
AssertAction( Dict.AssertTrue, “valid”, parameters )
Ruby on Rails Model
AddCreateSyntax( Dict.ObjectType, “[VarName] = [ClassName].new([ParamList])”)
AddInputSyntax( Dict.VarType, “[ObjectName].[VarName] = [VarValue]” )
AddAssertSyntax( Dict.AssertTrue, “assert [ObjectName].[VarName]?” )
ClassName Product
ParamList “Book Title”, 0.00
CreateAction Parameters
ObjectName product
AssertAction Parameters
Implementation
InputAction Parameters
ObjectName product
VarValue 9.99
11
require File.dirname(__FILE__) + '/../test_helper'
class ProductTest < Test::Unit::TestCase
def test_positive_price
product = Product.new(:title => "Book Title", :price => 0.00 )product.price = 9.99assert product.valid?
end end
Implementation 12
TestCase(“TC001_ValidateBook_SunnyDay”)
ProcedureEntry(“TC001_PE001”)
CreateAction( Dict.ObjectType, “product”, parameters )
ProcedureEntry(“TC001_PE002”)
InputAction( Dict.VarType, “price”, parameters )
ProcedureEntry(“TC001_PE003”)
AssertAction( Dict.AssertTrue, “valid”, parameters )
PHPUnit Model
AddCreateSyntax( Dict.ObjectType,
“$this -> [varName] = new [ClassName]([paramList]);” )
AddInputSyntax( Dict.VarType,
“$this -> [ObjectName] -> [VarName]( [VarValue] );” )
AddAssertSyntax( Dict.AssertTrue,
“$this -> assert( $this -> [ObjectName] -> [varName]( ) );” )
Implementation 13
ClassName Product
ParamList “Book Title”, 0.00
CreateAction Parameters
ObjectName product
AssertAction ParametersInputAction Parameters
ObjectName product
VarValue 9.99
require once "phpunit.php"require once "product.php"
class productTest extends TestCase{
function test_positive_price(){
$this -> product = new Product(“Book Title", 0.00);$this -> product -> price( 9.99 );$this -> assert( $this -> product -> valid() );
} }
Implementation 14
Ruby on Rails 1.2
RCOV 0.8.0
PHPUnit 3.2.21
Xdebug 2.0.3
Implementation 15
• Accurate detection of web technologies by monitor
• Correct selection of model for test script generation
• Proper syntax of platform specific test script
• Successful execution in testing tool
Evaluation 16
• Test script generation needs improvement• Abstract syntax trees
• Increase support for different types of testing
• More web technology support
• Easier integration of web technology models
Limitations and Future Work 17
• Utilize concepts of autonomic computing to reduce human interaction
• Automatically test web applications
• Determine code coverage
• Interpret results
• More efficient migration of web application test scripts
• Standard test script language
• Improve quality of test cases developed
Conclusions 18
Acknowledgements
Florida International University
19
National Science Foundation, Grant
# IIS-0552555,Research
Experience for Undergraduates:
Autonomic Computing at FIU
Dr. Masoud Milani
Yanelis Hernandez, Tariq M. King
Dr. Peter Clarke
Dr. Tao Li, Dr. Raju Rangaswami, Dr. Masoud Sadjadi
References
•[1] PHPUnithttp://www.phpunit.de/
•[2] PHPhttp://www.php.net
•[3] Ruby on Railshttp://www.rubyonrails.org/
•[4] Xdebughttp://www.xdebug.org/
•[5] RCOVhttp://www.asp.net
•[6] Software Debugging, Testing, and VerificationIBM Systems Journal 2002
• [7] An Integrated Self-Testing Framework for Autonomic Computing SystemsTariq M. King, Alain E. Ramirez, Rodolfo Cruz, Peter J. Clarke
20
Questions?
Comments?
End 21