Test-Data Generation for Xtext

Tool Paper
  • Johannes Härtel
  • Lukas Härtel
  • Ralf Lämmel
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8706)


We describe a method and a corresponding tool for grammar-based test-data generation (GBTG). The basic generation principle is to enumerate test data based on grammatical choices. However, generation is broken down into two phases to deal with context-sensitive properties in an efficient and convenient manner. The first phase enumerates test data (i.e., parse trees) with placeholders. The second phase instantiates the placeholders through post-processors. A DSL for grammar transformation is used to customize a given grammar, meant for parsing, to be more suitable for test-data generation. Post-processors are derived from a corresponding object-oriented framework. The actual tool, Xtextgen, extends theXtext technology for language development.


Grammars Test-data generation Test-data enumeration Grammar transformation Grammar customization Context sensitivity Xtext Xtend Xtextgen 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Alanen, M., Porres, I.: A Relation Between Context-Free Grammars and Meta Object Facility Metamodels. Technical report, Turku Centre for CS (2003)Google Scholar
  2. 2.
    Brottier, E., Fleurey, F., Steel, J., Baudry, B., Traon, Y.L.: Metamodel-based test generation for model transformations: An algorithm and a tool. In: ISSRE, pp. 85–94. IEEE (2006)Google Scholar
  3. 3.
    Burgess, C.J.: The Automated Generation of Test Cases for Compilers. Software Testing, Verification and Reliability 4(2), 81–99 (1994)CrossRefGoogle Scholar
  4. 4.
    Burgueño, L., Wimmer, M., Troya, J., Vallecillo, A.: TractsTool: Testing Model Transformations based on Contracts. In: Demos/Posters/StudentResearch@MoDELS. CEUR Workshop Proceedings, vol. 1115, pp. 76–80 (2013)Google Scholar
  5. 5.
    Dean, T.R., Cordy, J.R., Malton, A.J., Schneider, K.A.: Grammar Programming in TXL. In: SCAM, p. 93. IEEE (2002)Google Scholar
  6. 6.
    Ehrig, K., Küster, J.M., Taentzer, G.: Generating instance models from meta models. Software and System Modeling 8(4), 479–500 (2009)CrossRefGoogle Scholar
  7. 7.
    Harm, J., Lämmel, R.: Two-dimensional Approximation Coverage. Informatica, 24(3) (2000)Google Scholar
  8. 8.
    Hoffman, D., Ly-Gagnon, D., Strooper, P.A., Wang, H.-Y.: Grammar-based test generation with YouGen. Softw. Pract. Exper. 41(4), 427–447 (2011)CrossRefGoogle Scholar
  9. 9.
    Hoffman, D., Wang, H.-Y., Chang, M., Ly-Gagnon, D., Sobotkiewicz, L., Strooper, P.A.: Two case studies in grammar-based test generation. Journal of Systems and Software 83(12), 2369–2378 (2010)CrossRefGoogle Scholar
  10. 10.
    Kats, L.C.L., Vermaas, R., Visser, E.: Integrated language definition testing: Enabling test-driven language development. In: OOPSLA, pp. 139–154. ACM (2011)Google Scholar
  11. 11.
    Kats, L.C.L., Vermaas, R., Visser, E.: Testing domain-specific languages. In: OOPSLA Companion, pp. 25–26. ACM (2011)Google Scholar
  12. 12.
    Kossatchev, A.S., Posypkin, M.A.: Survey of Compiler Testing Methods. Programming and Computing Software 31, 10–19 (2005)CrossRefGoogle Scholar
  13. 13.
    Lämmel, R.: Another DSL primer, 2013. Technical Documentation. Version 0.00003 as of (December 25, 2013),
  14. 14.
    Lämmel, R., Schulte, W.: Controllable Combinatorial Coverage in Grammar-Based Testing. In: Uyar, M.Ü., Duale, A.Y., Fecko, M.A. (eds.) TestCom 2006. LNCS, vol. 3964, pp. 19–38. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  15. 15.
    Lämmel, R., Zaytsev, V.: Recovering grammar relationships for the Java Language Specification. Software Quality Journal 19(2), 333–378 (2011)CrossRefGoogle Scholar
  16. 16.
    Maurer, P.: Generating Test Data with Enhanced Context-free Grammars. IEEE Software 7(4), 50–56 (1990)CrossRefGoogle Scholar
  17. 17.
    McKeeman, W.M.: Differential Testing for Software. Digital Technical Journal of Digital Equipment Corporation 10(1), 100–107 (1998)Google Scholar
  18. 18.
    Sirer, E.G., Bershad, B.N.: Using Production Grammars in Software Testing. SIGPLAN Notices 35, 1–13 (1999)CrossRefGoogle Scholar
  19. 19.
    Vallecillo, A., Gogolla, M., Burgueño, L., Wimmer, M., Hamann, L.: Formal Specification and Testing of Model Transformations. In: Bernardo, M., Cortellessa, V., Pierantonio, A. (eds.) SFM 2012. LNCS, vol. 7320, pp. 399–437. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  20. 20.
    Zelenov, S.V., Zelenova, S.: Automated Generation of Positive and Negative Tests for Parsers. In: Grieskamp, W., Weise, C. (eds.) FATES 2005. LNCS, vol. 3997, pp. 187–202. Springer, Heidelberg (2006)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Johannes Härtel
    • 1
  • Lukas Härtel
    • 1
  • Ralf Lämmel
    • 1
  1. 1.Software Languages TeamUniversity of Koblenz-LandauGermany

Personalised recommendations