
Automated unit test generation using Large Language Models (LLMs) has shown promise for widely used programming languages such as Java and Python. It may further benefit legacy systems lacking a test base, and the investigation of less widespread legacy languages remains relevant as many companies still operate systems built on them. We develop a modular workflow combining static code analysis, multi-stage prompt engineering with business logic extraction, automated error analysis, and iterative test-fix cycles for legacy systems, evaluated by pass rates, coverage, and repair effectiveness. We evaluate our approach on four productive IBM Perl repositories (186 functions) and three CPAN distributions (139 functions) using two open-source LLMs: Llama-3.3-70B-Instruct and Mistral-Small-3.1-24B-Instruct-2503. A key methodological contribution is a defensive eval wrapper that records a crash in the code under test as a failed assertion rather than terminating the run. A git-diff mode enables selective test generation for changed functions, supporting incremental maintenance workflows. The larger model achieves initial pass rates of 66–82
Stack overflow vulnerabilities pose severe security threats, potentially leading to program crashes, data breaches, and significant financial losses. Attackers exploit these vulnerabilities to execute attack techniques such as Return-Oriented Programming (ROP), Jump-Oriented Programming (JOP), and Structured Exception Handler (SEH) exploitation. This paper introduces StackLoc, a CodeBERT-BiLSTM framework for detecting and localizing stack overflow vulnerabilities at the source code level. First, StackLoc generates differential (diff) files from vulnerable samples and their corresponding patched versions, enabling automated annotation and localization of vulnerable code fragments. Next, StackLoc employs a code-slicing mechanism that integrates focus windows and context windows to extract vulnerability-related semantic information, thereby providing more accurate contextual representations for feature learning. By integrating CodeBERT with a bidirectional long short-term memory (BiLSTM) network, StackLoc encodes code fragments into semantic vector representations, modeling bidirectional semantic dependencies and enhancing its ability to capture contextual structures and vulnerability-related patterns. As a result, StackLoc improves the performance of stack overflow vulnerability detection while maintaining high localization accuracy. To evaluate StackLoc, extensive experiments are conducted on the CWE-121 stack overflow vulnerability dataset, including parameter analysis, ablation studies, and comparisons with representative source code-based detection methods. The experimental results demonstrate that StackLoc achieves the best recall and F1-score among the compared baselines while maintaining competitive accuracy and precision. Furthermore, the window-based prediction and visualization framework of StackLoc supports vulnerability region highlighting and improves the interpretability of detection results.
Blockchain-based smart contracts are difficult to test because explicit expected outputs are often unavailable, creating an oracle problem. Metamorphic testing addresses this problem by checking necessary relations between related executions, but existing approaches often depend on manually designed, contract-specific metamorphic relations (MRs) and provide limited support for MR selection. This paper proposes MPSC, a parameter-driven metamorphic testing approach for smart contracts. MPSC uses an LLM-assisted, human-in-the-loop process to identify externally perturbable mutable parameters, constructs MRs from these parameters, and optimizes the MR set using mutation score and Jaccard-based MR difference. It also presents 38 structured MRs as illustrative examples and practical references for future smart-contract testing. MR violations are treated as candidate vulnerabilities, and only manually validated candidates are reported as confirmed vulnerabilities. Experiments on five Solidity contracts achieve an average per-MR mutation score of 83.70
Digital twins (DTs) are based on a set of DT properties that are the fundamental characteristics that determine how a DT represents, reflects, memorizes, and interacts with its physical counterpart within a specific usage context. The DT properties are the cornerstone to provide DTs with higher quality. Despite the increasing adoption of Multi-Agent Systems (MAS) in DT development, there is a lack of structured guidance on how agent design can support the development of these DT properties. This paper addresses this gap by proposing a catalogue of agent design patterns tailored to support the reflection, memorization and entanglement properties of a DT. Each pattern is aligned with established design patterns in MAS literature. Decision models are also introduced to guide practitioners in selecting appropriate patterns based on the essential aspects of each property. The proposed patterns and design models were applied in a real-world case study involving the design of a DT to manage study sessions for children with ADHD, illustrating their applicability in a case study. The results support the feasibility and utility of our catalogue of design patterns for the development of the selected DT properties that are relevant to provide DT with quality characteristics.
The test suites generated through model-based testing (MBT) often include redundant test cases that neither enhance coverage nor fault detection but instead reduce test execution efficiency. Such test cases should be discarded to minimize the test suite size and its effect on execution cost while preserving fault detection capabilities. In this paper, we present a test suite optimization approach, implemented in a tool, that leverages symbolic classification, a greedy algorithm, and a similarity measure. It reduces MBT-generated test suites for embedded software by identifying and eliminating redundancy while minimizing its impact on the fault detection rate. We comparatively evaluate the optimized test suites against the original MBT-generated and also the manually created test suites, focusing on fault detection effectiveness and test execution efficiency. We also examine the robustness of proposed approach using two substantially different industrial case studies from Alstom Rail AB, Sweden. Results showed a significant reduction of over 80