Skip to main content
Top
Published in: Software Quality Journal 1/2022

22-02-2022

Towards random and enumerative testing for OCaml and WhyML properties

Authors: Clotilde Erard, Alain Giorgetti, Jérome Ricciardi

Published in: Software Quality Journal | Issue 1/2022

Log in

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

Deductive program verification greatly improves software quality, but proving formal specifications is difficult, and this activity can only be partially automated. It is therefore relevant to supplement deductive verification tools, such as Why3, with the ability to test the properties to be verified. We present a methodological study and a prototype for the random and enumerative testing of properties written either in the Why3 input language WhyML or in the OCaml programming language used by Why3 to run programs written in WhyML. An originality is that we propose enumerative testing based on data generators themselves written in WhyML and formally verified with Why3. Another specificity is that the development effort is reduced by exploiting Why3’s extraction mechanism to OCaml and an existing random testing tool for OCaml. These design choices are applied in a prototypal implementation of a tool, called AutoCheck. The prototype and the paper are designed with simplicity and usability in mind, in order to make them accessible to the widest audience. Starting from the most elementary cases, a tutorial illustrates the implemented features with many examples presented in increasing complexity order.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Literature
go back to reference Barnett, M., Leino, K., & Schulte, W. (2004). The spec# programming system: An overview. In: Proceedings of the International Workshop on Construction and Analysis of Safe, Secure and Interoperable Smart Devices (CASSIS’04), Lecture Notes in Computer Science, vol. 3362, pp. 49–69. Springer-Verlag, Marseille, France Barnett, M., Leino, K., & Schulte, W. (2004). The spec# programming system: An overview. In: Proceedings of the International Workshop on Construction and Analysis of Safe, Secure and Interoperable Smart Devices (CASSIS’04), Lecture Notes in Computer Science, vol. 3362, pp. 49–69. Springer-Verlag, Marseille, France
go back to reference Beckert, B., Hähnle, R., & Schmitt, P. H. (eds.) (2007). Verification of Object-Oriented Software: The KeY Approach, Lecture Notes in Computer Science, vol. 4334. Springer, Heidelberg. Beckert, B., Hähnle, R., & Schmitt, P. H. (eds.) (2007). Verification of Object-Oriented Software: The KeY Approach, Lecture Notes in Computer Science, vol. 4334. Springer, Heidelberg.
go back to reference Blatter, L., Kosmatov, N., Le Gall, P., Prevosto, V., & Petiot, G. (2018). Static and dynamic verification of relational properties on self-composed C code. In: C. Dubois, B. Wolff (eds.) Tests and Proofs. TAP 2018, pp. 44–62. Springer International Publishing, Cham. https://doi.org/10.1007/978-3-319-21215-9_7 Blatter, L., Kosmatov, N., Le Gall, P., Prevosto, V., & Petiot, G. (2018). Static and dynamic verification of relational properties on self-composed C code. In: C. Dubois, B. Wolff (eds.) Tests and Proofs. TAP 2018, pp. 44–62. Springer International Publishing, Cham. https://​doi.​org/​10.​1007/​978-3-319-21215-9_​7
go back to reference Bulwahn, L. (2012). The new Quickcheck for Isabelle - random, exhaustive and symbolic testing under one roof. In: C. Hawblitzel, D. Miller (eds.) CPP 2012, Lecture Notes in Computer Science, vol. 7679, pp. 92–108. Springer, Heidelberg, Kyoto, Japan. https://doi.org/10.1007/978-3-642-35308-6_10 Bulwahn, L. (2012). The new Quickcheck for Isabelle - random, exhaustive and symbolic testing under one roof. In: C. Hawblitzel, D. Miller (eds.) CPP 2012, Lecture Notes in Computer Science, vol. 7679, pp. 92–108. Springer, Heidelberg, Kyoto, Japan. https://​doi.​org/​10.​1007/​978-3-642-35308-6_​10
go back to reference Claessen, K., & Hughes, J. (2000). QuickCheck: A lightweight tool for random testing of Haskell programs. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, SIGPLAN Not., vol. 35, pp. 268–279. ACM, New York. https://doi.org/10.1145/351240.351266 Claessen, K., & Hughes, J. (2000). QuickCheck: A lightweight tool for random testing of Haskell programs. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, SIGPLAN Not., vol. 35, pp. 268–279. ACM, New York. https://​doi.​org/​10.​1145/​351240.​351266
go back to reference Clarke, E.M., Kroening, D., & Lerda, F. (2004). A tool for checking ANSI-C programs. In: Tools and Algorithms for the Construction and Analysis of Systems, 10th International Conference, TACAS 2004, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2004, Lecture Notes in Computer Science, vol. 2988, pp. 168–176. Springer. https://doi.org/10.1007/978-3-540-24730-2_15 Clarke, E.M., Kroening, D., & Lerda, F. (2004). A tool for checking ANSI-C programs. In: Tools and Algorithms for the Construction and Analysis of Systems, 10th International Conference, TACAS 2004, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2004, Lecture Notes in Computer Science, vol. 2988, pp. 168–176. Springer. https://​doi.​org/​10.​1007/​978-3-540-24730-2_​15
go back to reference Dijkstra, E. W. (1976). A Discipline of Programming. In: Series in Automatic Computation. Prentice Hall. Dijkstra, E. W. (1976). A Discipline of Programming. In: Series in Automatic Computation. Prentice Hall.
go back to reference Duregård, J., Jansson, P., & Wang, M. (2012). Feat: functional enumeration of algebraic types. In: Proceedings of the 2012 Haskell Symposium, ACM SIGPLAN Notices, vol. 47, pp. 61–72. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/2364506.2364515 Duregård, J., Jansson, P., & Wang, M. (2012). Feat: functional enumeration of algebraic types. In: Proceedings of the 2012 Haskell Symposium, ACM SIGPLAN Notices, vol. 47, pp. 61–72. Association for Computing Machinery, New York, NY, USA. https://​doi.​org/​10.​1145/​2364506.​2364515
go back to reference Genestier, R., Giorgetti, A., & Petiot, G. (2015). Sequential generation of structured arrays and its deductive verification. In: J.C. Blanchette, N. Kosmatov (eds.) Tests and Proofs. TAP 2015, Lecture Notes in Computer Science, vol. 9154, pp. 109–128. Springer, Cham. https://doi.org/10.1007/978-3-319-21215-9_7 Genestier, R., Giorgetti, A., & Petiot, G. (2015). Sequential generation of structured arrays and its deductive verification. In: J.C. Blanchette, N. Kosmatov (eds.) Tests and Proofs. TAP 2015, Lecture Notes in Computer Science, vol. 9154, pp. 109–128. Springer, Cham. https://​doi.​org/​10.​1007/​978-3-319-21215-9_​7
go back to reference Giorgetti, A., Dubois, C., & Lazarini, R. (2019). Combinatoire formelle avec Why3 et Coq. In: N. Magaud, Z. Dargaye (eds.) Journées Francophones des Langages Applicatifs. JFLA 2019., pp. 139–154. https://hal.inria.fr/hal-01985195 Giorgetti, A., Dubois, C., & Lazarini, R. (2019). Combinatoire formelle avec Why3 et Coq. In: N. Magaud, Z. Dargaye (eds.) Journées Francophones des Langages Applicatifs. JFLA 2019., pp. 139–154. https://​hal.​inria.​fr/​hal-01985195
go back to reference Hauzar, D., Marché, C., & Moy, Y. (2016). Counterexamples from proof failures in SPARK. In: R. De Nicola, E. Kühn (eds.) Software Engineering and Formal Methods. SEFM 2016, Lecture Notes in Computer Science, vol. 9763, pp. 215–233. Springer, Cham. https://hal.inria.fr/hal-01314885 Hauzar, D., Marché, C., & Moy, Y. (2016). Counterexamples from proof failures in SPARK. In: R. De Nicola, E. Kühn (eds.) Software Engineering and Formal Methods. SEFM 2016, Lecture Notes in Computer Science, vol. 9763, pp. 215–233. Springer, Cham. https://​hal.​inria.​fr/​hal-01314885
go back to reference Herdt, V., Große, D., Le, H. M., & Drechsler, R. (2019). Verifying instruction set simulators using coverage-guided fuzzing(*). In: J. Teich, F. Fummi (eds.) Design, Automation & Test in Europe Conference & Exhibition, DATE 2019, Florence, Italy, March 25-29, 2019, pp. 360–365. IEEE. https://doi.org/10.23919/DATE.2019.8714912 Herdt, V., Große, D., Le, H. M., & Drechsler, R. (2019). Verifying instruction set simulators using coverage-guided fuzzing(*). In: J. Teich, F. Fummi (eds.) Design, Automation & Test in Europe Conference & Exhibition, DATE 2019, Florence, Italy, March 25-29, 2019, pp. 360–365. IEEE. https://​doi.​org/​10.​23919/​DATE.​2019.​8714912
go back to reference Knuth, D. E. (1997). The Art of Computer Programming, Volume 1 (3rd Ed.): Fundamental Algorithms. Addison Wesley Longman Publishing Co., Inc., USA. Knuth, D. E. (1997). The Art of Computer Programming, Volume 1 (3rd Ed.): Fundamental Algorithms. Addison Wesley Longman Publishing Co., Inc., USA.
go back to reference Kosmatov, N., Marché, C., Moy, Y., & Signoles, J. (2016). Static versus dynamic verification in Why3, Frama-C and SPARK 2014. In: T. Margaria, B. Steffen (eds.) Leveraging Applications of Formal Methods, Verification and Validation: Foundational Techniques, Lecture Notes in Computer Science, vol. 9952, pp. 461–478. Springer and Springer, Cham. https://doi.org/10.1007/978-3-319-47166-2_32 Kosmatov, N., Marché, C., Moy, Y., & Signoles, J. (2016). Static versus dynamic verification in Why3, Frama-C and SPARK 2014. In: T. Margaria, B. Steffen (eds.) Leveraging Applications of Formal Methods, Verification and Validation: Foundational Techniques, Lecture Notes in Computer Science, vol. 9952, pp. 461–478. Springer and Springer, Cham. https://​doi.​org/​10.​1007/​978-3-319-47166-2_​32
go back to reference Leavens, G. T., Baker, A. L., & Ruby, C. (1999). JML: A notation for detailed design. In H. Kilov, B. Rumpe, & I. Simmonds (Eds.), Behavioral Specifications of Businesses and Systems (pp. 175–188). Boston: Kluwer Academic Publishers.CrossRef Leavens, G. T., Baker, A. L., & Ruby, C. (1999). JML: A notation for detailed design. In H. Kilov, B. Rumpe, & I. Simmonds (Eds.), Behavioral Specifications of Businesses and Systems (pp. 175–188). Boston: Kluwer Academic Publishers.CrossRef
go back to reference Padhye, R., Lemieux, C., & Sen, K. (2019). JQF: Coverage-guided property-based testing in Java. In: Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA 2019, pp. 398–401. Association for Computing Machinery, New York, NY, USA. https://doi.org/10.1145/3293882.3339002 Padhye, R., Lemieux, C., & Sen, K. (2019). JQF: Coverage-guided property-based testing in Java. In: Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA 2019, pp. 398–401. Association for Computing Machinery, New York, NY, USA. https://​doi.​org/​10.​1145/​3293882.​3339002
go back to reference Reich, J. S., Naylor, M., & Runciman, C. (2013). Advances in Lazy SmallCheck. In: R. Hinze (ed.) Implementation and Application of Functional Languages. IFL 2012., Lecture Notes in Computer Science, vol. 8241, pp. 53–70. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-41582-1_4 Reich, J. S., Naylor, M., & Runciman, C. (2013). Advances in Lazy SmallCheck. In: R. Hinze (ed.) Implementation and Application of Functional Languages. IFL 2012., Lecture Notes in Computer Science, vol. 8241, pp. 53–70. Springer, Berlin, Heidelberg. https://​doi.​org/​10.​1007/​978-3-642-41582-1_​4
Metadata
Title
Towards random and enumerative testing for OCaml and WhyML properties
Authors
Clotilde Erard
Alain Giorgetti
Jérome Ricciardi
Publication date
22-02-2022
Publisher
Springer US
Published in
Software Quality Journal / Issue 1/2022
Print ISSN: 0963-9314
Electronic ISSN: 1573-1367
DOI
https://doi.org/10.1007/s11219-021-09572-z

Other articles of this Issue 1/2022

Software Quality Journal 1/2022 Go to the issue

Premium Partner