Legislation-driven development of a Gift Aid system using Event-B


This work presents our approach to formally model the Swiftaid system design, a digital platform that enables donors to automatically add Gift Aid to donations made via card payments. Following principles of Behaviour-Driven Development, we use Gherkin to capture requirements specified in legislation, specifically the UK Charity (Gift Aid Declarations) Regulations 2016. The Gherkin scenarios provide a basis for subsequent formal modelling and analysis using Event-B, Rodin and ProB. Interactive model simulations assist communication between domain experts, software architects and other stakeholders during requirements capture and system design, enabling the emergent system behaviour to be validated. Our approach was employed within the development of the real Swiftaid product, launched by Streeva in February 2019. Our analysis helped conclude that there was not a strong enough business case for one of the features, whichwas shown to provide nominal user convenience at the expense of increased complexity. This work provides a case study in allying formal and agile software development to enable rapid development of robust software.


  1. ABH+10

    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. Int J Softw Tools Technol Transf 12(6), 447–466 (2010)

    Article  Google Scholar 

  2. Abr96

    Abrial, J.-R.: The B-book: assigning programs to meanings. Cambridge University Press, Cambridge (1996)

    Book  Google Scholar 

  3. Abr10

    Abrial, J.-R.: Modeling in EventB: system and software engineering. Cambridge University Press, Cambridge (2010)

    Book  Google Scholar 

  4. Beh19

    Behave: behavior-driven development, python style. https://github.com/behave/behave. Accessed 24 May 2019

  5. Car17

    Carter J (2017) BHive: behaviour-driven development meets B-method. Ph.D. thesis, The University of Guelph

  6. CC17

    Common criteria for information technology security evaluation. V3.1r5. Technical report, Common Criteria (2017)

  7. Cuc19a

    Cucumber: 10 minute tutorial. https://cucumber.io/docs/guides/10-minute-tutorial/. Accessed 24 May 2019

  8. Cuc19b

    Cucumber: a tool that supports behaviour-driven development. https://github.com/cucumber/cucumber. Accessed 24 May 2019

  9. FLDL+13

    Falampin, J., Le-Dang, H., Leuschel, M., Mokrani, M., Plagge, D.: Improving railway data validation with ProB, pp. 27–43. Springer, Berlin (2013)

    Google Scholar 

  10. Ghe19

    Gherkin Reference: Cucumber. Accessed 24 May 2019

  11. GJ13

    Gmehlich, R., Jones, C.: Experience of deployment in the automotive industry, pp. 13–26. Springer, Berlin (2013)

    Google Scholar 

  12. HLP13

    Hallerstede, S., Leuschel, M., Plagge, D.: Validation of formal models by refinement animation. Sci Comput Program 78(3), 272–292 (2013)

    Article  Google Scholar 

  13. HMR16

    HMRC (2016) The donations to charity (gift aid declarations) regulations 2016. Statutory instruments

  14. HMR18a

    HMRC (2018a) Alternative method of VAT collection—split payment. Summary of responses

  15. HMR18b

    HMR (2018b) Charitable giving and gift aid. HMRC research report 482

  16. HMR18c

    HMRC (2018c) Measuring tax gaps 2018 edition. An official statistics release

  17. Hoa69

    Hoare, C.A.R.: An axiomatic basis for computer programming. Commun. ACM 12(10), 576–580 (1969)

    Article  Google Scholar 

  18. HSL16

    Hansen D, Schneider D, Leuschel M (2016) Using B and ProB for data validation projects. In: Proceedings ABZ 2016, pp 167–182. Springer International Publishing

  19. HSTW16

    Hoang, T.S., Schneider, S., Treharne, H., Williams, D.M.: Foundations for using linear temporal logic in Event-B refinement. Formal Asp Comput 28(6), 909–935 (2016)

    MathSciNet  Article  Google Scholar 

  20. ILL+13

    Ilić, D., Laibinis, L., Latvala, T., Troubitsyna, E., Varpaaniemi, K.: Deployment in the space sector, pp. 45–62. Springer, Berlin (2013)

    Google Scholar 

  21. jBe19

    JBehave: a framework for behaviour-driven development. https://jbehave.org/. Accessed 24 May 2019

  22. LB03

    Leuschel, M., Butler, M.: ProB: A model checker for B. FME 2003: formal methods, pp. 855–874. Springer, Berlin (2003)

    Google Scholar 

  23. LFW10

    Larsen PG, Fitzgerald JS, Wolff S (2010) Are formal methods ready for agility? a reality check. Technical report no. CS-TR-1218, Newcastle University

  24. LL16

    Ladenberger L, Leuschel M (2016) BMotionWeb: A tool for rapid creation of formal prototypes. In: Software engineering and formal methods—14th international conference, SEFM 2016, Held as part of STAF 2016, Vienna, Austria, July 4–8, 2016, Proceedings, pp 403–417

  25. Man19a

    Manifesto for agile software development. https://agilemanifesto.org/. Accessed 24 May 2019

  26. Man19b

    Principles behind the agile manifesto. https://agilemanifesto.org/principles.html. Accessed 24 May 2019

  27. Nor06

    North D (2006) Introducing behaviour-driven development (BDD). Better Software

  28. RT13

    Romanovsky, A., Thomas, M.: Industrial deployment of system engineering methods providing high dependability and productivity. Springer, Berlin (2013)

    Book  Google Scholar 

  29. SdSS17

    Siqueira FL, de Sousa TC, Silva PSM (2017) Using BDD and SBVR to refine business goals into an Event-B model: a research idea. In: 2017 IEEE/ACM 5th international FME workshop on formal methods in software engineering (FormaliSE), pp 31–36. IEEE

  30. SHD+18

    Snook C, Hoang TS, Dghyam D, Butler M, Fischer T, Schlick R, Wang K (2018) Behaviour-driven formal model development. In: Formal methods and software engineering, pp 21–36. Springer

  31. Sma15

    Smart JF (2015) BDD in action: behavior-driven development for the whole software lifecycle. Manning

  32. Str19

    Streeva. Swiftaid. https://swiftaid.co.uk/. Accessed 09 July 2019

  33. STW14

    Schneider, S., Treharne, H., Wehrheim, H.: The behavioural semantics of Event-B refinement. Formal Asp Comput 26(2), 251–280 (2014)

    MathSciNet  Article  Google Scholar 

  34. SW11

    Solis C, Wang X (2011) A study of the characteristics of behaviour driven development. In: 2011 37th EUROMICRO conference on software engineering and advanced applications, pp 383–387. IEEE

  35. UKR19

    UKRI gateway to research: Swift Aid project reference 133294. https://gtr.ukri.org/projects?ref=133294. Accessed 24 May 2019

  36. WD96

    Woodcock, J., Davies, J.: Using Z: specification, refinement, and proof. Prentice Hall, Upper Saddle River (1996)

    MATH  Google Scholar 

  37. WDSM20

    Williams, D.M., Darwish, S., Schneider, S., Michael, D.R.: Swiftaid rodin event-b models. Zonodo (2020). https://doi.org/10.5281/zenodo.3715494

    Article  Google Scholar 

  38. WDSM20Ù

    Wieczorek, S., Kozyura, V., Wei, W., Roth, A., Stefanescu, A.: Business information sector, pp. 63–79. Springer, Berlin (2013)

    Google Scholar 

  39. WL20

    Werth M, Leuschel M (2020) VisB: A lightweight tool to visualize formal models with SVG graphics. In: Proceedings ABZ 2020, LNCS

Download references


This work was funded by UKRI through the Innovate UK Swiftaid Project (Grant Number 133294). We thank Chris Chorley and Dr. François Dupressoir for contributing to the specification of Gherkin scenarios and Event-B modelling and we thank Dr. Benjamin Aziz and Dr. Philip Godsiff for insightful comments on an early draft of this paper. We also thank the anonymous reviewers for providing their essential critical insight.

Author information



Corresponding author

Correspondence to David M. Williams.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Michael Butler

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Williams, D.M., Darwish, S., Schneider, S. et al. Legislation-driven development of a Gift Aid system using Event-B. Form Asp Comp 32, 251–273 (2020). https://doi.org/10.1007/s00165-020-00512-5

Download citation


  • Behaviour-driven development
  • Formal modelling
  • Gherkin
  • Event-B
  • Gift Aid
  • Swiftaid