improving test case generation for web applications using
play

Improving Test Case Generation for Web Applications Using Automated - PowerPoint PPT Presentation

Improving Test Case Generation for Web Applications Using Automated Interface Discovery William G.J. Halfond and Alessandro Orso Georgia Institute of Technology Web Application Overview Request Web http://host?login=alice&pin=1234


  1. Improving Test Case Generation for Web Applications Using Automated Interface Discovery William G.J. Halfond and Alessandro Orso Georgia Institute of Technology

  2. Web Application Overview Request Web http://host?login=alice&pin=1234 Application DB HTML HTML Pages Servlets End Users Web Server Other Systems

  3. Testing Web Applications Parameter grouping public void write(File outfile, String buffer, int length) Domain information

  4. Testing Web Applications void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) // generate second registration page else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else // generate initial registration page int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  5. Testing Web Applications void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) // generate second registration page else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else // generate initial registration page int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  6. Testing Web Applications void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) // generate second registration page else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else // generate initial registration page int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  7. Testing Web Applications void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) // generate second registration page else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else // generate initial registration page int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  8. Testing Web Applications void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) // generate second registration page else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else // generate initial registration page int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  9. Testing Web Applications void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) // generate second registration page else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else // generate initial registration page int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  10. Approaches to Web Application Testing Developer-specified models Black-box analysis Ricca and Tonella, ICSE 2001 Huang et. al., WWW 2003 Elbaum et. al., WODA 2006 Captured user-sessions Kallepalli and Tian, TSE 2001 Static code analysis Sprenkle et. al., ASE 2006 Deng et al., SEN 2004 Elbaum et. al., ICSE 2003

  11. Goal of Our Approach Web Application Interfaces HTML Servlets • Input parameters • Domain information Develop a technique to automatically discover all of the interfaces to a web application

  12. Presentation Outline • Definitions • Interface Discovery Algorithm • Empirical Evaluation • Conclusions and Future Work

  13. void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) http://host?login=alice&pin=1234 String requestedLogin = req.getParam(“login”) Definitions: int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) 1. Input Parameter else if (formAction.equals(“personalInfo”)) String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else … int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  14. void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) Definitions: int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) 1. Input Parameter else if (formAction.equals(“personalInfo”)) 2. Parameter Function String name = req.getParam(“name”) int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else … int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  15. void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) Definitions: int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) 1. Input Parameter else if (formAction.equals(“personalInfo”)) 2. Parameter Function String name = req.getParam(“name”) 3. Domain Operations int zip = getNumParam(req, “zip”) if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else … int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  16. void main(Request req) String formAction = req.getParam(“formAction”) if (formAction.equals(“chooseLogin”)) String requestedLogin = req.getParam(“login”) Definitions: int pin = getNumParam(req, “pin”) registerLogin(requestedLogin, pin) 1. Input Parameter else if (formAction.equals(“personalInfo”)) 2. Parameter Function String name = req.getParam(“name”) 3. Domain Operations int zip = getNumParam(req, “zip”) 4. Web Interface if (zip == 30318) finishRegistration(id, name) else error(“You do not live in 30318”) else … int getNumParam(Request req, String paramName) String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

  17. Interface Discovery Algorithm Web Application HTML Phase 1 Phase 2 Interfaces Servlets Phase 1: Compute domain information for each Input Parameter Phase 2: Identify names of Input Parameters and group them into distinct interfaces

  18. Phase 1: Compute Domain Information Web Application Web Application HTML Phase 1 with domain information annotations Servlets For each call to a Parameter Function: 1. Infer domain information by • Following def-use chains involving the return value • Considering operations performed on the uses 2. Annotate call site accordingly

  19. void main(Request req) Phase 1 String formAction = req.getParam("formAction”) Extract domain if (formAction.equals("chooseLogin” )) information. String requestedLogin = req.getParam("login") int pin = getNumParam(req, "pin") String “chooseLogin” registerLogin(requestedLogin, pin) “personalInfo” else if (formAction.equals("personalInfo")) String name = req.getParameter("name") String int zip = getNumParam(req, "zip") if (zip == 30318) Numeric finishRegistration(id, name) else String error("You do not live in 30318" ) Numeric else … “30318” int getNumParam(Request req, String paramName) Numeric String paramValue = req.getParam(paramName) int param = Integer.parseInt(paramValue) return param

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend