This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
Tool Support for Testing Concurrent Java Components
June 2003 (vol. 29 no. 6)
pp. 555-566
Brad Long, IEEE Computer Society

Abstract—Concurrent programs are hard to test due to the inherent nondeterminism. This paper presents a method and tool support for testing concurrent Java components. Tool support is offered through ConAn (Concurrency Analyser), a tool for generating drivers for unit testing Java classes that are used in a multithreaded context. To obtain adequate controllability over the interactions between Java threads, the generated driver contains threads that are synchronized by a clock. The driver automatically executes the calls in the test sequence in the prescribed order and compares the outputs against the expected outputs specified in the test sequence. The method and tool are illustrated in detail on an asymmetric producer-consumer monitor. Their application to testing over 20 concurrent components, a number of which are sourced from industry and were found to contain faults, is presented and discussed.

[1] G. Andrews, Concurrent Programming: Principles and Practice. Addison Wesley, 1991.
[2] C. Artho and A. Biere, Applying Static Analysis to Large-Scale, Multi-Threaded Java Programs Proc. 2001 Australian Software Eng. Conf., pp. 68-75, 2001.
[3] A. Bechini, J. Cutajar, C. Bochmann, and A. Petrenko, A Tool for Testing of Parallel and Distributed Programs in Message Passing Environments Proc. Ninth Mediterranean Electrotechnical Conf. 1998 (MELECONE98), vol. 2, pp. 1308-1312, 1998.
[4] A. Bechini and K.-C. Tai, Design of a Toolset for Dynamic Analysis of Concurrent Java Programs Proc. Sixth Int'l Workshop Program Comprehension, pp. 190-197, 1998.
[5] K. Beck, Extreme Programming Explained. Addison Wesley, 2000.
[6] M. Ben-Ari, Principles of Concurrent and Distributed Programming. Prentice Hall, 1990.
[7] P. Brinch Hansen, Reproducible Testing of Monitors Software Practice and Experience, vol. 8, pp. 721-729, 1978.
[8] X. Cai and J. Chen, Control of Nondeterminism in Testing Distributed Multithreaded Programs Proc. First Asia-Pacific Conf. Quality Software, 2000.
[9] R. Carver and K.-C. Tai, Deterministic Execution Testing of Concurrent Ada Programs Conf. Proc. Ada Technology in Context: Application, Development, and Deployment, pp. 528-544, 1989.
[10] R.H. Carver and K.C. Tai, "Replay and Testing for Concurrent Programs," IEEE Software, pp. 66-74, Mar. 1991.
[11] R.H. Carver and K.-C. Tai, Use of Sequencing Constraints for Specification-Based Testing of Concurrent Programs IEEE Trans. Software Eng., vol. 24, no. 6, pp. 471-490, 1998.
[12] J. Choi and H. Srinivasan, Deterministic Replay of Java Multithreaded Applications Proc. SIGMETRICS Symp. Parallel and Distributed Tools, pp. 48-59, 1998.
[13] E.M. Clarke, E.A. Emerson, and A.P. Sistla, Automatic Verification of Finite-State Concurrent Systems Using Temporal Logic Specifications ACM Trans. Programming Languages and Systems, vol. 8, no. 2, pp. 244-263, Apr. 1986.
[14] C. Corbett, M. Dwyer, J. Hatcliff, S. Laubach, C. Pasareanu, Robby, and H. Zheng, Bandera: Extracting Finite-State Models from Java Source Code Proc. 22nd Int'l Conf. Software Eng., 2000.
[15] J.C. Corbett, Constructing Compact Models of Concurrent Java Programs Proc. ACM SIGSOFT Int'l Symp. Software Testing and Analysis, pp. 1-10, 1998.
[16] N. Daley, D.M. Hoffman, and P.A. Strooper, A Framework for Table Driven Testing of Java Classes Software Practice and Experience, vol. 32, pp. 465-493, 2002.
[17] C. Demartini and R. Sisto, Static Analysis of Java Multithreaded and Distributed Applications Proc. Int'l Symp. Software Eng. for Parallel and Distributed Systems, pp. 215-222, 1998.
[18] O. Edelstein, E. Farchi, Y. Nir, G. Ratsaby, and S. Ur, Multithreaded Java Program Test Generation IBM Systems J., vol. 41, no. 1, pp. 111-125, 2002.
[19] M. Fowler, Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999.
[20] H. Gaifman, M. Maher, and E. Shapiro, Replay, Recovery, Replication, and Snapshots of Nondeterministic Concurrent Programs Proc. 10th Ann. ACM Symp. Principles of Distributed Computing, pp. 241-255, 1991.
[21] E. Gamma and K. Beck, JUnit Testing Framework available online athttp:/www.junit.org, 2002.
[22] J. Gosling and K. Arnold, The Java Programming Language, second ed. Addison Wesley, 1998.
[23] J. Gosling, B. Joy, G. Steele, and G. Bracha, The Java Language Specification, second ed. Addison Wesley, online athttp://java.sun.com/docs/books/jlsindex.html , 2000.
[24] S.J. Hartley, Concurrent Programming: The Java Programming Language. p. 55, Oxford Univ. Press, 1998.
[25] C. Harvey and P. Strooper, Testing Java Monitors through Deterministic Execution Proc. 2001 Australian Software Eng. Conf., pp. 61-67, 2001.
[26] J. Hatcliff and M. Dwyer, Using the Bandera Tool Set to Model-Check Properties of Concurrent Java Software Proc. 12th Int'l Conf. Concurrency Theory (CONCUR'01), pp. 39-58, 2001.
[27] K. Havelund, Java PathFinder, a Translator from Java to Promela Proc. Fifth and Sixth SPIN Workshops, 1999.
[28] K. Havelund, Using Runtime Analysis to Guide Model Checking of Java Programs Proc. Seventh SPIN Workshop, pp. 245-264, 2000.
[29] K. Havelund and G. Rosu, Monitoring Java Programs with Java PathExplorer Proc. First Int'l Workshop Runtime Verification (RV'01), vol. 55 of Electronic Notes in Theoretical Computer Science, K. Havelund and G. Rosu, eds., pp. 97-114, 2001.
[30] K. Havelund and G. Rosu, Monitoring Programs Using Rewriting Proc. 16th Int'l Conf. Automated Software Eng., pp. 135-143, 2001.
[31] C.A.R. Hoare, Communicating Sequential Processes. Prentice Hall, 1985.
[32] D.M. Hoffman and P.A. Strooper, Techniques and Tools for Java API Testing Proc. 2000 Australian Software Eng. Conf., pp. 235-245, 2000.
[33] E. Itoh, Z. Furukawa, and K. Ushijima, A Prototype of a Concurrent Behavior Monitoring Tool for Teesting of Concurrent Programs Proc. Third Asia-Pacific Software Eng. Conf., 1996.
[34] R. Jeffries, Extreme Testing Software Testing and Quality Eng., pp. 23-26, Mar. 1999.
[35] T. Katayama, Z. Furukawa, and K. Ushijima, Design and Implementation of Test-Case Generation for Concurrent Programs Proc. 1998 Asia-Pacific Software Eng. Conf., pp. 262-269, 1998.
[36] T. Katayama, E. Itoh, and Z. Furukawa, Test-Case Generation for Concurrent Programs with the Testing Criteria Using Interaction Sequences Proc. 2000 Asia-Pacific Software Eng. Conf., pp. 590-597, 2000.
[37] R. Konuru, H. Srinivasan, and J. Choi, Deterministic Replay of Distributed Java Applications Proc. 14th Int'l Parallel and Distributed Processing Symp., pp. 219-227, 2000.
[38] P.V. Koppol and K.-C. Tai, An Incremental Approach to Structural Testing of Concurrent Programs Proc. 1996 Int'l Symp. Software Testing and Analysis, pp. 14-23, 1996.
[39] D. Lea, Concurrent Programming in Java. pp. 210-211, Addison Wesley, 1997.
[40] T. Lindholm and F. Yellin, The Java Virtual Machine Specification, second ed. Addison Wesley, online athttp://java.sun.com/docs/books/vmspecindex.html , 1999.
[41] B. Long and P. Strooper, A Case Study in Testing Distributed Systems Proc. Third Int'l Symp. Distributed Objects and Applications, pp. 20-29, 2001.
[42] D. Long and L.A. Clarke, Data Flow Analysis of Concurrent Systems that Use the Rendezvous Model of Synchronisation Proc. Symp. Software Testing, Analysis and Verification (TAV4), pp. 21-35, 1991.
[43] J. Magee and J. Kramer, Concurrency: State Models and Java Programs. John Wiley&Sons, 1999.
[44] C.E. McDowell and D.P. Helmbold, Debugging Concurrent Programs ACM Computing Surveys, vol. 21, no. 4, pp. 593-622, 1989.
[45] M. McMillan, Symbolic Model Checking PhD thesis, Carnegie Mellon Univ., 1992.
[46] R. Milner, Communication and Concurrency. Prentice Hall, 1989.
[47] G. Naumovich, G. Avrunin, and L. Clarke, Data Flow Analysis for Checking Properties of Concurrent Java Programs Proc. 1999 Int'l Conf. Software Eng., pp. 399-410, 1999.
[48] M. Nygard and T. Karsjens, Test Infect Your Enterprise JavaBeans JavaWorld J., May 2000.
[49] E.H. Paik, Y.S. Chung, B.S. Lee, and C.-W. Yoo, A Concurrent Program Debugging Environment Using Real-Time Replay Proc. 1997 Conf. Parallel and Distributed Systems, 1997.
[50] D. Park, U. Stern, J. Skakkebaek, and D. Dill, Java Model Checking Proc. 15th Int'l Conf. Automated Software Eng., 2000.
[51] S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson, Eraser: A Dynamic Data Race Detector for Multithreaded Programs ACM Trans. Computer Systems, vol. 15, no. 4, pp. 391-411, Nov. 1997.
[52] C. Szyperski, Component Software: Beyond Object-Oriented Programming. Addison Wesley, 1998.
[53] C. Szyperski and C. Pfister, Special Issues in Object-Oriented Programming-ECOOP 96 Workshop Reader Workshop on Component-Oriented Programming, Summary, M. Muhlhauser, ed., 1997.
[54] K.C. Tai, R.H. Carver, and E.E. Obaid, "Debugging Concurrent Ada Programs by Deterministic Execution," IEEE Trans. Soft. Eng., vol. 17, no. 1, pp. 45-63, Jan. 1991.
[55] R.N. Taylor, A General-Purpose Algorithm for Analyzing Concurrent Programs Comm. ACM, vol. 26, no. 5, pp. 362-376, 1983.
[56] R.N. Taylor, D.L. Levine, and C.D. Kelly, "Structural Testing of Concurrent Programs," IEEE Trans. Software Eng., vol. 18, no. 3, pp. 206-215, Mar. 1992.
[57] W. Visser, K. Havelund, G. Brat, and S. Park, Model Checking Programs Proc. 15th Int'l Conf. Automated Software Eng., 2000.
[58] M. Young and R.N. Taylor, Combining Static Concurrency Analysis with Symbolic Execution IEEE Trans. Software Eng., vol. 14, no. 10, Oct. 1988.

Index Terms:
Component testing, concurrency, unit testing, tool support.
Citation:
Brad Long, Daniel Hoffman, Paul Strooper, "Tool Support for Testing Concurrent Java Components," IEEE Transactions on Software Engineering, vol. 29, no. 6, pp. 555-566, June 2003, doi:10.1109/TSE.2003.1205182
Usage of this product signifies your acceptance of the Terms of Use.