Skip to main content

Challenges and Perils of Testing Database Manipulation Code

  • Conference paper
  • First Online:
Advanced Information Systems Engineering (CAiSE 2021)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 12751))

Included in the following conference series:

Abstract

Software testing enable development teams to maintain the quality of a software system while it evolves. The database manipulation code requires special attention in this context. However, it is often neglected and suffers from software maintenance problems. In this paper, we investigate the current state-of-the-practice in testing database manipulation code. We first analyse the code of 72 projects mined from Libraries.io to get an impression of the test coverage for database code. We confirm that the database is poorly tested: 46% of the projects did not cover with tests half of their database access methods, and 33% of the projects did not cover the database code at all. To understand the difficulties in testing database code, we analysed 532 questions on StackExchange sites and deduced a taxonomy. We found that developers mostly look for insights on general best practices to test database access code. They also have more technical questions related to DB handling, mocking, parallelisation or framework/tool usage. This investigation lays the basis for future research on improving database code testing.

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 89.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 119.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

Notes

  1. 1.

    https://libraries.io/data.

  2. 2.

    At the time of writing, it has 2.7M unique packages, 33M repositories, and 235M interdependencies between them.

  3. 3.

    https://junit.org/.

  4. 4.

    https://testng.org/.

  5. 5.

    https://mvnrepository.com/open-source/testingframeworks.

  6. 6.

    https://www.jacoco.org.

  7. 7.

    https://bitbucket.org/csnagy/sqlinspect.

  8. 8.

    https://github.com/speedment/speedment.

  9. 9.

    https://github.com/mybatis/ mybatis-3.

  10. 10.

    http://stackoverflow.com.

  11. 11.

    http://softwareengineering.stackexchange.com.

  12. 12.

    http://codereview.stackexchange.com.

  13. 13.

    https://site.mockito.org/.

  14. 14.

    https://easymock.org/.

  15. 15.

    https://github.com/nomemory/mockneat.

  16. 16.

    https://docs.spring.io/spring/ docs/current/spring-frameworkreference/testing.html.

References

  1. Repl. pkg. https://github.com/csnagy/caise2021-db-manipulation-testing

  2. Alsharif, A., et al.: What factors make SQL test cases understandable for testers? a human study of automated test data generation techniques. In: ICSME (2019)

    Google Scholar 

  3. Arcuri, A., Fraser, G., Just, R.: Private API access and functional mocking in automated unit test generation. In: Proceedings of ICST (2017)

    Google Scholar 

  4. Beller, M., Gousios, G., Panichella, A., Zaidman, A.: When, how, and why developers (do not) test in their ides. In: Proc. ESEC/FSE (2015)

    Google Scholar 

  5. Castelein, J., Aniche, M., Soltani, M., Panichella, A., van Deursen, A.: Search-based test data generation for SQL queries. In: Proceedings of ICSE (2018)

    Google Scholar 

  6. Chays, D., Dan, S., Frankl, P.G., Vokolos, F.I., Weber, E.J.: A framework for testing database applications. In: Proceedings of ISSTA (2000)

    Google Scholar 

  7. Chen, T.H., Shang, W., Hassan, A.E., Nasser, M., Flora, P.: Detecting problems in the database access code of large scale systems. In: Proceedings of ICSE (2016)

    Google Scholar 

  8. Cleve, A., Brogneaux, A., Hainaut, J.: A conceptual approach to database applications evolution. In: Proceedings of ER (2010)

    Google Scholar 

  9. Delplanque, J., Etien, A., Anquetil, N., Ducasse, S.: Recommendations for evolving relational databases. In: Proceedings of CAiSE (2020)

    Google Scholar 

  10. Deng, Y., Frankl, P., Wang, J.: Testing web database applications. SIGSOFT Softw. Eng. Notes 29(5), 1–10 (2004)

    Google Scholar 

  11. Garg, D., Datta, A.: Test case prioritization due to database changes in web applications. In: Proceedings of ICST (2012)

    Google Scholar 

  12. Gonzalez, D., Santos, J.C.S., Popovich, A., Mirakhorli, M., Nagappan, M.: A large-scale study on the usage of testing patterns that address maintainability attributes: patterns for ease of modification, diagnoses, and comprehension. In: MSR (2017)

    Google Scholar 

  13. González, J.R.C., Romero, J.J.F., Guerrero, M.G., Calderón, F.: Multi-class multi-tag classifier system for stackoverflow questions. In: Proceedings of ROPEC (2015)

    Google Scholar 

  14. Ivanković, M., Petrović, G., Just, R., Fraser, G.: Code coverage at Google. In: Proceedings of ESEC/FSE (2019)

    Google Scholar 

  15. Kapfhammer, G.M., Soffa, M.L.: Database-aware test coverage monitoring. In: Proceedings of the 1st India Software Engineering Conference (2008)

    Google Scholar 

  16. Maule, A., Emmerich, W., Rosenblum, D.: Impact analysis of database schema changes. In: Proceedings of ICSE 2008 (2008)

    Google Scholar 

  17. Meurice, L., Nagy, C., Cleve, A.: Detecting and preventing program inconsistencies under database schema evolution. In: Proceedings of QRS (2016)

    Google Scholar 

  18. Meurice, L., Nagy, C., Cleve, A.: Static analysis of dynamic database usage in java systems. In: Proceedings of CAiSE (2016)

    Google Scholar 

  19. Pasternak, B., Tyszberowicz, S., Yehudai, A.: Genutest: a unit test and mock aspect generation tool. In: Hardware and Software: Verification and Testing (2008)

    Google Scholar 

  20. Petersen, K., Vakkalanka, S., Kuzniarz, L.: Guidelines for conducting systematic mapping studies in software engineering: an update. IST 64, 1–18 (2015)

    Google Scholar 

  21. Qiu, D., Li, B., Su, Z.: An empirical analysis of the co-evolution of schema and code in database applications. In: Proceedings of ESEC/FSE (2013)

    Google Scholar 

  22. Ran, L., et al.: Building test cases and oracles to automate the testing of web database applications. Inf. Softw. Technol. 51(2), 460–477 (2009)

    Google Scholar 

  23. Riaz, M., Mendes, E., Tempero, E.: Towards maintainability prediction for relational database-driven software applications: evidence from software practitioners. In: Proceedings of Advances in Software Engineering (2010)

    Google Scholar 

  24. Rosero, R.H., Gómez, O.S., Rafael, G.D.R.: Regression testing of database applications under an incremental software development setting. IEEE Access 5, 18419–18428 (2017)

    Google Scholar 

  25. Spadini, D., Aniche, M., Bruntink, M., Bacchelli, A.: Mock objects for testing java systems. Empirical Softw. Eng. 24(3), 1461–1498 (2018). https://doi.org/10.1007/s10664-018-9663-0

    Article  Google Scholar 

  26. Stonebraker, M., Deng, D., Brodie, M.L.: Application-database co-evolution: a new design and development paradigm. In: New England Database Day (2017)

    Google Scholar 

  27. Trautsch, F., Grabowski, J.: Are there any unit tests? an empirical study on unit testing in open source python projects. In: Proceedings of ICST (2017)

    Google Scholar 

  28. Tuya, J., Suárez-Cabal, M.J., de la Riva, C.: Full predicate coverage for testing SQL database queries. Softw. Testing, Verification Reliab. 20, 237–288 (2010)

    Google Scholar 

  29. Usman, M., Britto, R., Börstler, J., Mendes, E.: Taxonomies in software engineering: a systematic mapping study and a revised taxonomy development method. Inf. Softw. Technol. 85, 43–59 (2017)

    Google Scholar 

  30. Vasilescu, B., Filkov, V., Serebrenik, A.: Stackoverflow and github: Associations between software development and crowdsourced knowledge. In: Proceedings of ICSC (2013)

    Google Scholar 

  31. Vassiliadis, P., Zarras, A.V.: Survival in schema evolution: Putting the lives of survivor and dead tables in counterpoint. In: Proceedings of CAiSE (2017)

    Google Scholar 

Download references

Acknowledgements

This work is supported by (a) the F.R.S.-FNRS and FWO-Vlaanderen via the EOS project 30446992 SECO-ASSIST and (b) Flanders Make vzw.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Maxime Gobert .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Gobert, M., Nagy, C., Rocha, H., Demeyer, S., Cleve, A. (2021). Challenges and Perils of Testing Database Manipulation Code. In: La Rosa, M., Sadiq, S., Teniente, E. (eds) Advanced Information Systems Engineering. CAiSE 2021. Lecture Notes in Computer Science(), vol 12751. Springer, Cham. https://doi.org/10.1007/978-3-030-79382-1_14

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-79382-1_14

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-79381-4

  • Online ISBN: 978-3-030-79382-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics