Better Software - December 2007 - (Page 23) simultaneous users accessing a common potential source for a bug. When I was tion in the message that I might miss administration feature with just the right the one typing, I hadn’t noticed this be- while rapidly repeating the test. cause it was only a slight difference. I The test ran and passed as expected, kind of test data. Recently, I was manually testing a took note of this behavior to remind my- so I decided to change the test to use a Web application feature that allowed self to explore it further when I had longer input string in each field. I had an input string that was 255 characters long text-field inputs. Rather than count completed my current task. Once I had completed my testing task, long, so I changed the test, saved it, and and type in characters by hand to test the limits of the error-handling code, I used a I decided to investigate the behavior of ran it again. I noticed that the time to tool to generate test data. PerlClip is an the login page. Since the login attempt process this login attempt was much excellent tool for this task. One input page response times varied slightly, I longer than the previous attempt. To extype it helps you generate is “counter knew I needed to repeat a similar test plore further, I created a group of similar strings,” which are self-counting strings several times. I also wanted to design this tests in my JUnit class. I also added a of a user-determined length. If I tell Perl- test from an exploratory testing perspec- “teardown” method that closed Internet Clip to create a test string that is 255 tive, so it needed to be flexible enough Explorer after each test. The timing differences were obvious characters in length, it quickly generates for me to change on the fly and to vary it and adds it to the Windows clipboard. inputs. I created a new WatiJ test case when I used very small strings and very To use it, all I need to do is paste it into that would be run by the JUnit unit-test- large strings. I added a new test case that ing framework (see the StickyNotes for a had a counter string of 5,000 characters, the application. PerlClip helped speed public void testInputLength() throws Exception { things up for me, but my ie.textField(name, "user").set(System.getProperty("inputLength.10")); tests also involved logging ie.textField(name, "password").set(System.getProperty("inputLength.10")); out, shutting down the ie.button("Login").click(); browser, and starting over assertTrue(ie.containsText("Login Failure")); after each text input submis} sion. This was getting a bit redundant and repetitive; I Listing 1 was getting distracted, logging in and navigating through the link). I could now control the automated which was a deliberate input penetration application to get to the section I was test and observe the application from a attack. This time, the application failed, with a Java exception stack trace. Moditesting. Sometimes these distractions are different vantage point. Once I had a WatiJ test that would en- fying my set of tests, I was able to useful because I can explore interesting behavior outside the current testing fo- ter in a username and password, click the ascertain within a couple of minutes that cus, but in this case, I needed to minimize login button, and verify that a login error an input attack of 4,000 characters or distraction—I needed speed and precise message occurred, I began adding test more would cause an overflow error. I navigation. Since I was in a Java environ- data. I stored various kinds of PerlClip- wasn’t sure why the application was ment, I used the test automation tool generated test data in a Java “.properties” slowing down, but noticing this fact and Web Application Testing in Java (WatiJ) file, starting with counter strings of vari- designing tests using my automation to help out. WatiJ drives Internet Explorer ous lengths. I had some short strings and tools helped me quickly find an imporin much the same way an end-user would, some very long strings—much longer than tant bug. a typical username and password. I added A programmer came by while I was and it plays back scripts on your monitor. In minutes, I created a simple WatiJ a setup method to my JUnit test class that exploring my test results and saw the ertest that logged in with my test user ac- would create a new Internet Explorer ror message popping up on my screen. count and navigated through the browser instance, navigate to the login He pulled up a chair and sat with me. application to the section I wanted to test, page, and load the test data. Listing 1 “Cool. Are you using JUnit?” he asked as I demonstrated the failure for him. He and then it stopped. At that point, I took shows the test case. This JUnit test uses the WatiJ library asked for the test case so he could run it over the Web browser and entered my PerlClip-generated test data. I executed to run Internet Explorer, enter test data on his machine. Once he had fixed the my tests much more quickly and had the in the username and password fields, and code so that the JUnit “red bar” (test failadded benefit of observing the application click the login button on the login page. ure) had turned to a “green bar” (test without needing to type or use the In this case, it uses test data, which is passed), he called me over and demoncalled “inputLength.10,” meaning the strated it. We improved the test, checked mouse. This new observation perspective paid size of the test input is ten characters in it into source control, and started a new off. When my WatiJ test started a new length. It then does a JUnit assertion—a build. Using the computer as an automation Web browser instance and attempted to check on the result of the test. In this log in, I noticed the processing time for case, it asserts that an exact match of the tool, combined with my observation and login attempts varied slightly on each error message “Login Failure” occurs. investigation skills, we quickly got to the script run. This looked suspicious—a The assertion will catch any slight devia- bottom of a previously unnoticed bug. www.StickyMinds.com 23 DECEMBER 2007 BETTER SOFTWARE http://www.StickyMinds.com
Table of Contents Feed for the Digital Edition of Better Software - December 2007 Better Software - December 2007 Contents Mark Your Calendar What's Happening @ StickyMinds.com Technically Speaking Code Craft Test Connection Management Chronicles Man and Machine Let Your Values be Your Guide A Story About User Stories and Test-driven Development Product Announcements The Last Word Ad Index Better Software - December 2007 Better Software - December 2007 - Better Software - December 2007 (Page cover1) Better Software - December 2007 - Better Software - December 2007 (Page cover2) Better Software - December 2007 - Better Software - December 2007 (Page 1) Better Software - December 2007 - Better Software - December 2007 (Page 2) Better Software - December 2007 - Contents (Page 3) Better Software - December 2007 - Mark Your Calendar (Page 4) Better Software - December 2007 - Mark Your Calendar (Page 5) Better Software - December 2007 - Mark Your Calendar (Page 6) Better Software - December 2007 - Technically Speaking (Page 7) Better Software - December 2007 - Technically Speaking (Page 8) Better Software - December 2007 - What's Happening @ StickyMinds.com (Page 9) Better Software - December 2007 - Code Craft (Page 10) Better Software - December 2007 - Code Craft (Page 11) Better Software - December 2007 - Code Craft (Page 12) Better Software - December 2007 - Code Craft (Page 13) Better Software - December 2007 - Test Connection (Page 14) Better Software - December 2007 - Test Connection (Page 15) Better Software - December 2007 - Management Chronicles (Page 16) Better Software - December 2007 - Management Chronicles (Page 17) Better Software - December 2007 - Management Chronicles (Page 18) Better Software - December 2007 - Management Chronicles (Page 19) Better Software - December 2007 - Man and Machine (Page 20) Better Software - December 2007 - Man and Machine (Page 21) Better Software - December 2007 - Man and Machine (Page 22) Better Software - December 2007 - Man and Machine (Page 23) Better Software - December 2007 - Man and Machine (Page 24) Better Software - December 2007 - Man and Machine (Page 25) Better Software - December 2007 - Let Your Values be Your Guide (Page 26) Better Software - December 2007 - Let Your Values be Your Guide (Page 27) Better Software - December 2007 - Let Your Values be Your Guide (Page 28) Better Software - December 2007 - Let Your Values be Your Guide (Page 29) Better Software - December 2007 - Let Your Values be Your Guide (Page 30) Better Software - December 2007 - Let Your Values be Your Guide (Page 31) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 32) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 33) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 34) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 35) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 36) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 37) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 38) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 39) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 40) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 41) Better Software - December 2007 - A Story About User Stories and Test-driven Development (Page 42) Better Software - December 2007 - Product Announcements (Page 43) Better Software - December 2007 - Product Announcements (Page 44) Better Software - December 2007 - Product Announcements (Page 45) Better Software - December 2007 - Product Announcements (Page 46) Better Software - December 2007 - The Last Word (Page 47) Better Software - December 2007 - Ad Index (Page 48) Better Software - December 2007 - Ad Index (Page cover3) Better Software - December 2007 - Ad Index (Page cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.