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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
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
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)
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
P. Dhareula, A. Ganpati, Open source code coverage tools for Java: a comparative analysis. Indian J. Sci. Technol 9(32) (2016)
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
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
S. Anand, C.S. Pasareanu, W. Visser, JPF-SE: a symbolic execution extension to Java PathFinder, in TACAS’07 (2007)
Java Path Finder. https://github.com/javapathfinder/jpf-core/wiki
EclEmma. https://www.eclemma.org/
Mockito framework. https://site.mockito.org/
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
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.
About this paper
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)