Skip to main content

A method for model based test harness generation for component testing


We present a model-based testing approach that allows the automatic generation of test artifacts for component testing. A component interacts with its clients through provided interfaces, and request services from other components through its required interfaces. Generating a test artifact that acts as though it were the client of the component under test is the easiest part, and there already exists tools to support this task. But one needs also to create substitute of the server components, which is the hardest part. Although there are also tools to help with this task, it still requires manual effort. Our approach provides a systematic way to obtain such substitute components during test generation. Results of the application of the approach in a real world component are also presented.


  1. B. Abreu et al. Automatic Test Data Generation for Path Testing using a New Stochastic Algorithm. In Proceedings of19th Brazilian Symposium on Software Engineering (SBES), Uberlandia, pp. 247–262, 2005.

  2. T. Anderson, P. Lee. Fault Tolerance: Principles and Practice, 2nd edition. Prentice-Hall, 1990.

  3. T. Anderson, et al. Protective wrapper development: A case study.Lecture Notes in Computer Science, 2580: pp. 1–14, 2003.

    Article  Google Scholar 

  4. D. Barbosa et al. Spaces — a tool for component’s functional testing (in portuguese). In Proceedings ofXVIII Brazilian Symposium of Software Engineering — XI Tool Session. pp. 55–60, 2004.

  5. K. Beck. Test Driven Development: By Example. Addison-Wesley Longman Publishing Co., Inc., Boston, 2002.

    Google Scholar 

  6. B. Beizer. Sofware Testing Techniques, 2nd Edition. International Thomson Computer Press, 1990.

  7. A. Bertolino, G. De Angelis, A. Polini. A QoS Test-Bed Generator for Web Services.Lecture Notes in Computer Science, 4607:17–31, 2007.

    Article  Google Scholar 

  8. R. Binder. Testing object-oriented systems: models, patterns, and tools. Addison-Wesley Longman Publishing Co., Inc, 1999.

  9. L. Briand, Y. Labiche. A uml-based approach to system testing. In Proceedings of4th International Conference on The Unified Modeling Language, Modeling Languages, Concepts, and Tools. Springer-Verlag, London, pp. 194–208, 2001.

    Google Scholar 

  10. L. Briand, Y. Labiche, Y. Wang. An investigation of graph-based class integration test order strategies.IEEE Trans. on Software Engineering, 29(7):594–607, 2003.

    Article  Google Scholar 

  11. G. Bundell et al. A software component verification tool. InProceedings of International Conference on Software Methods and Tools (SMT). IEEE Computer Society Press, pp. 137–146, 2001.

  12. P. Brito, et. al. A method for modeling and testing exceptions in component-based software development.Lecture Notes in Computer Science, 3747:61–79, 2005.

    Article  Google Scholar 

  13. J. Chessman, J. Daniels.UML Components: A Simple Process for Specifying Component-Based Software. Paperback, 2002.

  14. S. H. Edwards. Black-box testing using flowgraphs: an experimental assessment of effectiveness and automation potential.Software Testing, Verification and Reliability, 10(4):249–262, 2000.

    Article  Google Scholar 

  15. M. Fowler. Mocks aren’t stubs. mocksArentStubs.html. Apr-2007.

  16. F. Fraikin, T. Leonhardt. Seditec: Testing based on sequence diagrams. In Proceedings of17th IEEE international conference on Automated software engineering. IEEE Computer Society, Washington, p.261, 2002.

    Google Scholar 

  17. J. Gao. Component testability and component testing challenges. In: Proceedings ofStar’99, 1999.

  18. J. Gao et al. Testing and Quality Assurance for Component-Based Software. Artech House Inc., 2003.

  19. A. Ghosh, M. Schmid, and V. Shah. Testing the robustness of Windows NT software. In Proceedings of9 th International Symposium on Software Reliability Engineering (ISSRE ’98). Los Alamitos, CA, pp 231–235, 1998.

  20. S. Gorts. Unit testing with hand crafted mocks., Jun. 2006.

  21. P. Guerra et al. A dependable architecture for cotsbased software systems using protective wrappers.Lecture Notes in Computer Science, 3069:144–166, 2003.

    Article  Google Scholar 

  22. G. Kaiser, et al. Infuse: Fusing integration test management with change management. In Proceedings of13 th Annual International Computer Software and Applications Conference. Orlando, pp. 552–558, 1989.

  23. E. Lloyd, B. Malloy. A study of test coverage adequacy in the presence of stubs.Journal of Object Technology,, 2004.

  24. T. Mackinnon, S. Freeman, P. Craig. Endotesting: Unit testing with mock objects. .html, 2000.

  25. G. Meszaros. A pattern language for automated testing of indirect inputs and outputs using xunit. In Proceedings of11th Conference on Pattern Languages of Programs (PLoP2004), 2004.

  26. ObjectMentorInc., Jun. 2007.

  27. OMG, 2004a. UML 2.0 Superstructure Final Adopted Specification. URL=

  28. OMG, 2004b. UML 2.0 Testing Profile Specification., 2005.

  29. I. Perez, et al. Using UML Models in Component Testing (in Portuguese). In Proceedings ofBrazilian Workshop on Fault—Tolerant Computing (WTF), 2007.

  30. C. Rocha, E. Martins. A strategy to improve component testability without source code. In: Beydeda, S. et al. (Eds.),SOQUA/TECOS. Vol. 58 of LNI. GI, pp. 47–62, 2004.

  31. S. Sinha, M. Harrold. Analysis and testing of programs with exception handling constructs.Software Engineering, 26(9): 849–871, 2000.

    Article  Google Scholar 

  32. S. Stewart. Approaches to mocking. 2004/02/11/mocks.html, 2004.

  33. R. Taylor et al. A component- and message-based architectural style for gui software. IEEE Transactions on Software Engineering 22 (6), 390–406, 1996.

    Article  Google Scholar 

  34. E. J. Weyuker. Testing component-based software: a cautionary tale. IEEE Software, 15(5): 54–59, 1998.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations


Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 2.0 International License ( ), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Reprints and permissions

About this article

Cite this article

Rocha, C.R., Martins, E. A method for model based test harness generation for component testing. J Braz Comp Soc 14, 7–23 (2008).

Download citation

  • Issue Date:

  • DOI: