Table of Contents
Fetching ...

Unit Testing in ASP Revisited: Language and Test-Driven Development Environment

Giovanni Amendola, Tobias Berei, Giuseppe Mazzotta, Francesco Ricca

TL;DR

The paper tackles unit testing for Answer Set Programming (ASP), revisiting existing approaches (ASPIDE 2011, LANA) that separate tests from code or lack inline integration. It proposes an inline, annotation-based unit test language for ASP-Core-2 embedded in code, together with a web-based environment (ASP-WIDE) that supports test-driven development. A comprehensive complexity analysis assigns precise $\Pi_2^P$-c, $\Delta_3^P$-c, $PP$-c, and related costs to the various testing tasks, showing that practical testing remains efficient under the small-scope hypothesis and that ASP-WIDE outperforms a re-implementation of ASPIDE. The work also demonstrates potential to certify ethical or application-specific requirements via declarative tests and provides a reusable platform with availability.

Abstract

Unit testing frameworks are nowadays considered a best practice, included in almost all modern software development processes, to achieve rapid development of correct specifications. Knowledge representation and reasoning paradigms such as Answer Set Programming (ASP), that have been used in industry-level applications, are not an exception. Indeed, the first unit testing specification language for ASP was proposed in 2011 as a feature of the ASPIDE development environment. Later, a more portable unit testing language was included in the LANA annotation language. In this paper we revisit both languages and tools for unit testing in ASP. We propose a new unit test specification language that allows one to inline tests within ASP programs, and we identify the computational complexity of the tasks associated with checking the various program-correctness assertions. Test-case specifications are transparent to the traditional evaluation, but can be interpreted by a specific testing tool. Thus, we present a novel environment supporting test driven development of ASP programs.

Unit Testing in ASP Revisited: Language and Test-Driven Development Environment

TL;DR

The paper tackles unit testing for Answer Set Programming (ASP), revisiting existing approaches (ASPIDE 2011, LANA) that separate tests from code or lack inline integration. It proposes an inline, annotation-based unit test language for ASP-Core-2 embedded in code, together with a web-based environment (ASP-WIDE) that supports test-driven development. A comprehensive complexity analysis assigns precise -c, -c, -c, and related costs to the various testing tasks, showing that practical testing remains efficient under the small-scope hypothesis and that ASP-WIDE outperforms a re-implementation of ASPIDE. The work also demonstrates potential to certify ethical or application-specific requirements via declarative tests and provides a reusable platform with availability.

Abstract

Unit testing frameworks are nowadays considered a best practice, included in almost all modern software development processes, to achieve rapid development of correct specifications. Knowledge representation and reasoning paradigms such as Answer Set Programming (ASP), that have been used in industry-level applications, are not an exception. Indeed, the first unit testing specification language for ASP was proposed in 2011 as a feature of the ASPIDE development environment. Later, a more portable unit testing language was included in the LANA annotation language. In this paper we revisit both languages and tools for unit testing in ASP. We propose a new unit test specification language that allows one to inline tests within ASP programs, and we identify the computational complexity of the tasks associated with checking the various program-correctness assertions. Test-case specifications are transparent to the traditional evaluation, but can be interpreted by a specific testing tool. Thus, we present a novel environment supporting test driven development of ASP programs.
Paper Structure (35 sections, 1 theorem, 4 equations, 9 figures, 8 tables)

This paper contains 35 sections, 1 theorem, 4 equations, 9 figures, 8 tables.

Key Result

Theorem 4.1

All results stated in Table tab:Complexity do hold.

Figures (9)

  • Figure 1: Testing graph colouring.
  • Figure 2: Bugged encoding of Hamiltonian Cycle.
  • Figure 3: Architecture of ASP-WIDE.
  • Figure 4: TestSuite class definition.
  • Figure 5: Implementation of the @trueInAtMost assertion.
  • ...and 4 more figures

Theorems & Definitions (4)

  • Example 2.1
  • Definition 1: DBLP:journals/sigact/HemaspaandraV95
  • Definition 2: DBLP:journals/sigact/HemaspaandraV95
  • Theorem 4.1