Regular expressions are used to characterize sets of strings (ie, languages) using a pattern-based syntax. They are applied in different contexts as, for example, data validation in Web forms. However, writing a regular expression that exactly captures the desired set of strings could be particularly difficult, and techniques are sought to validate regular expressions or test their use in applications. A common means to regular expression validation and testing is the generation of a set of labelled strings (ie, strings together with their evaluation). We here propose a fault-based approach for generating strings usable as tests for regular expressions. We define some fault classes representing mistakes that could be made when writing a regular expression, and we introduce the notion of distinguishing string, ie, a string that is able to expose a fault. Given a regular expression, our approach generates a test suite composed of distinguishing strings that are able to detect possible faults in the regular expression. We present different versions of the approach, which provide different results in terms of test suite size and generation time. Experiments show that the proposed approach can generate compact test suites and that, using suitable optimizations, the generation time is reasonable. Exploiting the proposed fault classes, we use the notion of mutation score to assess the ability of a generic set of strings in exposing possible faults contained in the regular expression under test. A comparison with other test generation tools in terms of mutation score, size, and generation time shows the advantages and limits of our approach.

Fault-based test generation for regular expressions by mutation / P. Arcaini, A. Gargantini, E. Riccobene. - In: SOFTWARE TESTING VERIFICATION & RELIABILITY. - ISSN 0960-0833. - 29:1-2(2019 Jan), p. e1664.1. [10.1002/stvr.1664]

Fault-based test generation for regular expressions by mutation

E. Riccobene
2019

Abstract

Regular expressions are used to characterize sets of strings (ie, languages) using a pattern-based syntax. They are applied in different contexts as, for example, data validation in Web forms. However, writing a regular expression that exactly captures the desired set of strings could be particularly difficult, and techniques are sought to validate regular expressions or test their use in applications. A common means to regular expression validation and testing is the generation of a set of labelled strings (ie, strings together with their evaluation). We here propose a fault-based approach for generating strings usable as tests for regular expressions. We define some fault classes representing mistakes that could be made when writing a regular expression, and we introduce the notion of distinguishing string, ie, a string that is able to expose a fault. Given a regular expression, our approach generates a test suite composed of distinguishing strings that are able to detect possible faults in the regular expression. We present different versions of the approach, which provide different results in terms of test suite size and generation time. Experiments show that the proposed approach can generate compact test suites and that, using suitable optimizations, the generation time is reasonable. Exploiting the proposed fault classes, we use the notion of mutation score to assess the ability of a generic set of strings in exposing possible faults contained in the regular expression under test. A comparison with other test generation tools in terms of mutation score, size, and generation time shows the advantages and limits of our approach.
Distinguishing string; Fault class; Mutation score; Mutation testing; Regular expression
Settore INF/01 - Informatica
gen-2019
Article (author)
File in questo prodotto:
File Dimensione Formato  
mutrexSIstvr2017.pdf

Open Access dal 01/02/2020

Tipologia: Post-print, accepted manuscript ecc. (versione accettata dall'editore)
Dimensione 926.73 kB
Formato Adobe PDF
926.73 kB Adobe PDF Visualizza/Apri
Arcaini_et_al-2018-Software_Testing,_Verification_and_Reliability.pdf

accesso riservato

Tipologia: Publisher's version/PDF
Dimensione 8.06 MB
Formato Adobe PDF
8.06 MB Adobe PDF   Visualizza/Apri   Richiedi una copia
Pubblicazioni consigliate

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/2434/585084
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 15
  • ???jsp.display-item.citation.isi??? 6
social impact