Skip to main content

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

  • Conference paper
  • First Online:
Tests and Proofs (TAP 2019)

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.

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

    This operation implements the Russian Multiplication technique, that iteratively doubles one of the factors while halving the other one. The variant and invariant clauses are standard B elements, which are necessary to prove the correctness of the operation, including its termination.

References

  1. Abrial, J.: The B-Book - Assigning Programs to Meanings. Cambridge University Press, Cambridge (2005)

    Google Scholar 

  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. Ammann, P., Offutt, J.: Introduction to Software Testing. Cambridge University Press, Cambridge (2008)

    Google Scholar 

  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. 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_1

    Chapter  Google Scholar 

  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. 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. Dijkstra, E.W.: A Discipline of Programming, vol. 1. Prentice-Hall, Englewood Cliffs (1976)

    Google Scholar 

  9. Clearsy System Engineering: Atelier B User Manual. Aix-en-Provence (1996)

    Google Scholar 

  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_24

    Chapter  Google Scholar 

  11. Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)

    Article  Google Scholar 

  12. Leuschel, M.: User manual - prob documentation (2017). https://www3.hhu.de/stups/prob/index.php/User_Manual

  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. 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_6

    Chapter  Google Scholar 

  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. 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_5

    Chapter  Google Scholar 

  17. Satpathy, M., Leuschel, M., Butler, M.: ProTest: an automatic test environment for B specifications. ENTCS 111, 113–136 (2005)

    Google Scholar 

  18. Schneider, S.: The B-Method: An Introduction. Palgrave, Basingstoke (2001)

    Google Scholar 

  19. Shafique, M.: Systematic review of state based model based testing tools. Ph.D. thesis, Carleton University Ottawa (2010)

    Google Scholar 

Download references

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.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Diego de Azevedo Oliveira , Valério Medeiros Jr. , David Déharbe or Martin A. Musicante .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

de Azevedo Oliveira, D., Medeiros, V., Déharbe, D., Musicante, M.A. (2019). BTestBox: A Tool for Testing B Translators and Coverage of B Models. In: Beyer, D., Keller, C. (eds) Tests and Proofs. TAP 2019. Lecture Notes in Computer Science(), vol 11823. Springer, Cham. https://doi.org/10.1007/978-3-030-31157-5_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-31157-5_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-31156-8

  • Online ISBN: 978-3-030-31157-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics