Skip to main content

Testing Program Segments to Detect Runtime Exceptions in Java

  • Conference paper
  • First Online:
Structured Object-Oriented Formal Language and Method (SOFL+MSVL 2022)

Abstract

Runtime exceptions are difficult to be detected by static analysis tools and their occurrences in runtime often cause software systems to crash or unexcepted termination. Therefore, it is necessary to detect the existence of runtime exceptions in the program before it is executed. In this paper, we describe a novel program segment testing technique for detecting potential occurrences of runtime exceptions during the program construction process. Our testing technique is characterized by three steps. The first step is to determine the target program segment in which potential runtime exceptions may occur during the program execution. The second step is to form an appropriate environment to test the program segment by determining the values of the variables. The final step is to carry out the testing and determine whether the runtime exceptions will occur and will be handled properly during the system execution. This paper also presents a case study to demonstrate that the technique is effective.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Myers, G.J., Sandler, C., Badgett, T.: The Art of Software Testing. John Wiley & Sons (2011)

    Google Scholar 

  2. Sy, N.T., Deville, Y.: Automatic test data generation for programs with integer and float variables, pp. 13–21. IEEE (2001)

    Google Scholar 

  3. https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html

  4. Jamil, M.A., Arif, M., Abubakar, N.S.A., Ahmad, A.: Software Testing Techniques: A Literature Review, pp. 177–182. IEEE (2016)

    Google Scholar 

  5. Ostrand, T.: White‐Box testing. In: Encyclopedia of Software Engineering (2002)

    Google Scholar 

  6. Beizer, B.: Black-Box Testing: Techniques for Functional Testing of Software and Systems. John Wiley & Sons, Inc. (1995)

    Google Scholar 

  7. Dadeau, F., Peureux, F.: Grey-box Testing and Verification of Java/JML, pp. 298–303. IEEE (2011)

    Google Scholar 

  8. Runeson, P.: A survey of unit testing practices. IEEE Softw. 23, 22–29 (2006)

    Article  Google Scholar 

  9. Jorgensen, P.C., Erickson, C.: Object-oriented integration testing. Commun. ACM 37, 30–38 (1994)

    Article  Google Scholar 

  10. Borjesson, E., Feldt, R.: Automated system testing using visual GUI testing tools: a comparative study in industry. In: 2012 IEEE Fifth International Conference on Software Testing, Verification and Validation, pp. 350–359. IEEE (2012)

    Google Scholar 

  11. Walkinshaw, N., Roper, M., Wood, M.: The Java System Dependence Graph, pp. 55–64. IEEE (2003)

    Google Scholar 

  12. Weiser, M.: Program slicing. IEEE Trans. Softw. Eng. (4) 352–357 (1984)

    Google Scholar 

  13. Agrawal, H., Horgan, J.R.: Dynamic program slicing. ACM SIGPlan Notices 25, 246–256 (1990)

    Article  Google Scholar 

  14. Sinha, S., Shah, H., Görg, C., Jiang, S., Kim, M., Harrold, M.J.: Fault localization and repair for Java runtime exceptions. In: Proceedings of the Eighteenth International Symposium on Software Testing and Analysis, pp. 153–164 (2009)

    Google Scholar 

  15. Jones, J.A., Harrold, M.J.: Empirical evaluation of the tarantula automatic fault-localization technique. In: Proceedings of the 20th IEEE/ACM International Conference on Automated Software Engineering, pp. 273–282 (2005)

    Google Scholar 

  16. Pytlik, B., Renieris, M., Krishnamurthi, S., Reiss, S.P.: Automated fault localization using potential invariants. arXiv preprint cs/0310040 (2003)

    Google Scholar 

  17. Edvardsson, J.: A survey on automatic test data generation. In: Proceedings of the 2nd Conference on Computer Science and Engineering, pp. 21–28. Citeseer (1999)

    Google Scholar 

  18. Candea, G., Godefroid, P.: Automated software test generation: some challenges, solutions, and recent advances. In: Steffen, B., Woeginger, G. (eds.) Computing and Software Science. LNCS, vol. 10000, pp. 505–531. Springer, Cham (2019). https://doi.org/10.1007/978-3-319-91908-9_24

    Chapter  Google Scholar 

  19. Sinha, S., Harrold, M.J., Rothermel, G.: System-dependence-graph-based slicing of programs with arbitrary interprocedural control flow. In: Proceedings of the 21st International Conference on Software Engineering, pp. 432–441. IEEE (1999)

    Google Scholar 

  20. Kim, H., Choi, T.-H., Jung, S.-C., Kim, H.-C., Lee, O., Doh, K.-G.: Applying dataflow analysis to detecting software vulnerability. In: 2008 10th International Conference on Advanced Communication Technology, pp. 255–258. IEEE (2008)

    Google Scholar 

  21. Livshits, V.B., Lam, M.S.: Finding security vulnerabilities in java applications with static analysis. In: USENIX Security Symposium, p. 18. (2005)

    Google Scholar 

  22. Kim, Y., Kim, Y., Kim, T., Lee, G., Jang, Y., Kim, M.: Automated unit testing of large industrial embedded software using concolic testing. In: 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 519–528. IEEE (2013)

    Google Scholar 

  23. Luckeneder, C., Kaindl, H., Korinek, M.: Automated Unit Testing in Model-based Embedded Software Development, pp. 427–434 (2017)

    Google Scholar 

  24. Liu, S.: Software construction monitoring and predicting for human-machine pair programming. In: Duan, Z., Liu, S., Tian, C., Nagoya, F. (eds.) SOFL+MSVL 2018. LNCS, vol. 11392, pp. 3–20. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-13651-2_1

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Shaoying Liu .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Rao, L., Liu, S., Liu, A. (2023). Testing Program Segments to Detect Runtime Exceptions in Java. In: Liu, S., Duan, Z., Liu, A. (eds) Structured Object-Oriented Formal Language and Method. SOFL+MSVL 2022. Lecture Notes in Computer Science, vol 13854. Springer, Cham. https://doi.org/10.1007/978-3-031-29476-1_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-29476-1_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-29475-4

  • Online ISBN: 978-3-031-29476-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics