How to develop a modular code base based on PyUnit
Audio : Listen to This Blog.
Quality assurance is more than just a process. It is a carefully executed study which eventually adds to and affects the credibility of your product or service. How can you go about taking the right steps for Quality Assurance in your company? We’d like to share a recent predicament one of our clients went through.
Our client is a leading manufacturer of high performance computing systems.
What was the problem?
This client recently came up to us with a very specific requirement. They came up to us with a vision to be able to create an all-inclusive test framework.“Owing to our extensive systems, we wanted to develop a modular code base that could easily be extended by a broad team. We wanted a framework that acts like an improvement over the existing testing frameworks- and we wanted these based on technologies as PyUnit.” said the product manager.
As we realized, PyUnit is not a mature enough tool to undertake end-to-end testing. And so, in order to achieve end-to-end testing, our customer would need to set up new hardware, virtual clusters, and databases, and file systems. This setup creation and configuration was not only a very painstaking option, but also a very costly enterprise.
Our client also wanted to use Python or Bash as required as the test case automation language. In addition, they wanted to make the test cases data-driven rather than script-driven. For instance: creating a file system with 4, 8, or 16 NSD servers and do load testing on it. These test cases reports needed to be ported to Rally and Jenkins; so that charting and easy deep-diving would be possible for identifying issues and test failures.
So how did we help?
We designed a framework that looked something like this-
To begin with, we recommended a YAML based test case definitions where the tester can provide test data, pre-setup modules to run, actual test modules and post-test modules.
TC: TC1161 # Rally test case ID for reporting pre_module: autoconfigure tags: realhw,couplet test_modules: network_shutdown:node=oss0:NICS=ib0, sleep:TIME=10m,check_fs_mounted
A test processing engine executed the test modules in Bash or Python scripts. As you may know, these are scripts that can use PyUnit or Selenium as required. The solution involved a meta-layer for managing test cases and encapsulate all test cases within a single framework.
The test cases were tagged according to where they can be run. “realhw” as shown above means the test was run on real hardware. Test modules that were developed were data-driven; exactly as our desired by the client, so that the code duplication issue is minimized.
The best part about this arrangement is that it helps QA professionals greatly as they only need to write new YAML data when needed.
To successfully execute this project we used tools like- YAML, PyUnit, JUnit, Jenkins and Selenium.
And we are all winners!
Throughout this project our main aim was to reduce the additional infrastructure that the client may require; and to extend the capability of PyUnit and Selenium to use universal test case creation and execution.
We were able to achieve all this, while our client also reaped benefits like-
- Quick execution and high cost-effectiveness
- A framework so that the QA engineers only need to provide new test case data in simple language.
- New test cases can be executed across any testing framework.
A happy client always makes us happy!