BETA: A B Based Testing Approach

  • Ernesto C. B. de Matos
  • Anamaria Martins Moreira
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7498)


While formal methods provide ways to specify and verify software systems with mathematical accuracy, testing techniques can provide mechanisms to identify defects that were inserted in the system during its implementation. With that in mind, this paper presents an approach to generate test specifications based on a formal notation: the B-Method. Our approach is supported by a tool and uses restrictions described on a B specification, such as invariants, preconditions and conditional statements, to create unit tests for an operation. The approach uses equivalence classes and boundary value analysis techniques to partition the operation input space and relies on combinatorial criteria to select partitions to test. The approach and the tool were evaluated through a small case study using specifications for the FreeRTOS micro kernel.


Testing Formal Methods Unit Testing B-Method 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abrial, J.R.: The B Book: Assigning Programs to Meanings. Cambridge University Press (1996)Google Scholar
  2. 2.
    Abrial, J.R., Butler, M., Hallerstede, S., Hoang, T.S., Mehta, F., Voisin, L.: Rodin: an open toolset for modelling and reasoning in Event-B. STTT 12(6), 447–466 (2010)CrossRefGoogle Scholar
  3. 3.
    Ambert, F., Bouquet, F., Chemin, S., Guenaud, S., Legeard, B., Peureux, F., Vacelet, N., Utting, M.: BZ-TT: A tool-set for test generation from Z and B using constraint logic programming. In: Proc. of Formal Approaches to Testing of Software, FATES, pp. 105–120 (2002)Google Scholar
  4. 4.
    Amla, N., Ammann, P.: Using Z Specifications in Category Partition Testing. In: Ehrig, H., Yu, Y. (eds.) Abstract Data Types 1992 and COMPASS 1992. LNCS, vol. 785, pp. 3–10. Springer, Heidelberg (1994)Google Scholar
  5. 5.
    Ammann, P., Offutt, J.: Introduction to Software Testing. Cambridge University Press (2008)Google Scholar
  6. 6.
    Burton, S.: Automated testing from Z specifications. Technical report, University of York (2000)Google Scholar
  7. 7.
    Cheon, Y., Leavens, G.T.: A Simple and Practical Approach to Unit Testing: The JML and JUnit Way. In: Deng, T. (ed.) ECOOP 2002. LNCS, vol. 2374, pp. 231–1901. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  8. 8.
    Dick, J., Faivre, A.: Automating the Generation and Sequencing of Test Cases from Model-based Specifications. In: Larsen, P.G., Wing, J.M. (eds.) FME 1993. LNCS, vol. 670, pp. 268–284. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  9. 9.
    Galvão, S.S.L.: Especificação do micronúcleo FreeRTOS utilizando Método B. Master Thesis, DIMAp/UFRN (2010)Google Scholar
  10. 10.
    Gupta, A., Bhatia, R.: Testing functional requirements using B model specifications. SIGSOFT Softw. Eng. Notes 35(2), 1–7 (2010)CrossRefGoogle Scholar
  11. 11.
    Huaikou, M., Ling, L.: A test class framework for generating test cases from Z specifications. In: IEEE International Conference on Engineering of Complex Computer Systems (2000)Google Scholar
  12. 12.
    Jackson, D.: Alloy: a lightweight object modelling notation. ACM Trans. Softw. Eng. Methodol. 11, 256–290 (2002)CrossRefGoogle Scholar
  13. 13.
    Leavens, G.T., Baker, A.L., Ruby, C.: JML: a java modeling language. In: Proceedings of Formal Underpinnings of Java Workshop, OOPSLA 1998 (1998)Google Scholar
  14. 14.
    Leuschel, M., Butler, M.: ProB: A Model Checker for B. In: Araki, K., Gnesi, S., Mandrioli, D. (eds.) FME 2003. LNCS, vol. 2805, pp. 855–874. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  15. 15.
    Marinov, D., Khurshid, S.: TestEra: A novel framework for automated testing of Java programs. In: International Conference on Automated Software Engineering, p. 22 (2001)Google Scholar
  16. 16.
    Matos, E.C.B., Moreira, A.M., Souza, F., Coelho, R.d.S.: Generating test cases from B specifications: An industrial case study. In: Petrenko, A., Simao, A., Maldonado, J.C. (eds.) Proceedings of 22nd IFIP International Conference on Testing Software and Systems: Short Papers, November 8-10, pp. 55–60, Natal, Brazil. CRIM (Centre de Recherche Informatique de Montréal) (2010) ISBN-13: 978-2-89522-136-4Google Scholar
  17. 17.
    Mendes, E., Silveira, D.S., Lencastre, M.: Testimonium: Um método para geração de casos de teste a partir de regras de negócio expressas em OCL. In: IV Brazilian Workshop on Systematic and Automated Software Testing, SAST (2010)Google Scholar
  18. 18.
    Myers, G.J.: The Art of Software Testing, 3rd edn. Wiley (2011)Google Scholar
  19. 19.
    Plat, N., Larsen, P.G.: An overview of the ISO/VDM-SL standard. SIGPLAN Not. 27, 76–82 (1992)CrossRefGoogle Scholar
  20. 20.
    Satpathy, M., Butler, M., Leuschel, M., Ramesh, S.: Automatic Testing from Formal Specifications. In: Gurevich, Y., Meyer, B. (eds.) TAP 2007. LNCS, vol. 4454, pp. 95–113. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  21. 21.
    Satpathy, M., Leuschel, M., Butler, M.: Protest: An automatic test environment for B specifications. Electronic Notes in Theoretical Computer Science (2005)Google Scholar
  22. 22.
    Schneider, S.: B Method, An Introduction. Palgrave (2001)Google Scholar
  23. 23.
    Singh, H., Conrad, M., Sadeghipour, S., Singh, H., Conrad, M., Sadeghipour, S.: Test case design based on Z and the classification-tree method. In: First IEEE International Conference on Formal Engineering Methods, pp. 81–90 (1997)Google Scholar
  24. 24.
    Spivey, J.M.: The Z Notation: A Reference Manual, 2nd edn. Prentice-Hall (1992)Google Scholar
  25. 25.
    Tai, K., Lei, Y.: A test generation strategy for pairwise testing. IEEE Transactions on Software Engineering 28(1), 109–111 (2002)CrossRefGoogle Scholar
  26. 26.
    Warmer, J., Kleppe, A.: The Object Constraint Language: Precise Modeling with UML. Addison-Wesley (1999)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Ernesto C. B. de Matos
    • 1
  • Anamaria Martins Moreira
    • 1
  1. 1.Federal University of Rio Grande do Norte (UFRN)NatalBrazil

Personalised recommendations