Optimizing the Code Coverage by Controlling Environmental Dependencies in Unit Testing

C. Shobabindu*, K. K. Baseer**, Kathleen***
* Professor, Department of Computer Science and Engineering, JNTUA, Ananthapuramu, Andhra Pradesh, India.
** Associate Professor, Department of Information Technology, Sree Vidyanikethan Engineering College, Tirupati, Andhra Pradesh, India.
*** Department of Computer Science and Engineering, JNTUA, Ananthapuramu, Andhra Pradesh, India.
Periodicity:January - March'2018
DOI : https://doi.org/10.26634/jse.12.3.14555

Abstract

Unit testing in object oriented development aims to determine whether the individual units are working as intended or not, which is accomplished by executing tests, and contains calls to unit under test (class or method) and verifies the output with expected one. Coverage criteria plays a significant role to decide if the unit testing was well performed or not. A successful unit test will have high amount of coverage. But often the execution of unit depends on environmental dependencies like file system, user interaction, database, and networks. Some techniques were developed to address these dependency issues. This paper addresses the networking interactions based on mocking approach, where some of the java.net Application Programming Interface (API) classes like InetAddress, Uniform Resource Locator (URL), Uniform Resource Identifier (URI), Socket, etc., are mocked. Then the work was evaluated against selected java programs, whose source code contains usage of java.net API classes. The results show improvement in the code coverage when unit testing is performed with network mocking.

Keywords

Dependenciest, Unit Testing, Junit, Mocking.

How to Cite this Article?

Bindu, S, C., Baseer, K, K., and Ravikanth, V. (2018). Optimizing the Code Coverage by Controlling Environmental Dependencies in Unit Testing. i-manager's Journal on Software Engineering, 12(3), 8-15. https://doi.org/10.26634/jse.12.3.14555

References

[1]. Arcuri, A., Fraser, G., & Galeotti, J. P. (2014, September). Automated unit test generation for classes with environment dependencies. In Proceedings of the 29 ACM/IEEE International Conference on Automated Software Engineering (pp. 79-90). ACM.
[2]. Binder, W., Hulaas, J., & Moret, P. (2007, September). Advanced Java bytecode instrumentation. In Proceedings of the 5 international Symposium on Principles and Practice of Programming in Java (pp. 135- 144). ACM.
[3]. Buyya, R. (n.d). Socket Programming (pp. 346-363). Retrieved from http://www.buyya.com/java/Chapter13. pdf, 346-363.
[4]. De Halleux, J., & Tillmann, N. (2010, June). Moles: Tool-assisted environment isolation with closures. In International Conference on Modelling Techniques and Tools for Computer Performance Evaluation (pp. 253- 270). Springer, Berlin, Heidelberg.
[5]. Galler, S. J., Maller, A., & Wotawa, F. (2010, May). Automatically extracting mock object behavior from Design by Contractâ„¢ specification for test data generation. In Proceedings of the 5 Workshop on Automation of Software Test (pp. 43-50). ACM.
[6]. Marri, M. R., Xie, T., Tillmann, N., De Halleux, J., &Schulte, W. (2009, May). An empirical study of testing filesystem- dependent software with mock objects. In Automation of Software Test, 2009. AST'09. ICSE Workshop on (pp. 149-153). IEEE.
[7]. Saff, D., & Ernst, M. D. (2004, June). Mock object creation for test factoring. In Proceedings of the 5 ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering (pp. 49-51). ACM.
[8]. Sawant, A. A., & Meshram, B. B. (2013). Network programming in Java using Socket. International Journal of Engineering Research and Applications (IJERA), 3(1), 1299-1305.
[9]. Stevens, W. R., Fenner, B., & Rudoff, A. M. (2004). UNIX Network Programming (Vol. 1). Addison-Wesley Professional.
[10]. Taneja, K., Zhang, Y., & Xie, T. (2010, September). MODA: Automated test generation for database applications via mock objects. In Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (pp. 289-292). ACM.
[11]. Tillmann, N., & Schulte, W. (2005, September). Parameterized unit tests. In ACM SIGSOFT Software Engineering Notes (Vol. 30, No. 5, pp. 253-262). ACM.
If you have access to this article please login to view the article or kindly login to purchase the article

Purchase Instant Access

Single Article

North Americas,UK,
Middle East,Europe
India Rest of world
USD EUR INR USD-ROW
Pdf 35 35 200 20
Online 35 35 200 15
Pdf & Online 35 35 400 25

Options for accessing this content:
  • If you would like institutional access to this content, please recommend the title to your librarian.
    Library Recommendation Form
  • If you already have i-manager's user account: Login above and proceed to purchase the article.
  • New Users: Please register, then proceed to purchase the article.