A Unique Open-Source Integration Testing Framework Developed

    Read more in php|Architect, June 2010 article "Integration Testing with phpRack Framework" by Yegor Bugayenko.

    Unit tests plus continuous integration gives you a guarantee that most of your source code defects will be caught before they reach end users. Unit tests verify the code beforehand and a continuous integration server informs you if a defect is found right before deployment. It's a proven mechanism used in the majority of products striving for quality, but who can guarantee that if a defect is found after deployment, it is reported immediately before disappointed end users find it? Integration tests can effectively do this.

    To be short, "Integration Testing" is similar to unit testing; however, the testing subject is not the software itself, but its deployment environment. With integration tests, you're verifying whether your product is located in a comfortable place and is ready for end users. Unit tests verify your product one-by-one, where integration tests verify you one-by-one. Sound weird? This article explains the concept and its implementation in phpRack; the open-source framework. phpRack framework is written in PHP, but can be used for the integration testing of products written in any other web-oriented language including Java, Python, Ruby, etc.

    Let's start with a simple example. Imagine that you developed a web-system and prepared it for delivery to your customer. You created complete and detailed installation instructions where you explained the requirements to the server-side system software configuration. Despite your efforts, very soon you receive a complaint from the customer: "The system is full of bugs and we can't make it work!" But you know for sure that the product is properly tested and works on your local machine. You understand that the problem is in the installation within the customer's server environment. How do you explain to the customer where the problem is and how to fix it?

    One option is to do the work yourself. Ask the customer for root access to the server, debug the software there, find the problems, fix them, and make the customer happy. This solution is very common, but is also a very costly and risky method. First, you don't know how much time this procedure might take. Second, you might unintentionally break other products on the same server. Third, you will become responsible for the server and this installation forever. Fourth, ...the list of possible problems is endless. The bottom line is that this manual approach, although very common, is the worst option.

    Integration tests are a great alternative. You create small, supplementary software modules (called "integration tests") that are executed on the production server and validate critical environment parameters. For example, version of PHP, availability of PHP extensions, version of MySQL, database access permissions, accessibility of network ports, read/write access permissions of log files and directories, etc. (Some of my products have 50 or more different integration tests). In addition to the integration tests, you need software that will start all of them together and report a summary result in a user-friendly format. Then, you can show this report to the customer, indicating the problems with the server. Once they are fixed, your product works as if it is being installed on your local machine; easy!

    phpRack simplifies this work and lets you write integration tests fast and easy. It is the first unique product of its kind. phpRack is a free, open-source product.

    Last update on
    © TechnoPark Corp., 2000-2015 ISO logo