Skip to main content

The Mechanism of Generating the Automated Java Unit Test Cases by Achieving Maximum Code Coverage

  • Conference paper
  • First Online:
Proceedings of International Conference on Advances in Computer Engineering and Communication Systems

Abstract

The code coverage, being the factor of focus on unit testing that tells us which part of the source code is tested or untested. If the code consists of abstract classes or interfaces, they are also to be tested to ensure the maximum code coverage as generating the high coverage test suites play an important role in realistic systems like airbag systems, autopilot systems, etc. Thus, the correctness in the functionality is properly tested. Mocking is the process of constituting an imitation of the object. It is the technique of unit testing where the virtual objects are created to mock the behavior of the actual object, which helps us to bypass faults to some other class or system like database operation, REST API calls, etc. Hence, this proposed work has been designed to generate highly covered test cases in the aspects of Java. This work helps us to produce the test cases along with the skeleton, which forms a syntactically correct JUnit. It helps to test the subclasses implementing the Abstract class’s methods and classes implementing interfaces, to generate the test cases for no access modifier methods. The generated test cases support mocking as well. Mockito framework is being used to do so.

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 169.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 219.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 219.99
Price excludes VAT (USA)
  • Durable hardcover 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. A. Bindu et al., Automatic JUnit generation and quality assessment using concolic and mutation testing. Int. J. Innov. Technol. Explor. Eng. (IJITEE) 8(10) (2019). ISSN: 2278-3075

    Google Scholar 

  2. N. Li, X. Meng, J. Offutt, L. Deng, Is bytecode instrumentation as good as source code instrumentation: An empirical study with industrial tools (Experience Report), pp. 380–389 (2013). https://doi.org/10.1109/issre.2013.6698891. Author, F., Author, S., Author, T.: Book title. 2nd edn. Publisher, Location (1999)

  3. S. Shelke, S. Nagpure, The Study of various code coverage tools. Int. J. Comput. Trends Technol. (IJCTT) V13(1):46–49 (2014). ISSN:2231-2803, www.ijcttjournal.org. Published by Seventh Sense Research Group. LNCS

  4. P. Dhareula, A. Ganpati, Open source code coverage tools for Java: a comparative analysis. Indian J. Sci. Technol 9(32) (2016)

    Google Scholar 

  5. R. Lingampally, A. Gupta, P. Jalote, A multipurpose code coverage tool for Java, in 2007 40th Annual Hawaii International Conference on System Sciences (HICSS’07), Waikoloa, HI, 2007, pp. 261b–261b

    Google Scholar 

  6. S. Mostafa, X. Wang, An empirical study on the usage of mocking frameworks in software testing, in Proceedings of the 2014 14th International conference on quality software (QSIC’14) (IEEE Computer Society, USA, 2014), pp. 127–132. https://doi.org/10.1109/QSIC.2014.19

  7. S. Anand, C.S. Pasareanu, W. Visser, JPF-SE: a symbolic execution extension to Java PathFinder, in TACAS’07 (2007)

    Google Scholar 

  8. Java Path Finder. https://github.com/javapathfinder/jpf-core/wiki

  9. EclEmma. https://www.eclemma.org/

  10. Mockito framework. https://site.mockito.org/

Download references

Acknowledgements

We would like to express our gratitude to Dr. Corina S. Pasareanu, Researcher, NASA Ames Research Center for the utmost support provided during the implementation of the system.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bindu Avadhani .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Avadhani, B., Giri, S.R., Pulipati, V.R. (2021). The Mechanism of Generating the Automated Java Unit Test Cases by Achieving Maximum Code Coverage. In: Kiran Mai, C., Kiranmayee, B.V., Favorskaya, M.N., Chandra Satapathy, S., Raju, K.S. (eds) Proceedings of International Conference on Advances in Computer Engineering and Communication Systems. Learning and Analytics in Intelligent Systems, vol 20. Springer, Singapore. https://doi.org/10.1007/978-981-15-9293-5_4

Download citation

  • DOI: https://doi.org/10.1007/978-981-15-9293-5_4

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-15-9292-8

  • Online ISBN: 978-981-15-9293-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics