Abstract
In the current trend, Extreme Programing methodology is widely adopted by small and medium-sized projects for dealing with rapidly or indefinite changing requirements. Test-first strategy and code refactoring are the important practices of Extreme Programing for rapid development and quality support. The test-first strategy emphasizes that test cases are designed before system implementation to keep the correctness of artifacts during software development; whereas refactoring is the removal of “bad smell” code for improving quality without changing its semantics. However, the test-first strategy may conflict with code refactoring in the sense that the original test cases may be broken or inefficient for testing programs, which are revised by code refactoring. In general, the developers revise the test cases manually since it is not complicated. However, when the developers perform a pattern-based refactoring to improve the quality, the effort of revising the test cases is much more than that in simple code refactoring. In our observation, a pattern-based refactoring is composed of many simple and atomic code refactorings. If we have the composition relationship and the mapping rules between code refactoring and test case refactoring, we may infer a test case revision guideline in pattern-based refactoring. Based on this idea, in this research, we propose a four-phase approach to guide the construction of the test case refactoring for design patterns. We also introduce our approach by using some well-known design patterns and evaluate its feasibility by means of test coverage.
Similar content being viewed by others
Notes
The Apache Ant Project, http://ant.apache.org/
References
Ambler, S. W. (2007). Test-driven development of relational databases. IEEE Software, 24(3), 37–43.
Baudry, B., Le Traon, Y., Sunye, G., & Jezequel, J. M. (2001). Towards a 'safe’ use of design patterns to improve oo software testability. In Software reliability engineering, 2001. ISSRE 2001. Proceedings. 12th international symposium on, pp. 324–329.
Beck, K., & Andres, C. (2004). Extreme programming explained: Embrace change. United States: Addison-Wesley Professional.
Chatzigeorgiou, A., & Manakos, A. (2010). Investigating the evolution of bad smells in object-oriented code. In Proceedings of the 7th international conference on the quality of information and communications technology. IEEE Computer Society.
Cherfi, S., Comyn-Wattiau, I., & Akoka, J. (2008). Quality patterns for conceptual modelling. Conceptual Modeling-ER 2008, pp. 142–153.
Cinnéide, M. O., & Nixon, P. (1998). Composite refactorings for java programs. In Proceedings of the workshop on formal techniques for java programs. ECOOP workshops.
Dasiewicz, P. (2005). Design patterns and object-oriented software testing. In Electrical and computer engineering, 2005. Canadian conference on, pp. 904–907.
Eclemma. (2011). Tech. rep., Eclipse community. Also available as http://www.eclemma.org/index.html.
Enns, R. (2004). Refactoring in eclipse. Canada: University of Manitoba.
Fowler, M., Beck, K., Brant, J., Opdyke, W., & Roberts, D. (1999). Refactoring: Improving the design of existing code. United States: Addison-Wesley.
France, R., Chosh, S., Song, E., & Kim, D. (2003). A metamodeling approach to pattern-based model refactoring. IEEE Software 20(5):52–58.
France, R.B., Kim, D.K., Sudipto, G., & Song, E. (2004). A uml-based pattern specification technique. IEEE Transactions on Software Engineering 30(3):193–206.
Freeman, E., Freeman, E., Bates, B., & Sierra, K. (2004). Head first design patterns. United States: O’Reilly & Associates Inc.
Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1994). Design patterns: Elements of reusable software. United States: Addison-Wesley.
Guerra, E. M., & Fernandes, C. T. (2007). Refactoring test code safely. In Proceedings of the international conference on software engineering advances (ICSEA 2007).
Hsueh, N. L., Chu, P. H., Chu, W. (2008). A quantitative approach for evaluating the quality of design patterns. The Journal of Systems and Software, 81(8), 1430–1439.
Hsueh, N. L., Chu, P. H., Shen, H. H., & Chang, C. H. (2009). A semi-automatic approach for test case traceability in a test-driver development. In Workshop on accountability and traceability in global software engineering (ATGSE 2008).
Hsueh, N. L., Kuo, J. Y., & Lin, C. C. (2009). Object-oriented design: A goal-driven and pattern-based approach. Software and Systems Modeling, 8(1), 67–84.
Hsueh, N. L., Lee, K. W., & Hwang, S. C. (2009). Requirements trade-off analysis for test-first development. In International conference on advanced information technologies.
Jeon, S. U., Lee, J. S., & Bae, D. H. (2002). An automated refactoring approach to design pattern-based program transformations in java programs. In Proceedings of the ninth Asia-Pacific software engineering conference, p. 337. IEEE Computer Society.
Kerievsky, J. (2005). Refactoring to patterns. United States: Pearson Education.
Khriss, I., Keller, R. K., Hamid, I. A. (2000). Pattern-based refinement schemas for design knowledge transfer. Knowledge-Based Systems 13(6), 403–415.
Lippert, M., Becker-Pecbau, P., Breitling, H., Koch, J., Kornstadt, A., Roock, S., Schmolitzky, A., Wolf, H., & Zullighoven, H. (2003). Developing complex projects using xp with extensions. Computer, 36(6), 67–73.
Mens, T., & Tourwé, T. (2004). A survey of software refactoring. IEEE Transactions on software engineering, 30(2), 126–139.
Meszaros, G. (2006). xUnit test patterns: Refactoring test code. Upper Saddle River, NJ, USA: Prentice Hall PTR.
Metsker, S. J., & Wake, W. C. (2006). Design patterns in java. United States: Addison-Wesley Professional.
Meyer, B. (1997). Object-oriented software construction (2nd edn.).
Moore, I. (2001). Jester-a junit test tester. In Proceedings of 2nd XP, pp. 84–87.
Opdyke, W. F. (1992). Refactoring: A program restructuring aid in designing object-oriented application frameworks. Ph.D. thesis.
Pipka, J. U. (2002). Refactoring in a ‘test first’-world. In Proceedings of third international conference on eXtreme programming and flexible processes in software eng.
Poole, C., & Huisman, J. (2001). Using extreme programming in a maintenance environment. IEEE softwate, 42–50.
Soundarajan, N., Hallstrom, J. O., Shu, G., & Delibas, A. (2008). Patterns: From system design to software testing. Innovations in Systems and Software Engineering, 4(1), 71–85.
van Deursen, A., & Moonen, L. (2002). The video store revisited–thoughts on refactoring and testing. In Proceedings of 3rd international conference ons eXtreme programming and flexible processes in software engineering, pp. 71–76.
van Deursen, A., Moonen, L., van den Bergh, A., & Kok, G. (2001). Refactoring test code. In Proceedings of the 2nd international conference on extreme programming and flexible processes in software engineering (XP2001), pp. 92–95.
Widmer, T. (2007). Unleashing the power of refactoring. Eclipse Magazine. http://www.eclipse.org/articles/article.php?file=Article-Unleashing-the-Power-of-Refactoring/index.html.
Winn, T., & Calder, P. (2002). Is this a pattern? IEEE Software,19(1), 59–66.
Acknowledgments
This research was sponsored by Department of Industrial Technology, Ministry of Economic Affairs in Taiwan ROC under the Grant NSC98-2220-E-035-003. We would also like to thank deeply the anonymous reviewers for their valuable comments and feedbacks.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Chu, PH., Hsueh, NL., Chen, HH. et al. A test case refactoring approach for pattern-based software development. Software Qual J 20, 43–75 (2012). https://doi.org/10.1007/s11219-011-9143-x
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11219-011-9143-x