Friday, February 22, 2008

Web Testing Framework released

This week I released my first open source testing project.

Hanno is a test automation framework in Java for dynamic model-based exploratory testing of web applications. It can be used to develop an automated testing tool for most web applications.

Hanno is built on several open standards and tools:

  • SCXML, an XML language based on Harel state charts.

  • Apache Commons SCXML, an SCXML implementation in Java.

  • Watij, a web application testing tool in Java.

Hanno implements a model-based test automation approach. To test a web application with Hanno, an SCXML model is created to describe the application behavior. A Java class is created with methods for each event or state in the model. Each method calls Watij code to execute the event in Internet Explorer, or to verify that the browser is in the correct state. The Java class is run by an engine with a simple algorithm to determine which event to execute next. The order of test execution is not predetermined.

Modeling a web application in SCXML is not difficult, but does require familiarity with state charts or finite state machines. I found SCXML quite easy to learn and understand. Hanno includes a simple example application to help get started.

Debugging a Hanno test tool can be a complex process, however, because it requires getting the SCXML model and the Java code that the model executes to work together and both be correct at the same time.

I recommend starting small, by modeling a simple behavior of your web application, testing it, getting it to work, then adding behavior incrementally.

I have used Hanno to test several web applications. With experience, a simple model of a web application's navigation can be built in a day or two. A more complex model with hundreds of events and states may require several weeks or a month. The end result can be a test tool than can do the work of hundreds of hand-crafted automated tests, run continuously, and find new bugs because new test sequences are executed on each run.

I developed Hanno primarily to meet my own needs and to implement my own concepts for how a model-based testing tool should work. It can certainly be improved, especially in the area of debugging and error handling. Java developers interested in test automation are welcome to join the project.

I encourage the software testing community to download Hanno and kick the tires. Please use the Hanno forums for any detailed questions or feedback.

Wednesday, February 13, 2008

The human context of quality

Recently the universe decided to test me to see how strong my commitment to software quality really was.

Last September my previous employer laid off its entire engineering staff. I interviewed with several companies, and was quickly hired as a senior test engineer at an Internet commerce company that sells publicly available personal information online. I had some concerns about working for a company that enables "spying on people", as one friend of mine put it. I also knew from prior experience that many public records contain outdated or inaccurate information. But it seemed on the surface to be a good opportunity to use my experience to help build a software quality department from the ground up.

After arriving, I learned that this company did software development very differently than any company I had worked for. The software development, quality assurance, and release cycle seemed deeply flawed to me. New features were released almost every day, with only minimal testing by developers, and no time for QA to plan thorough testing before release.

I had previously worked in Agile environments with release cycles measured in weeks, and on hot fix releases that had to go out in a day or two, but only to specific customers for whom the benefit of a quick fix outweighed the risk of a quick release. Working at this company was like doing a patch release to everyone in the world, every day.

I have a lot of experience testing web applications, and realized that in such an environment, I would be unable to catch most of the defects before release. To be fair, defects found in production were fixed quickly. Still, I saw no way to be successful as I usually define it. Still I did the best I could for as long as I could.

Was this company wrong to develop software this way? Some would say no. For example, in the context-driven approach to software testing, there are no best practices that apply to the entire software industry. QA exists to provide information to the development team, nothing more. QA must use processes that are appropriate to the business and the practices of a company, whatever they are. Releasing lightly tested code would be criminal in the aerospace or medical industries, but for an e-commerce company selling public information, it might not be.

I still thought it was wrong. Even when a company has good customer support, and the worst consequence of a customer getting charged for bad information is a refund, the software has still wasted the customer's time and created unnecessary confusion and stress in their lives. The corporate context is not the only context that matters. Software that interacts with human beings should treat them humanely.

I saw little chance of convincing the company of that view. After all, they had been doing this for years, and their company was growing and seemed to be doing well financially. Some of the people I would have to convince to change the development process had designed that process in the first place. These same folks owned a lot of stock in the company, and were set to make millions when the company went public. Why should they listen to me?

I did some testing of my own. I proposed various small changes to the software process that were well justified and should have been relatively uncontroversial. I couldn't get my development manager to approve any of them.

The conflict between the company's values and my own began to create more and more stress for me. I finally reached a point where the stress of having to find a new job seemed less terrible than what I was experiencing every day. Three months after I started, after a particularly bad day, I resigned.

I don't blame the employer for the mismatch. It's hard to see a values conflict coming until you experience it. Still, there were signs in the interview that I should have paid more attention to, and questions that I could have asked but did not. The experience has helped me to a deeper understanding of what type of work environment I need, and what types of companies I would consider working for in the future.