Skip to main content

Unit Testing in ASPIDE

  • Conference paper
  • First Online:
Applications of Declarative Programming and Knowledge Management (INAP 2011, WLP 2011)

Abstract

Answer Set Programming (ASP) is a declarative logic programming formalism, which is employed nowadays in both academic and industrial real-world applications. Although some tools for supporting the development of ASP programs have been proposed in the last few years, the crucial task of testing ASP programs received less attention and it is an Achilles’ heel of the available programming environments. In this paper we present a language for specifying and running unit tests on ASP programs. The testing language was implemented in ASPIDE, a comprehensive IDE for ASP, which supports the entire life cycle of ASP development with a collection of user-friendly graphical tools for program composition, testing, debugging, profiling, solver execution configuration, and output handling.

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.

    For an exhaustive feature-wise comparison with existing environments for developing logic programs we refer the reader to [32].

  2. 2.

    As an example, note that the semantics of a Prolog program changes if we modify the rule’s order in the program, but this is not true in ASP where rule order is immaterial. Thus, meaningful unit tests in ASP can be obtained by collecting rules without taking care of their “position” in the program, the same does not hold for Prolog.

  3. 3.

    A test conceived for verifying some functionality of an application without knowing the code internals is said to be a black-box test. A test conceived for verifying the behavior of a specific part of a program is called a white-box test. White box testing is an activity usually carried out by developers and it is a key component of agile software development [44].

  4. 4.

    Note that this definition of test case is more general than the one of [33]. Indeed, all test cases in [33] are such that: \(\mathcal U = \mathcal{P}{}\), \(\mathcal I \) is the set of ground inputs, and \(\mathcal A\) contains the assertions stating that the set of expected outputs is in \(ANS(\mathcal U \cup \mathcal I)\).

  5. 5.

    Note that the notion of DLP-Function does not allow to split the program in a unique deterministic way, thus we pragmatically decided to support this notion only for checking units.

  6. 6.

    Non-terminals are in bold face, token specifications are omitted for simplicity.

  7. 7.

    pfilter excludes the strongly negated ones, while nfilter has opposite behavior.

  8. 8.

    DLP-Functions offer a fine way of decomposing a program in modules that can be joined together to construct \(\mathcal{P}\). The interested reader is referred to [36] for a formal definition.

  9. 9.

    Space constraints prevent us from providing a complete description of all the usage scenarios and commands; rather, we focus on the testing interface presenting a specific example.

References

  1. Gelfond, M., Lifschitz, V.: Classical negation in logic programs and disjunctive databases. NGC 9, 365–385 (1991)

    Article  Google Scholar 

  2. Lifschitz, V.: Answer set planning. In: ICLP’99, pp. 23–37. MIT Press (1999)

    Google Scholar 

  3. Buccafurri, F., Leone, N., Rullo, P.: Enhancing disjunctive datalog by constraints. IEEE TKDE 12(5), 845–860 (2000)

    Google Scholar 

  4. Faber, W., Leone, N., Pfeifer, G.: Semantics and complexity of recursive aggregates in answer set programming. AI 175(1), 278–298 (2011). Special Issue: John McCarthy’s Legacy

    MathSciNet  MATH  Google Scholar 

  5. Eiter, T., Gottlob, G., Mannila, H.: Disjunctive datalog. ACM TODS 22(3), 364–418 (1997)

    Article  Google Scholar 

  6. Gebser, M., Liu, L., Namasivayam, G., Neumann, A., Schaub, T., Truszczyński, M.: The first answer set programming system competition. In: Baral, C., Brewka, G., Schlipf, J. (eds.) LPNMR 2007. LNCS (LNAI), vol. 4483, pp. 3–17. Springer, Heidelberg (2007)

    Google Scholar 

  7. Balduccini, M., Gelfond, M., Watson, R., Nogueira, M.: The USA-Advisor: a case study in answer set planning. In: Eiter, T., Faber, W., Truszczyński, M. (eds.) LPNMR 2001. LNCS (LNAI), vol. 2173, pp. 439–442. Springer, Heidelberg (2001)

    Google Scholar 

  8. Baral, C., Gelfond, M.: Reasoning agents in dynamic domains. In: Minker, J. (ed.) Logic-Based Artificial Intelligence, pp. 257–279. Kluwer, Dordrecht (2000)

    Chapter  Google Scholar 

  9. Baral, C., Uyan, C.: Declarative specification and solution of combinatorial auctions using logic programming. In: Eiter, T., Faber, W., Truszczyński, M. (eds.) LPNMR 2001. LNCS (LNAI), vol. 2173, pp. 186–199. Springer, Heidelberg (2001)

    Google Scholar 

  10. Franconi, E., Palma, A.L., Leone, N., Perri, S.: Census data repair: a challenging application of disjunctive logic programming. In: Nieuwenhuis, R., Voronkov, A. (eds.) LPAR 2001. LNCS (LNAI), vol. 2250, pp. 561–578. Springer, Heidelberg (2001)

    Google Scholar 

  11. Nogueira, M., Balduccini, M., Gelfond, M., Watson, R., Barry, M.: An A-Prolog decision support system for the space shuttle. In: Ramakrishnan, I.V. (ed.) PADL 2001. LNCS, vol. 1990, pp. 169–183. Springer, Heidelberg (2001)

    Google Scholar 

  12. Leone, N., et al.: The INFOMIX system for advanced integration of incomplete and inconsistent data. In: SIGMOD 2005, pp. 915–917. ACM Press (2005)

    Google Scholar 

  13. Baral, C.: Knowledge Representation, Reasoning and Declarative Problem Solving. Cambridge University Press, Cambridge (2003)

    Book  MATH  Google Scholar 

  14. Grasso, G., Iiritano, S., Leone, N., Ricca, F.: Some DLV applications for knowledge management. In: Erdem, E., Lin, F., Schaub, T. (eds.) LPNMR 2009. LNCS, vol. 5753, pp. 591–597. Springer, Heidelberg (2009)

    Google Scholar 

  15. Gebser, M., Schaub, T., Thiele, S., Veber, P.: Detecting inconsistencies in large biological networks with answer set programming. TPLP 11(2–3), 323–360 (2011)

    MathSciNet  MATH  Google Scholar 

  16. Gebser, M., Kaminski, R., Schaub, T.: aspcud: a linux package configuration tool based on answer set programming. In: LoCoCo, pp. 12–25 (2011)

    Google Scholar 

  17. Ricca, F., Dimasi, A., Grasso, G., Ielpa, S.M., Iiritano, S., Manna, M., Leone, N.: Logic-based system for e-Tourism. FI 105(1–2), 35–55 (2010)

    MathSciNet  Google Scholar 

  18. Ricca, F., Grasso, G., Alviano, M., Manna, M., Lio, V., Iiritano, S., Leone, N.: Team-building with answer set programming in the Gioia-Tauro seaport. TPLP. http://dx.doi.org/10.1017/S147106841100007X (2011)

  19. Denecker, M., Vennekens, J., Bond, S., Gebser, M., Truszczyński, M.: The second answer set programming competition. In: Erdem, E., Lin, F., Schaub, T. (eds.) LPNMR 2009. LNCS, vol. 5753, pp. 637–654. Springer, Heidelberg (2009)

    Google Scholar 

  20. Calimeri, F., et al.: The third answer set programming competition: preliminary report of the system competition track. In: Delgrande, J.P., Faber, W. (eds.) LPNMR 2011. LNCS, vol. 6645, pp. 388–403. Springer, Heidelberg (2011)

    Google Scholar 

  21. Dovier, A., Erdem, E.: Report on application session @lpnmr09. http://www.cs.nmsu.edu/ALP/2010/03/report-on-application-session-lpnmr09/ (2009)

  22. Perri, S., Ricca, F., Terracina, G., Cianni, D., Veltri, P.: An integrated graphic tool for developing and testing DLV programs. In: SEA 07, pp. 86–100 (2007)

    Google Scholar 

  23. Sureshkumar, A., Vos, M.D., Brain, M., Fitch, J.: APE: an AnsProlog* environment. In: SEA 07, pp. 101–115 (2007)

    Google Scholar 

  24. Brain, M., Gebser, M., Pührer, J., Schaub, T., Tompits, H., Woltran, S.: That is illogical captain! The debugging support tool spock for answer-set programs: system description. In: SEA 07, pp. 71–85 (2007)

    Google Scholar 

  25. Brain, M., De Vos, M.: Debugging logic programs under the answer set semantics. In: ASP’05, Bath, UK (2005)

    Google Scholar 

  26. El-Khatib, O., Pontelli, E., Son, T.C.: Justification and debugging of answer set programs in ASP. In: Proceedings of Automated Debugging, California, USA. ACM (2005)

    Google Scholar 

  27. Oetsch, J., Pührer, J., Tompits, H.: Catching the ouroboros: on debugging non-ground answer-set programs. In: Proceedings of the ICLP’10 (2010)

    Google Scholar 

  28. Brain, M., Gebser, M., Pührer, J., Schaub, T., Tompits, H., Woltran, S.: Debugging ASP programs by means of ASP. In: Baral, C., Brewka, G., Schlipf, J. (eds.) LPNMR 2007. LNCS (LNAI), vol. 4483, pp. 31–43. Springer, Heidelberg (2007)

    Google Scholar 

  29. De Vos, M., Schaub, T., (eds.): SEA’07: Software Engineering for Answer Set Programming, vol. 281. CEUR. http://CEUR-WS.org/Vol-281/ (2007)

  30. De Vos, M., Schaub, T., (eds.): SEA’09: Software Engineering for Answer Set Programming, vol. 546. CEUR. http://CEUR-WS.org/Vol-546/ (2009)

  31. Ricca, F., Gallucci, L., Schindlauer, R., Dell’Armi, T., Grasso, G., Leone, N.: OntoDLV: an ASP-based system for enterprise ontologies. JLC 19(4), 643–670 (2009)

    MathSciNet  MATH  Google Scholar 

  32. Febbraro, O., Reale, K., Ricca, F.: ASPIDE: integrated development environment for answer set programming. In: Delgrande, J.P., Faber, W. (eds.) LPNMR 2011. LNCS, vol. 6645, pp. 317–330. Springer, Heidelberg (2011)

    Google Scholar 

  33. Janhunen, T., Niemelä, I., Oetsch, J., Pührer, J., Tompits, H.: On testing answer-set programs. In: Proceeding of the conference on ECAI 2010: 19th European Conference on Artificial Intelligence, pp. 951–956. IOS Press, Amsterdam (2010)

    Google Scholar 

  34. Janhunen, T., Niemelä, I., Oetsch, J., Pührer, J., Tompits, H.: Random vs. structure-based testing of answer-set programs: an experimental comparison. In: Delgrande, J.P., Faber, W. (eds.) LPNMR 2011. LNCS, vol. 6645, pp. 242–247. Springer, Heidelberg (2011)

    Google Scholar 

  35. JUnit.org community: JUnit, Resources for Test Driven Development. http://www.junit.org/

  36. Janhunen, T., Oikarinen, E., Tompits, H., Woltran, S.: Modularity aspects of disjunctive stable models. J. Artif. Intell. Res. (JAIR) 35, 813–857 (2009)

    MathSciNet  MATH  Google Scholar 

  37. Jack, O.: Software Testing for Conventional and Logic Programming. Walter de Gruyter & Co., Hawthorne (1996)

    Book  Google Scholar 

  38. Wielemaker, J.: Prolog Unit Tests. http://www.swi-prolog.org/pldoc/package/plunit.html

  39. Cancinos, C.: Prolog Development Tools - ProDT. http://prodevtools.sourceforge.net

  40. Gelfond, M., Leone, N.: Logic programming and knowledge representation - the A-Prolog perspective. AI 138(1–2), 3–38 (2002)

    MathSciNet  MATH  Google Scholar 

  41. Lifschitz, V., Turner, H.: Splitting a logic program. In: ICLP’94, pp. 23–37. MIT Press (1994)

    Google Scholar 

  42. Eiter, T., Ianni, G., Lukasiewicz, T., Schindlauer, R., Tompits, H.: Combining answer set programming with description logics for the semantic web. Artif. Intell. 172, 1495–1539 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  43. Dell’Armi, T., Faber, W., Ielpa, G., Leone, N., Pfeifer, G.: Aggregate functions in disjunctive logic programming: semantics, complexity, and implementation in DLV. In: IJCAI 2003, Acapulco. Mexico, pp. 847–852 (2003)

    Google Scholar 

  44. Sommerville, I.: Software Engineering. Addison-Wesley, Harlow (2004)

    Google Scholar 

  45. Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM TCL 7(3), 499–562 (2006)

    Article  MathSciNet  Google Scholar 

  46. Calimeri, F., Ianni, G., Ricca, F.: The third answer set programming system competition. https://www.mat.unical.it/aspcomp2011/ (2011)

  47. Terracina, G., Leone, N., Lio, V., Panetta, C.: Experimenting with recursive queries in database and logic programming systems. TPLP 8, 129–165 (2008)

    MathSciNet  MATH  Google Scholar 

  48. Ianni, G., Ielpa, G., Pietramala, A., Santoro, M.C.: Answer set programming with templates. In: ASP’03, Messina, Italy, pp. 239–252. http://CEUR-WS.org/Vol-78/ (2003)

  49. Calimeri, F., Leone, N., Ricca, F., Veltri, P.: A visual tracer for DLV. In: Proceedings of SEA’09, Potsdam, Germany (2009)

    Google Scholar 

  50. Febbraro, O., Reale, K., Ricca, F.: A visual interface for drawing ASP programs. In: Proceedings of CILC2010, Rende(CS), Italy (2010)

    Google Scholar 

  51. Gebser, M., Kaufmann, B., Neumann, A., Schaub, T.: Conflict-driven answer set solving. In: IJCAI 2007, pp. 386–392 (2007)

    Google Scholar 

  52. Oetsch, J., Pührer, J., Seidl, M., Tompits, H., Zwickl, P.: VIDEAS: a development tool for answer-set programs based on model-driven engineering technology. In: Delgrande, J.P., Faber, W. (eds.) LPNMR 2011. LNCS, vol. 6645, pp. 382–387. Springer, Heidelberg (2011)

    Google Scholar 

Download references

Acknowledgments.

This work has been partially supported by the Calabrian Region under PIA (Pacchetti Integrati di Agevolazione industria, artigianato e servizi) project DLVSYSTEM approved in BURC n. 20 parte III del 15/05/2009 - DR n. 7373 del 06/05/2009.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Kristian Reale .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Febbraro, O., Leone, N., Reale, K., Ricca, F. (2013). Unit Testing in ASPIDE . In: Tompits, H., et al. Applications of Declarative Programming and Knowledge Management. INAP WLP 2011 2011. Lecture Notes in Computer Science(), vol 7773. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-41524-1_21

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-41524-1_21

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-41523-4

  • Online ISBN: 978-3-642-41524-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics