Skip to main content

Part of the book series: Studies in Computational Intelligence ((SCI,volume 733))

  • 629 Accesses

Abstract

Time is important. New software rarely works as a standalone service—usually, it is part of a much bigger network of interconnected applications, running on different hardware, operating systems and designed with various technology stacks. Even applications which do not need network connectivity, such as some embedded devices, rely on time-based events for task scheduling. However, support for testing time-dependent code is often not sufficient both on operating system level and on framework/library level, and generally, requires special ways of designing software to provide sufficient testability. Custom design often means implementing special testing library or modifying the source code for test purposes. This paper points out some of the things that may go wrong when using these approaches, introduces a portable model of time-based computation and presents zurvan—an open-source library for Node.js applications which provides an abstraction over time and allows users to efficiently test time-dependent, asynchronous code. Advantages of using presented model include test case repeatability, increased code testability and shorter test suite execution times.

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 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 109.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

Notes

  1. 1.

    Real-world time is a phrase used in this paper to differentiate time passing in the real world from simulated time, chosen so that it won’t collide with the term real-time, used for real-time systems.

  2. 2.

    28 May 2017.

References

  1. Antoni, M., Tomlinson, C., Goldberg, J., Kopsend, C.E., Roderick, M., Edwards, A.: lolex. https://github.com/sinonjs/lolex (2017)

  2. Bérard, B., Bidoit, M., Finkel, A., Laroussinie, F., Petit, A., Petrucci, L., Schnoebelen, P.: Systems and Software Verification: Model-Checking Techniques and Tools. Springer Science & Business Media (2013)

    Google Scholar 

  3. CodeClimate. https://codeclimate.com/ (2017)

  4. Corrodi, C., Heußner, A., Poskitt, C.M.: A Graph-Based Semantics Workbench for Concurrent Asynchronous Programs, pp. 31–48. Springer, Berlin, Heidelberg (2016)

    Google Scholar 

  5. C++. https://isocpp.org/ (2017)

  6. Czaplicki, E., Chong, S.: Asynchronous functional reactive programming for guis. SIGPLAN Not. 48(6), 411–422 (2013). doi:10.1145/2499370.2462161

  7. Deligiannis, P., Donaldson, A.F., Ketema, J., Lal, A., Thomson, P.: Asynchronous programming, analysis and testing with state machines. SIGPLAN Not. 50(6), 154–164 (2015). doi:10.1145/2813885.2737996

  8. Desai, A., Garg, P., Madhusudan, P.: Natural proofs for asynchronous programs using almost-synchronous reductions. SIGPLAN Not. 49(10), 709–725 (2014). doi:10.1145/2714064.2660211

  9. Desai, A., Qadeer, S., Seshia, S.A.: Systematic testing of asynchronous reactive systems. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2015, pp. 73–83. ACM, New York, NY, USA (2015). doi:10.1145/2786805.2786861

  10. ECMAScript Language Specification. https://www.ecma-international.org/ecma-262/5.1/ (2011)

  11. Erlang. https://www.erlang.org/ (2017)

  12. Feathers, M.: Working Effectively with Legacy Code. Prentice Hall Professional (2004)

    Google Scholar 

  13. Ganty, P., Majumdar, R.: Algorithmic verification of asynchronous programs. ACM Trans. Program. Lang. Syst. 34(1), 6:1–6:48 (2012). doi:10.1145/2160910.2160915

  14. Garavel, H., Lang, F., Mateescu, R.: Compositional verification of asynchronous concurrent systems using cadp. Acta Informatica 52(4), 337–392 (2015). doi:10.1007/s00236-015-0226-1

  15. GitHub. https://github.com/ (2017)

  16. Hussain, M.: Mastering JavaScript Promises. Packt Publishing Ltd (2015)

    Google Scholar 

  17. Isabel, M.: Testing of concurrent programs. In: Carro, M., King, A., Saeedloei, N., Vos, M.D. (eds.) Technical Communications of the 32nd International Conference on Logic Programming (ICLP 2016). OpenAccess Series in Informatics (OASIcs), vol. 52, pp. 1–5. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany (2016). doi:10.4230/OASIcs.ICLP.2016.18. http://drops.dagstuhl.de/opus/volltexte/2016/6747

  18. Java. https://www.java.com/ (2017)

  19. Lei, Y., Tai, K.C.: Efficient reachability testing of asynchronous message-passing programs. In : Eighth IEEE International Conference on Engineering of Complex Computer Systems, 2002. Proceedings., pp. 35–44 (2002). doi:10.1109/ICECCS.2002.1181496

  20. Lewowski, T.: zurvan. https://github.com/tlewowski/zurvan (2017)

  21. López, M., Castro, L.M., Cabrero, D.: Feasibility of Property-Based Testing for Time-Dependent Systems, pp. 527–535. Springer Berlin, Heidelberg, (2013)

    Google Scholar 

  22. npm. https://www.npmjs.com/ (2017)

  23. Rankin, C.H., Abrams, T., Barry, R.J., Bhatnagar, S., Clayton, D.F., Colombo, J., Coppola, G., Geyer, M.A., Glanzman, D.L., Marsland, S., McSweeney, F.K., Wilson, D.A., Wu, C.F., Thompson, R.F.: Habituation revisited: an updated and revised description of the behavioral characteristics of habituation. Neurobiol. Learn. Mem. 92(2), 135–138 (2009). doi:10.1016/j.nlm.2008.09.012. http://www.sciencedirect.com/science/article/pii/S1074742708001792. Special Issue: Neurobiology of Habituation

  24. Scala. http://scala-lang.org/ (2017)

  25. Tilkov, S., Vinoski, S.: Node.js: using javascript to build high-performance network programs. IEEE Internet Comput. 14(6), 80–83 (2010). doi:10.1109/MIC.2010.145

    Article  Google Scholar 

  26. Travis CI. https://travis-ci.org/ (2017)

  27. WebKit. https://webkit.org/ (2017)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Tomasz Lewowski .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG

About this chapter

Cite this chapter

Lewowski, T. (2018). Efficient Testing of Time-Dependent, Asynchronous Code. In: Kosiuczenko, P., Madeyski, L. (eds) Towards a Synergistic Combination of Research and Practice in Software Engineering. Studies in Computational Intelligence, vol 733. Springer, Cham. https://doi.org/10.1007/978-3-319-65208-5_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-65208-5_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-65207-8

  • Online ISBN: 978-3-319-65208-5

  • eBook Packages: EngineeringEngineering (R0)

Publish with us

Policies and ethics