Automated Testing Of Web Applications Using XML


Published on

css 2002 presentation

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Automated Testing Of Web Applications Using XML

  1. 1. Automated Testing of Web Applications using XML dIon Gillard, Multitask Consulting Pty Ltd
  2. 2. Agenda <ul><li>What is a Web Application? </li></ul><ul><li>Testing Web Apps </li></ul><ul><ul><li>Code-based testing </li></ul></ul><ul><ul><li>Data driven testing </li></ul></ul><ul><li>Tools </li></ul><ul><li>Automating test case creation </li></ul><ul><li>Automating tests </li></ul><ul><li>Comparison to Commercial Tools </li></ul>
  3. 3. What is a Web Application <ul><li>We’ll be concentrating on J2EE Web Applications </li></ul><ul><li>A lot of the tools and concepts can be applied to other technologies </li></ul><ul><li>Web Applications consist of: </li></ul><ul><ul><li>Server side resources </li></ul></ul><ul><ul><ul><li>JSPs, Servlets, Java code, configuration </li></ul></ul></ul><ul><ul><li>Client side resources </li></ul></ul><ul><ul><ul><li>HTML, images, JavaScript </li></ul></ul></ul>
  4. 4. Testing Web Applications – ‘Field Experience’ <ul><li>Developers test localised changes have had the desired effect </li></ul><ul><li>Without automated testing a complete regression test is impractical </li></ul><ul><li>Application yo-yos from good to bad, working to broken frequently </li></ul><ul><li>Users have little confidence in the application and wait for a ‘release’ </li></ul><ul><li>Large effort goes into QA for a release </li></ul>
  5. 5. Testing Web Applications – Why? <ul><li>There are lots of ways to test, we aren’t going to cover all of them </li></ul><ul><li>Testing usually has a purpose </li></ul><ul><ul><li>Does the code work </li></ul></ul><ul><ul><li>Does the application perform well </li></ul></ul><ul><ul><li>Does it respect security requirements </li></ul></ul><ul><ul><li>Can it handle load </li></ul></ul><ul><ul><li>Does it match business requirements </li></ul></ul><ul><ul><li>… . </li></ul></ul>
  6. 6. Testing web applications - How <ul><li>We’re going to be focussing on ‘functional testing’, a.k.a. Black-box testing </li></ul><ul><li>“ Testing that ignores the internal mechanism of a system or component and focuses solely on the outputs generated in response to selected inputs and execution condition” </li></ul><ul><li>IEEE Standard Computer Dictionary: A Compilation of IEEE Standard Computer Glossaries </li></ul>
  7. 7. Testing Web Applications - Implications <ul><li>Looking at web applications from a user’s perspective - Does it do what I want, how I want it done? </li></ul><ul><li>What the code does is a side-effect for the user </li></ul><ul><li>Users expect a web application to be an ‘application’, regardless of how the data is displayed or the functionality accessed </li></ul><ul><li>User interface is still very important, however, so layout, along with look and feel must still be tested </li></ul>
  8. 8. Testing Web Applications – What to test <ul><li>Interactions between the user and the application </li></ul><ul><li>Expected Inputs </li></ul><ul><ul><li>input fields, hidden fields etc, query string or URL additions </li></ul></ul><ul><li>Unexpected inputs </li></ul><ul><ul><li>no password, field lengths, numerical domains etc </li></ul></ul><ul><li>Error conditions </li></ul><ul><ul><li>Messages to the user, code ‘failure’ Error 500 </li></ul></ul><ul><li>Expected processing </li></ul><ul><ul><li>Processing succeeds or fails </li></ul></ul><ul><li>Expected output </li></ul><ul><ul><li>Results of next page, database updates, messages queued etc </li></ul></ul>
  9. 9. Code based Testing <ul><li>Tools such as JUnit rely on developers creating ‘test cases’ in code to ensure correctness </li></ul><ul><li>This has all the advantages and disadvantages of developers writing code </li></ul><ul><li>Several tools have been released that allow this development to be more productive, less tedious and the code more reusable </li></ul><ul><li>Writing low-level code makes it hard to focus on what the testing is for </li></ul>
  10. 10. HttpUnit <ul><li>Freeware ‘Browser emulator’ for use in JUnit test cases (and other places) </li></ul><ul><li>Written in Java, provided as a jar developers would use </li></ul><ul><li>Takes care of authentication, cookies, page redirection </li></ul><ul><li>Provides resulting pages as a DOM via NekoHTML </li></ul><ul><li>HTML pages don’t have to have valid XML syntax to be parsed </li></ul>
  11. 11. HttpUnit - Sample WebConversation conversation = new WebConversation(); WebRequest request = new GetMethodWebRequest( &quot;;); WebResponse response = conversation.getResponse(request); WebForm loginForm = response.getForms()[0]; request = loginForm.getRequest(); response = conversation.getResponse( request ); assertTrue( &quot;Login not rejected&quot;, response.getText().indexOf(&quot;Login failed&quot;) != -1 );
  12. 12. HttpUnit – API <ul><li>Classes are available for creating requests in various ways (WebRequest) </li></ul><ul><li>Working with the HTTP response (WebResponse) return code, text, headers, cookies etc </li></ul><ul><li>Working with HTML artifacts </li></ul><ul><ul><li>getDOM </li></ul></ul><ul><ul><li>getForms(), getFormWithName(name), getTables() getLinks(), getLinkWith(text) </li></ul></ul><ul><li>Forms can be ‘submitted’ after retrieval from the response </li></ul>
  13. 13. HttpUnit – Pros and Cons <ul><li>Code can be repetitive and tedious </li></ul><ul><li>Working at a low level, you can lose sight of what is being done </li></ul><ul><li>Each WebRequest is created in isolation in a test </li></ul><ul><li>Testing a web application is typically a single host and URI, code is needed to unify tests </li></ul><ul><li>Based on JUnit, is easy to automate </li></ul><ul><li>Simple clear API is easy to understand </li></ul>
  14. 14. HtmlUnit <ul><li>Similar in scope to HttpUnit, but with a focus on HTML documents rather than the HTTP protocol details like requests, responses etc </li></ul><ul><li>Better JavaScript support </li></ul><ul><li>API is easier to relate to user interaction, e.g. clicking links and pressing buttons </li></ul><ul><li>Wrapper objects for every html element </li></ul><ul><li>Browser specific features can be used to fake the browser version and vendor </li></ul>
  15. 15. HtmlUnit - continued <ul><li>Can track frames, iframes, pop up windows </li></ul><ul><li>Listener to handle new windows being opened as part of interaction or JavaScript </li></ul><ul><li>Can easily access the other windows </li></ul><ul><li>Tab-order can be retrieved and checked </li></ul><ul><li>Assertion helper methods for unique ids, accessibility </li></ul><ul><li>Full access to the actual DOM i.e. editable </li></ul>
  16. 16. HtmlUnit – Sample form submit WebClient client = new WebClient(); URL url = new URL(&quot;;); HtmlPage page = (HtmlPage) client.getPage(url); // find form by id HtmlForm form = page.getFormById(“mainForm”); // ‘type’ text into the userId field HtmlInput input = form.getInput(“userId”); input.setValue(“dion”); // submit – note existing values provided in the page // are ‘automatically’ filled in form.submit();
  17. 17. ServletUnit <ul><li>Companion tool shipped with HttpUnit </li></ul><ul><li>For when you need to do less black box and more white box testing </li></ul><ul><li>Simulates a servlet container by providing Mock Objects </li></ul><ul><li>Provides API for accessing the ‘Invocation Context’ </li></ul><ul><li>Other tools such as Cactus provide a fully-featured in-container environment </li></ul>
  18. 18. ServletUnit – Sample code ServletRunner sr = new ServletRunner(); sr.registerServlet(&quot;myServlet&quot;, StatefulServlet.class.getName()); // create a client and request ServletUnitClient sc = sr.newClient(); WebRequest request = new PostMethodWebRequest( &quot;; ); request.setParameter( &quot;color&quot;, &quot;red&quot; ); InvocationContext ic = sc.newInvocation( request ); // call service ic.getServlet().service(request, ic.getResponse()); // test response, session, servlet instance variables etc assertNotNull(&quot;Session was not created&quot;, ic.getRequest().getSession( false ) );
  19. 19. StrutsTestCase – What is it? <ul><li>JUnit extension for testing code based on the Apache Struts web app framework </li></ul><ul><li>Provides Mock Objects for simulating the servlet container </li></ul><ul><li>Also provides an in-container Cactus extension (CactusStrutsTestCase) </li></ul><ul><li>Switching approaches means changing parent class to/from StrutsTestCase </li></ul>
  20. 20. StrutsTestCase – How does it work? <ul><li>Tests are based around Struts Actions </li></ul><ul><li>There are methods available for hooking into the Struts request lifecycle </li></ul><ul><li>Extra assert-like methods for checking the Struts environment, like forwards and action errors </li></ul>
  21. 21. StrutsTestCase - Sample … public void testFailedLogin() { // setup parameters to pass to the action addRequestParameter(&quot;username&quot;,&quot;deryl&quot;); addRequestParameter(&quot;password&quot;,&quot;express&quot;); // set up the path to identify the action setRequestPathInfo(&quot;/login&quot;); // perform action processing actionPerform(); // check that the user has been forwarded to “login” verifyForward(&quot;login&quot;); // make sure the error for key ‘error.password.mismatch’ // is present in the request verifyActionErrors(new String[] {&quot;error.password.mismatch&quot;}); // make sure the session state is correct assertNull((String) getSession().getAttribute( &quot;authentication&quot;)); } …
  22. 22. Apache’s Cactus <ul><li>A framework for unit testing server side Java code </li></ul><ul><li>JUnit extension to make it easier to test Servlets, EJBs, Tag Libraries, Servlet Filters etc </li></ul><ul><li>Comes with ant tasks for automation </li></ul><ul><li>Uses a ‘proxy’ mechanism to redirect test case requests to a live servlet container </li></ul>
  23. 23. Apache’s Cactus - API <ul><li>Provides 3 Test classes to subclass from </li></ul><ul><ul><li>ServletTestCase, JspTestCase and FilterTestCase </li></ul></ul><ul><li>Code testXXX methods as per usual, except you need to instantiate the object to be tested (e.g. servlet) </li></ul><ul><li>beginXXX and endXXX methods can be coded to setup or post-process HTTP related parameters such as headers, return code, the response etc </li></ul>
  24. 24. Apache’s Cactus - Features <ul><li>Provides IDE integration for JBuilder, VAJava </li></ul><ul><li>EJB unit testing using Servlet ‘proxy’ </li></ul><ul><li>As it runs in-container, there is good documentation on setting up the proxy </li></ul><ul><li>Can integrate with HttpUnit and StrutsTestCase </li></ul>
  25. 25. XML-based Tools <ul><li>These tools rely on tests written in an XML format rather than java code </li></ul><ul><li>Output varies – can be HTML </li></ul><ul><li>They can be more easily generated </li></ul><ul><li>They are more ‘user’ friendly </li></ul><ul><li>Take away the reliance on technical skills to build tests </li></ul><ul><li>Work at a higher level and allow more focus on what is being tested and how </li></ul>
  26. 26. Apache’s Latka <ul><li>Functional testing tool that uses XML to define a series of HTTP(S) requests </li></ul><ul><li>Validations for the responses are defined as child elements of the requests </li></ul><ul><li>Has a command prompt interface </li></ul><ul><li>Can run tests via JUnit </li></ul><ul><li>Can run tests interactively via a web-app </li></ul><ul><li>Latka is moving to use Jelly as it’s XML processor </li></ul>
  27. 27. Apache’s Latka – Document Definition <ul><li>Suite </li></ul><ul><ul><li>top level element for a set of tests </li></ul></ul><ul><ul><li>Provides default host, port and a label </li></ul></ul><ul><li>Session </li></ul><ul><ul><li>Wrapper for a set of requests that share HTTP state </li></ul></ul><ul><li>Request </li></ul><ul><ul><li>A HTTP request to be executed </li></ul></ul><ul><ul><li>Path, method (“get”), host, port, label </li></ul></ul><ul><li>Validate </li></ul><ul><ul><li>Holds all validations for a specific request </li></ul></ul>
  28. 28. Apache’s Latka - Validations <ul><li>Bytelength – length of the response </li></ul><ul><li>Cookie – presence of a cookie </li></ul><ul><li>maxRequestTime </li></ul><ul><li>Regexp – tests the response matches a regular expression </li></ul><ul><li>statusCode – e.g. 200, 404 </li></ul><ul><li>XPath – test the response matches an XPath expression </li></ul>
  29. 29. Apache’s Latka - Sample <ul><li><suite defaultHost=&quot;; label=&quot;Taglibs&quot;> </li></ul><ul><li><session> </li></ul><ul><ul><ul><ul><li><request path=&quot;/taglibs/&quot; label=&quot;home page&quot;> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><validate> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><statusCode /> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><regexp pattern=&quot;Welcome to Jakarta Taglibs!&quot;/> </li></ul></ul></ul></ul><ul><ul><ul><ul><li></validate> </li></ul></ul></ul></ul><ul><ul><ul><ul><li></request> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><request path=“/logon”> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><param><paramName>user</paramName> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><paramValue>dion</paramValue></param> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><param><paramName>password</paramName> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><paramValue>dionspwd</paramValue></param> </li></ul></ul></ul></ul><ul><ul><ul><ul><li><validate><statusCode /> </li></ul></ul></ul></ul><ul><ul><ul><ul><li></request> </li></ul></ul></ul></ul><ul><li></session> </li></ul><ul><li></suite> </li></ul>
  30. 30. Apache’s Latka – Running Tests <ul><li>Command prompt </li></ul><ul><ul><li>Latka.bat file:./TestSite.xml </li></ul></ul><ul><li>JUnit </li></ul><ul><ul><li>public static Test suite() { </li></ul></ul><ul><ul><li>TestSuite suite = new TestSuite(); </li></ul></ul><ul><ul><li>String fileName = &quot;tests/samples/TestCommonsWebsite.xml&quot;; suite.addTest( </li></ul></ul><ul><ul><li>JUnitTestAdapter.createTestFromFile(fileName)); </li></ul></ul><ul><ul><li>return suite; </li></ul></ul><ul><ul><li>} </li></ul></ul>
  31. 31. Apache’s Latka <ul><li>Also provides validators as tags for Jelly </li></ul><ul><li>Automate via JUnit Ant task </li></ul><ul><li>Listeners can be attached to pick up test events as they happen </li></ul><ul><li>XML and Simple (console) reporter provided </li></ul><ul><li>XSL Style sheet provided to produce text from report </li></ul>
  32. 32. Apache’s Jelly <ul><li>Java and XML based scripting and processing engine </li></ul><ul><li>Jelly ‘scripts’ are XML documents which get parsed </li></ul><ul><li>Scripts are then ‘executed’ to produce XML, HTML, text etc </li></ul><ul><li>XML elements can be bound to java code similar to JSP custom tags and Ant tasks </li></ul>
  33. 33. Apache’s Jelly - Taglibs <ul><li>Core: catch, choose, expr, forEach, if, file, import, include, jelly, new, otherwise, set, thread, when, whitespace </li></ul><ul><li>Xml: attribute, copy, copyOf, element, expr, forEach, if, parse, set </li></ul><ul><li>Define: attribute, bean, invoke, invokeBody, jellyBean, script, tag, taglib, </li></ul><ul><li>Sql: dateParam, driver, param, query, setDataSource, transaction, update </li></ul>
  34. 34. Apache’s Jelly – Taglibs (Continued) <ul><li>JSL: applyTemplates, style, stylesheet, template </li></ul><ul><li>Ant: ant, filescanner </li></ul><ul><li>Werkz: attain, attainGoal, goal, postAction, postGoal, preAction, preGoal, project </li></ul><ul><li>Jeez: target, tagDef </li></ul><ul><li>Log: debug, error, fatal, info, trace, warn </li></ul><ul><li>Ojb: broker, store </li></ul>
  35. 35. Apache’s Jelly – Taglibs (Continued) <ul><li>JMS: connection, destination, mapEntry, mapMessage, message, objectMessage, property, receive, send, textMessage </li></ul><ul><li>Validate: verifier, validate, assertValid </li></ul><ul><li>Http: delete, get, header, post, put </li></ul><ul><li>Interaction: ask </li></ul><ul><li>Antlr: antlr, grammar </li></ul><ul><li>Util: tokenize </li></ul><ul><li>Html: parse </li></ul>
  36. 36. Apache’s Jelly – Taglibs (Continued) <ul><li>JUnit: assert, assertEquals, case, fail, run, suite </li></ul><ul><li>Swing: action, component, windowListener </li></ul><ul><li>Quartz: cronTrigger, job, waitForScheduler </li></ul><ul><li>Betwixt: introspector, parse </li></ul>
  37. 37. Apache’s Jelly - Testing <ul><li>Provides </li></ul><ul><ul><li>a JUnit tag library </li></ul></ul><ul><ul><li>a HTTP tag library </li></ul></ul><ul><ul><li>a ‘cron’ like facility </li></ul></ul><ul><ul><li>an expression language </li></ul></ul><ul><li>Integration with JMS, SQL etc allows page results to be checked against the database or queue </li></ul>
  38. 38. Apache’s Jelly - Sample <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><j:jelly </li></ul><ul><li>xmlns:j=&quot;jelly:core&quot; </li></ul><ul><li>xmlns:log=&quot;jelly:log&quot; </li></ul><ul><li>xmlns:v=&quot;jelly:org.apache.commons.latka.jelly.validators.HttpValidatorTagLibrary&quot; </li></ul><ul><li>xmlns=&quot;jelly:org.apache.commons.latka.jelly.HttpTagLibrary&quot; </li></ul><ul><li>trim=&quot;false&quot;> </li></ul><ul><ul><li><session> </li></ul></ul><ul><ul><li><get var=&quot;mtc&quot; uri=&quot;;/> </li></ul></ul><ul><ul><li><j:if test='${mtc.statusCode == 200}'> </li></ul></ul><ul><ul><li>request ok </li></ul></ul><ul><ul><li></j:if> </li></ul></ul><ul><ul><li>Results for mtc url are: </li></ul></ul><ul><ul><li>http return code = ${mtc.statusCode} </li></ul></ul><ul><ul><li>http status text = '${mtc.statusText}' </li></ul></ul><ul><ul><li>size of result = ${mtc.responseBodyAsString.length()} </li></ul></ul><ul><ul><li>response time = ${mtc.responseTime} </li></ul></ul><ul><ul><li></session> </li></ul></ul><ul><li></jelly> </li></ul>
  39. 39. Apache’s Jelly - Sample <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><j:jelly xmlns:j=&quot;jelly:core“ xmlns:log=&quot;jelly:log&quot; </li></ul><ul><li>xmlns:v=&quot;jelly:org.apache.commons.latka.jelly.validators.HttpValidatorTagLibrary&quot; </li></ul><ul><li>xmlns=&quot;jelly:org.apache.commons.latka.jelly.HttpTagLibrary“> </li></ul><ul><ul><li><session> </li></ul></ul><ul><ul><li><post var=&quot;jdc“ </li></ul></ul><ul><ul><li> uri=&quot;;> </li></ul></ul><ul><ul><li><parameter name=&quot;action&quot; value=&quot;login&quot; /> </li></ul></ul><ul><ul><li><parameter name=&quot;url&quot; value=&quot;/developer/index.jshtml&quot; /> </li></ul></ul><ul><ul><li><parameter name=&quot;UserId&quot; value=&quot;XXXX&quot; /> </li></ul></ul><ul><ul><li><parameter name=&quot;Password&quot; value=&quot;XXXX&quot; /> </li></ul></ul><ul><ul><li></post> </li></ul></ul><ul><ul><li>jdc login result = ${jdc.statusCode} </li></ul></ul><ul><ul><li>good login = ${jdc.responseBodyAsString.indexOf(&quot;Sorry!&quot;) == &quot;-1&quot;} </li></ul></ul><ul><ul><li><v:regexp pattern=&quot;Sox.y!&quot; var=&quot;jdc&quot;> </li></ul></ul><ul><ul><li><request-failed var=&quot;jdc&quot;>bad pattern 1</request-failed> </li></ul></ul><ul><ul><li></v:regexp> </li></ul></ul><ul><ul><li></session> </li></ul></ul><ul><li></jelly> </li></ul>
  40. 40. XMLUnit <ul><li>JUnit extension providing comparison between XML docs </li></ul><ul><li>XML can come from lots of places: Strings, DOM, Reader </li></ul><ul><li>Accepts ‘browser-friendly’ HTML as input </li></ul><ul><li>Can validate against a DTD </li></ul>
  41. 41. JXWeb <ul><li>XML Script ‘language’ and extension to JXUnit </li></ul><ul><li>Uses HttpUnit under the covers </li></ul><ul><li>No JUnit integration </li></ul><ul><li>Not as easily extendable as Jelly </li></ul>
  42. 42. JXWeb – Scripting Language <ul><li>jxw – top level element </li></ul><ul><li>httpGet, postXml – to retrieve data </li></ul><ul><li>setRequestParameter, setCookie, setHeader </li></ul><ul><li>getLink, getTableValue, getFormParameter, getForm, getTable </li></ul><ul><li>ifEqual, isNull, loop, doLoop, exception, ifNull, save, subst, ifEqualLength, isEqual </li></ul><ul><li>Echo, set, loadProperties </li></ul>
  43. 43. JXWeb - Sample <jxw> <set name=&quot;req&quot; value=&quot;;/> <httpGet response=&quot;response1&quot;/> <save name=&quot;respText&quot; file=&quot;list.html&quot;/> <getTable name=&quot;myTable&quot; tableIndex=&quot;0&quot;/> <getTableValue name=&quot;tableValue&quot; table=&quot;myTable“ row=&quot;0&quot; column=&quot;0&quot;/> <isEqual name=“tableValue&quot; value=&quot;Every Good Beer Deserves Froth“ message=“page is missing froth&quot;/> </jxw>
  44. 44. AntEater – Ant Functional Testing <ul><li>Testing framework designed around Ant </li></ul><ul><li>Supplied as a set of Ant tasks and types </li></ul><ul><li>Integrates easily into an existing build or IDE </li></ul><ul><li>Comes with a servlet container built-in to allow for ‘call backs’ </li></ul>
  45. 45. Ant Eater - Tasks <ul><li>Action Tasks </li></ul><ul><ul><li>httpRequest </li></ul></ul><ul><ul><li>soapRequest </li></ul></ul><ul><ul><li>Listener </li></ul></ul><ul><li>Match – groups multiple tests </li></ul><ul><li>Tests </li></ul><ul><ul><li>Listening: method, parameter, sendResponse </li></ul></ul><ul><ul><li>Header, contentEquals, regexp, responseCode, xpath, relaxng </li></ul></ul>
  46. 46. Ant Eater – Other tags <ul><li>Session </li></ul><ul><li>Logger – minimal, plain, colour, xml </li></ul><ul><li>forEach </li></ul><ul><li>Group – a way of grouping variables, sessions and loggers </li></ul><ul><li>servletContainer – start internal tomcat </li></ul><ul><li>Deploy – deploy web apps </li></ul>
  47. 47. Ant Eater - Sample … <target name=&quot;checkonline&quot;> <httpRequest path=&quot;/&quot;> <match assign=&quot;online&quot;><responseCode value=&quot;200&quot;/> </match> </httpRequest> </target> <target name=&quot;hitserver&quot; if=&quot;online&quot;> <echo>We're online!</echo> <httpRequest path=&quot;/&quot;> <match assign=&quot;apache&quot;> <header name=&quot;Server“ value=&quot;Apache/1.3.24 (Unix) Debian GNU/Linux&quot;/> </match> <match assign=&quot;unknownserver“/> </httpRequest> </target>
  48. 48. Limitations <ul><li>XML as a programming language isn’t </li></ul><ul><ul><li>Not as expressive </li></ul></ul><ul><ul><li>Tedious syntax for non-techies </li></ul></ul><ul><ul><li>Usually not as extensible </li></ul></ul><ul><li>Limits the interaction with external data sources </li></ul><ul><ul><li>Other than Jelly, most don’t have a mechanism for dealing with java objects outside their framework </li></ul></ul>
  49. 49. Automating Test Case Creation <ul><li>One of the main reasons developers give for limited testing is limited time </li></ul><ul><li>Developers are actually happy to test if it isn’t a significant drain on achievements </li></ul><ul><li>Testing pages or servlets helps developers think of error conditions that could easily crop up </li></ul>
  50. 50. Automated Creation - JMeter <ul><li>JMeter is often thought of as a load testing tool only </li></ul><ul><li>It also has a ‘proxy server’ mode where you can record browser activity </li></ul><ul><li>It can filter out requests for images or other resources using a regexp </li></ul><ul><li>It can also be used to ‘assert’ text is present on a request </li></ul>
  51. 51. Automated Creation – ‘Homer’ <ul><li>Microsoft freebie tool in IIS 5.0 resource kit </li></ul><ul><li>Under windows acts as a proxy and records requests coming in </li></ul><ul><li>Usually used for load testing </li></ul><ul><li>Stores data in an Access .mdb file </li></ul><ul><li>Simply queries can transform this into XML and then into Latka or Jelly etc </li></ul><ul><li>Merged into VS.NET toolset </li></ul>
  52. 52. Automated Testing <ul><li>Once the tests are created the next thing is to get them run on a regular basis </li></ul><ul><li>This means application and developer confidence grows </li></ul><ul><li>Depending on the tool this can be achieved using the operating system and a build tool </li></ul>
  53. 53. Apache’s Ant <ul><li>Java based build tool </li></ul><ul><li>Has JUnit tasks as part of the ‘optional’ tasks </li></ul><ul><li>Can be scheduled using operating system constructs </li></ul><ul><li>Can provide email about failures </li></ul>
  54. 54. CruiseControl <ul><li>Open source tool from ThoughtWorks </li></ul><ul><li>Provides a way to kick off Ant builds based on source repository changes </li></ul><ul><li>This allows the automation of the tests to be done when the source code changes </li></ul><ul><li>Ensures that the application passes all tests </li></ul><ul><li>Flags immediately when the application breaks </li></ul>
  55. 55. Commercial Tools <ul><li>LoadRunner from Mercury Interactive </li></ul><ul><ul><li>Provides access to XML data from the scripting language </li></ul></ul><ul><ul><li>More geared toward load testing </li></ul></ul><ul><li>Astra QuickTest from Mercury Interactive </li></ul><ul><ul><li>Web testing, built-in script creation via browser, cross browser tests from same test case, extract details from browser objects </li></ul></ul><ul><ul><li>Supports Flash, Real etc </li></ul></ul>
  56. 56. Commercial Tools <ul><li>Rational RobotJ </li></ul><ul><ul><li>Eclipse based tool </li></ul></ul><ul><ul><li>Uses proprietary scripting language </li></ul></ul><ul><ul><li>Does auto-record, regular expressions </li></ul></ul><ul><ul><li>Approx 1.3GB space </li></ul></ul><ul><li>WebLoad </li></ul><ul><ul><li>Similar features to higher cost tools </li></ul></ul><ul><ul><li>Multiple server support, higher load focus </li></ul></ul><ul><ul><li>Supports JavaScript </li></ul></ul><ul><ul><li>GUI and Command line driven </li></ul></ul>
  57. 57. Commercial Tools - continued <ul><li>High end Java IDEs such as WebSphere Studio Application Developer 5 now include testing tools </li></ul><ul><ul><li>Some can not be automated </li></ul></ul><ul><ul><li>Compete with other vendors in same tool space </li></ul></ul>
  58. 58. Summary <ul><li>There are simple tools available now that can alleviate the drudgery of functional testing </li></ul><ul><li>Users can help write the functional tests </li></ul><ul><li>Automation and repetition are key </li></ul><ul><li>Choose how far you want to take testing </li></ul><ul><li>Be consistent </li></ul><ul><li>Allow for learning curve on new tools and technologies </li></ul><ul><li>Mike Bowler’s Session on Test Driven Design </li></ul>
  59. 59. Resources <ul><li>Ant </li></ul><ul><ul><li> </li></ul></ul><ul><li>HttpUnit </li></ul><ul><ul><li> </li></ul></ul><ul><li>JMeter </li></ul><ul><ul><li> </li></ul></ul><ul><li>JUnit </li></ul><ul><ul><li> </li></ul></ul><ul><li>Latka </li></ul><ul><ul><li> </li></ul></ul>
  60. 60. Resources (Continued) <ul><li>StrutsTestCase </li></ul><ul><ul><li> </li></ul></ul><ul><li>JXWeb </li></ul><ul><ul><li> </li></ul></ul><ul><li>Cactus </li></ul><ul><ul><li> </li></ul></ul><ul><li>XMLUnit </li></ul><ul><ul><li> </li></ul></ul>
  61. 61. Resources (Continued) <ul><li>Homer </li></ul><ul><li>HtmlUnit </li></ul><ul><li>WebLoad </li></ul><ul><li>Jelly </li></ul>
  62. 62. Contact <ul><li>Here all week </li></ul><ul><li>Q ‘n’ A sessions </li></ul><ul><li>[email_address] </li></ul>