TL;DR
This paper introduces RTM, a novel approach to automatically reduce the size of test suites for natural language-based requirements while ensuring complete requirement coverage and maintaining high fault detection rates. It addresses the growing problem of redundant test cases in complex software systems, particularly in safety-critical domains like automotive, by leveraging text embeddings and genetic algorithms.
What Problem Does This Paper Address?
As software systems become more complex, their test suites tend to grow, often leading to significant redundancy. This redundancy increases testing effort, time, and cost, while also potentially masking actual issues. Traditional test suite minimization (TSM) techniques often rely on code coverage, which isn't suitable for test cases written in natural language. Furthermore, many existing TSM methods struggle to simultaneously guarantee full requirement coverage and adhere to a strict budget, a common constraint in industrial settings. This paper tackles the challenge of minimizing natural language test suites for requirement-based testing, ensuring both comprehensive coverage and effective fault detection within practical resource limitations.
Methods
RTM employs a multi-stage approach:
- Test Case Preprocessing: Three methods are explored to clean and normalize natural language test steps, including lowercasing, punctuation stripping, and tokenization.
- Text Representation (Embedding): Test cases are converted into numerical vectors using various techniques. This includes:
- Sentence-level embeddings: TF-IDF, Universal Sentence Encoder (USE), LongT5, and Amazon Titan Text Embedding V2.
- Word-level embeddings: Word2Vec, GloVe, and FastText.
- Similarity Measurement: Distances between these vector representations are calculated using:
- Word Mover's Distance (WMD) for word-level embeddings.
- Cosine Similarity and Euclidean Distance for sentence-level embeddings.
- Evolutionary Search (Genetic Algorithm - GA): A GA is used to search for an optimal subset of test cases. Key aspects of the GA include:
- Initialization Strategies: Three methods are proposed to create an initial population of valid subsets that satisfy coverage and budget constraints.
- Fitness Function: Designed to minimize pairwise similarity among selected test cases, thereby promoting diversity and better fault detection.
- Operators: Standard selection, crossover, and mutation operators are adapted.
The novelty lies in the integration of these components specifically for natural language requirements, the explicit handling of both requirement coverage and a fixed minimization budget as hard constraints, and the investigation of various preprocessing, embedding, and similarity techniques.
Datasets
The study was evaluated on an industrial automotive system dataset. This dataset comprises:
- 736 system test cases.
- 7 test runs.
- 54 requirements.
- 220 unique faults.
The paper also describes the generation of test suites with varying redundancy levels (from 4.5 to 11.5) for experimental purposes, using Integer Linear Programming (ILP) and GA.
Key Insights and Ideas
- TF-IDF shines for structured text: Surprisingly, the simple TF-IDF representation, when combined with cosine similarity, outperformed more complex sentence-level embeddings for the specific automotive test cases. This is attributed to the structured and template-based nature of these test cases, where TF-IDF's focus on word frequency effectively captures subtle differences in variable names and parameters.
- Sentence-level embeddings generally better: Despite TF-IDF's success, sentence-level embeddings generally showed better performance than word-level embeddings for capturing semantic relationships.
- Preprocessing matters for word-level: Word-level embeddings benefit significantly from preprocessing (PM1 and PM2) to normalize text and improve similarity calculations. Conversely, less preprocessing (PM1 and PM3) was found to be better for some sentence-level embeddings, allowing them to better capture context.
- Initialization is crucial: The GA's performance is significantly influenced by the initialization strategy, with strategies that ensure a well-distributed and diverse initial subset yielding higher fault detection rates.
- Redundancy is a double-edged sword: Higher test suite redundancy generally leads to better fault detection rates for TSM techniques. However, at very low minimization budgets, high redundancy can increase the risk of undetected faults, highlighting the need to consider both redundancy and budget carefully.
- Requirement coverage boosts FDR: Explicitly ensuring requirement coverage, even when not strictly mandated by the budget, significantly boosts the test suite's ability to detect faults.
Key Results
- Superior FDR: RTM consistently achieved higher Fault Detection Rates (FDR) compared to baseline techniques (Random Minimization, FAST-R) across various minimization budgets (10% to 90%). The performance gap was particularly notable at mid-range budgets (30%-60%).
- Optimal Configuration: For the 50% minimization budget, TF-IDF with cosine similarity, using Preprocessing Method PM3 and Initialization Strategy 2, yielded the highest overall FDR of 86.09%.
- Adequate Scenario Performance: In the adequate scenario (prioritizing coverage), RTM achieved a high FDR of 98.59% at a 90% budget, maintaining 100% requirement coverage, outperforming baselines.
- Scalability: RTM exhibits linear scalability with test suite size, with total minimization times remaining within acceptable practical limits (seconds to a few minutes for very large suites). While slightly slower than some baselines, its performance gains in FDR with full coverage make it a better choice.
- Redundancy Impact: RTM consistently outperformed baselines across all redundancy levels. The study found that redundancy significantly impacts FDR, especially at lower budgets.
Limitations and Future Work
- External Validity: The generalizability of findings might be limited by the specific domain (automotive) and nature of the test suites. Future work could involve evaluating RTM on publicly available datasets from different domains.
- Embedding Choice: The selection of embedding techniques was constrained by data privacy requirements. The authors suggest exploring domain-specific or LLM-based embeddings for domains with rapidly evolving vocabularies.
- Construct Threat: The maintenance cost of TF-IDF representations when new test cases are added was considered a potential threat, but deemed manageable due to the stable, domain-specific vocabulary of the dataset.
- Future Research: The authors suggest future research should account for redundancy levels when evaluating TSM techniques. They also plan to apply RTM to a broader range of application scenarios to further evaluate and enhance its generalizability.
Summary updated