Advertisement

BTestBox: A Tool for Testing B Translators and Coverage of B Models

  • Diego de Azevedo OliveiraEmail author
  • Valério MedeirosJr.Email author
  • David DéharbeEmail author
  • Martin A. MusicanteEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11823)

Abstract

The argument of correctness in refinement-based formal software design often disregards source code analysis and code generation. To mitigate the risk of errors in these phases, certifications issued by regulation entities demand or recommend testing the generated software using a code coverage criteria. We propose improvements for the BTestBox, a tool for automatic generation of tests for software components developed with the B method. BTestBox supports several code coverage criteria and code generators for different languages. The tool uses a constraint solver to produce tests, thus being able to identify dead code and tautological branching conditions. It also generates reports with different metrics and may be used as an extension to the Atelier B. Our tool performs a double task: first, it acts on the B model, by checking the code coverage. Second, the tool performs the translation of lower level B specifications into programming language code, runs tests and compares their results with the expected output of the test cases. The present version of BTestBox uses parallelisation techniques that significantly improve its performance. The results presented here are encouraging, showing performance numbers that are one order of magnitude better than the ones obtained in the tool’s previous version.

Keywords

B method Model-based testing Code coverage 

Notes

Acknowledgement

The work is partly supported by the IFRN, the UFRN, the ClearSy and High Performance Computing Center at UFRN (NPAD/UFRN). This study was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001.

References

  1. 1.
    Abrial, J.: The B-Book - Assigning Programs to Meanings. Cambridge University Press, Cambridge (2005)Google Scholar
  2. 2.
    Ambert, F., et al.: BZ-TT: a tool-set for test generation from Z and B using constraint logic programming. In: Proceedings of FATES 2002, pp. 105–120 (2002)Google Scholar
  3. 3.
    Ammann, P., Offutt, J.: Introduction to Software Testing. Cambridge University Press, Cambridge (2008)Google Scholar
  4. 4.
    Ammann, P., Offutt, J., Huang, H.: Coverage criteria for logical expressions. In: 14th International Symposium on Software Reliability Engineering, ISSRE 2003, pp. 99–107. IEEE (2003)Google Scholar
  5. 5.
    Bonichon, R., Déharbe, D., Lecomte, T., Medeiros Jr., V.: LLVM-based code generation for B. In: Braga, C., Martí-Oliet, N. (eds.) SBMF 2014. LNCS, vol. 8941, pp. 1–16. Springer, Cham (2015).  https://doi.org/10.1007/978-3-319-15075-8_1CrossRefGoogle Scholar
  6. 6.
    Dalal, S.R., et al.: Model-based testing in practice. In: Proceedings of the 21st International Conference on Software Engineering, pp. 285–294. ACM (1999)Google Scholar
  7. 7.
    Déharbe, D., Azevedo, D., Matos, E.C.B., de Medeiros Jr., V.: BtestBox: an automatic test generator for B method. In: VII Congresso Brasileiro de Software: Teoria e Prática (CBSOFT 2016) - Sessão de ferramentas, pp. 81–88 (2016)Google Scholar
  8. 8.
    Dijkstra, E.W.: A Discipline of Programming, vol. 1. Prentice-Hall, Englewood Cliffs (1976)Google Scholar
  9. 9.
    Clearsy System Engineering: Atelier B User Manual. Aix-en-Provence (1996)Google Scholar
  10. 10.
    Hoare, C.A.R.: Proof of correctness of data representations. In: Broy, M., Denert, E. (eds.) Software Pioneers, pp. 385–396. Springer, Heidelberg (2002).  https://doi.org/10.1007/978-3-642-59412-0_24CrossRefGoogle Scholar
  11. 11.
    Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)CrossRefGoogle Scholar
  12. 12.
    Leuschel, M.: User manual - prob documentation (2017). https://www3.hhu.de/stups/prob/index.php/User_Manual
  13. 13.
    Marinescu, R., Seceleanu, C., Le Guen, H., Pettersson, P.: A research overview of tool-supported model-based testing of requirements-based designs. In: Advances in Computers, vol. 98, pp. 89–140. Elsevier (2015)Google Scholar
  14. 14.
    de Matos, E.C.B., Moreira, A.M.: BETA: a B based testing approach. In: Gheyi, R., Naumann, D. (eds.) SBMF 2012. LNCS, vol. 7498, pp. 51–66. Springer, Heidelberg (2012).  https://doi.org/10.1007/978-3-642-33296-8_6CrossRefGoogle Scholar
  15. 15.
    Medeiros Jr., V.: Método B e a síntese verificada para código de montagem. Ph.D. thesis, UFRN, Federal University of Rio Grande do Norte, Natal (2016)Google Scholar
  16. 16.
    Moreira, A.M., Hentz, C., Déharbe, D., de Matos, E.C.B., Neto, J.B.S., de Medeiros, V.: Verifying code generation tools for the B-method using tests: a case study. In: Blanchette, J.C., Kosmatov, N. (eds.) TAP 2015. LNCS, vol. 9154, pp. 76–91. Springer, Cham (2015).  https://doi.org/10.1007/978-3-319-21215-9_5CrossRefGoogle Scholar
  17. 17.
    Satpathy, M., Leuschel, M., Butler, M.: ProTest: an automatic test environment for B specifications. ENTCS 111, 113–136 (2005)Google Scholar
  18. 18.
    Schneider, S.: The B-Method: An Introduction. Palgrave, Basingstoke (2001)Google Scholar
  19. 19.
    Shafique, M.: Systematic review of state based model based testing tools. Ph.D. thesis, Carleton University Ottawa (2010)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Université de SherbrookeSherbrookeCanada
  2. 2.Instituto Federal de Educação, Ciência e Tecnologia do Rio Grande do NorteNatalBrazil
  3. 3.Clearsy System EngineeringAix-en-ProvenceFrance
  4. 4.Universidade Federal do Rio Grande do NorteNatalBrazil

Personalised recommendations