Abstract
Service virtualization is essential for testing interconnected enterprise systems, yet most automated tools fail to capture "stateful" behavior, leading to unrealistic testing environments. This paper presents a novel approach that automatically mines stateful service behavior from interaction traces. By partitioning message logs by specific data records and inferring finite state machines, the proposed system accurately emulates complex services. Evaluation across diverse protocols shows that this method significantly outperforms existing deep learning and clustering techniques in accuracy, speed, and memory efficiency.
Introduction
In modern enterprise software, systems are highly interconnected. Testing a "System Under Test" (SUT) typically requires access to third-party services, such as payment gateways or mainframes. However, these services are often expensive, restricted, or still under development. Service Virtualization (SV) aims to solve this by creating "virtual" versions of these services based on recorded traffic.
A significant limitation of existing SV tools is their "stateless" nature; they treat every request in isolation. For instance, a stateless virtual service might return a "Success" response for a user deletion even if that user was never created in the current session. This lack of state awareness leads to brittle test suites and unrealistic environments. As shown in the comparison above, the proposed approach is the first to combine automation with full statefulness and message format awareness.
Methodology
The authors propose a three-stage pipeline to transform raw interaction traces into a functional stateful emulator.
1. Message Analysis
The system identifies message types and formats (e.g., distinguishing an LDAP Bind request from a Search request) by aligning stable fields and analyzing keyword patterns. This ensures that the generated responses are syntactically valid.
2. Dependency Analysis
This is the core innovation of the paper. Instead of viewing a trace as a single sequence, the system performs Key-Payload Partitioning. It identifies a "key field" (like a UserID) and splits the trace into sub-traces for each specific record. It then uses a Prefix Tree Acceptor (PTA) and the kTail algorithm to convert these sequences into a Finite State Automaton (FSA). This FSA acts as the service's logic, determining which responses are valid given the current state of a specific record.
3. Response Generation
At runtime, the virtual service tracks the state of each data record. When a request arrives, the FSA selects the correct response type, and the system populates the payload using equality-based substitution or historical data selection.
Key Insights
- Entity-Based State: The primary insight is that service state is usually tied to specific data entities (e.g., a specific account) rather than the service as a whole. Partitioning by key payload simplifies a massive state space into manageable, record-specific state machines.
- Probabilistic Robustness: To handle "dirty" data where a test might start mid-session, the authors employ a probabilistic model to guess the most likely response type based on historical frequency.
Evaluation and Results
The approach was evaluated on four diverse datasets: CA Identity Manager (LDAP), a SOAP Bank Service, and RESTful services for Twitter and GoogleBooks.
- Accuracy: On the LDAP dataset, the proposed method achieved 87.98% identical responses, vastly outperforming clustering-based tools (33%) and deep learning models (<1%).
- Efficiency: The system is exceptionally fast, generating responses in a fraction of a millisecond—159x faster than the actual services and over 10,000x faster than some existing virtualization methods.
- Scalability: While deep learning models (like SSBV) often crash due to memory overhead on complex payloads, this approach maintains a minimal memory footprint.
Conclusion
By mining stateful behavior through trace partitioning and state machine inference, this approach provides a scalable and accurate solution for service virtualization. Future work will focus on automating the discovery of key payload fields and supporting asynchronous messaging architectures.
Summary updated