Seed&Steer: Two-Stage Test Generation
- Seed&Steer is a two-stage unit test generation paradigm that decouples compilable prefix construction (seed) from branch-guided assertion generation (steer).
- It leverages EvoSuite for extracting executable invocation patterns and uses LLM feedback with repair iterations to enhance test validity.
- Empirical results show significant gains in compilation success, branch, and line coverage compared to traditional monolithic test synthesis methods.
Seed&Steer denotes, in its explicit named formulation, a two-step approach to large-language-model-based unit test generation that separates compilable prefix construction from assertion generation, using conventional testing tools to provide executable seeds and branch-oriented signals to guide semantic exploration (Zhou et al., 23 Jul 2025). A plausible broader interpretation is that Seed&Steer also names a recurring research pattern—"seed-and-steer paradigm" (Editor's term)—in which an initial valid state, representation, or action is first established and subsequent behavior is then directed by feedback, structure-aware cues, or optimization. That broader pattern appears in read mapping, adaptive influence control, precision agriculture, confined-space robotics, and biological sensing, although the underlying objectives, state spaces, and guarantees differ substantially across domains (Xin et al., 2015).
1. Core definition and problem decomposition
In the unit-test-generation literature, Seed&Steer was introduced for LLM-based unit test generation under the observation that prior systems often treat test synthesis as a single monolithic task, despite two distinct failure modes: failure to generate a valid invocation context, and failure to generate assertions that cover meaningful control-flow behavior (Zhou et al., 23 Jul 2025). The framework therefore decomposes a test case into two phases: test prefix generation, which constructs the class or method skeleton, object initialization, and invocation context, and assertion generation, which validates behavior and drives coverage.
The paper formalizes this decomposition with two different difficulty measures. For prefix construction it defines Initialization Complexity using four static features: the number of variable declarations , object creations , method calls before invoking the focal method , and parameters . The score is
with final weight setting
The reported motivation is that and were more strongly negatively correlated with compilation success. Empirically, compilation success drops from 86.58% for complexity 1–2 to 10.72% for complexity 9–10 (Zhou et al., 23 Jul 2025).
For assertion generation the framework adopts Cyclomatic Complexity Number (CCN), computed using Lizard, to characterize branch difficulty. The reported observation is that branch and line coverage usually fall below 50% for methods in the 4–10 CCN range when standard LLM prompts are used. This division is central to the framework’s logic: prefix generation is treated primarily as a compilation problem, whereas assertion generation is treated primarily as a control-flow and semantic-guidance problem (Zhou et al., 23 Jul 2025).
2. Seed stage: compilable prefix construction
The Seed stage uses EvoSuite as a source of executable invocation patterns. The procedure statically parses the Java project, runs EvoSuite on the class containing the focal method, collects EvoSuite-generated test classes and methods, and extracts examples in which the focal method is invoked (Zhou et al., 23 Jul 2025). The paper describes two extraction paths.
The first path is source-level exemplar mining. It traverses methods in the source class and, when a method’s invocation list contains the focal method, extracts object instantiation, argument preparation, and call sequence. EvoSuite-generated test methods that invoke the focal method are also mined, with at most three examples per source-class method. The second path is an EvoSuite-only fallback: if no source method directly calls the focal method, the system inspects EvoSuite test methods only and extracts up to five invocation examples (Zhou et al., 23 Jul 2025). These examples become the seed templates inserted into prompts.
The LLM is then instructed to generate only the test prefix, not assertions. After generation, assertion statements are removed and placeholder comments such as // TODO: assert here are inserted. The generated prefix is compiled, and compiler diagnostics are fed back into a repair prompt if compilation fails; this loop repeats for up to 5 iterations (Zhou et al., 23 Jul 2025). The paper’s explanation is that seed examples reduce both syntactic and semantic uncertainty in the prefix by grounding the model in correct object setup, dependency order, and argument patterns.
This stage is embedded within a broader static-preprocessing pipeline. Java files are parsed into ASTs using javalang and tree-sitter; the paper formalizes a class as
and focal methods as
The resulting seed stage is therefore not simply prompt engineering; it is a hybrid retrieval-and-repair subsystem centered on compilable exemplars (Zhou et al., 23 Jul 2025).
3. Steer stage: branch-intent guidance and iterative correction
The Steer stage addresses the second half of the problem: assertion generation and path exploration. The focal method is statically parsed to identify if, else if, switch, for, while, do-while, try-catch, throw, and other input-dependent statements, producing a set denoted
0
For each branch 1, the LLM is prompted to infer a natural-language branch condition, such as describing the input pattern that triggers a particular path (Zhou et al., 23 Jul 2025).
These branch intentions are designed to encourage tests for normal paths, boundary cases, and exception paths. The final prompt incorporates three components: the compiled prefix 2, branch intentions 3, and a function-level intention summary 4, which describes purpose, input/output behavior, side effects, and corner cases. In the paper’s notation, the effective prompt composition is
5
After assertion generation, the produced test is syntactically cleaned, compiled, executed, and corrected using compiler or runtime feedback. The repair interface is formalized as
6
where 7 is the test, 8 is the error feedback, and 9 is the maximum number of repair attempts (Zhou et al., 23 Jul 2025). If the full process fails, the framework falls back to a simpler sequence described as
0
The technical significance of the steer stage lies in its semantic targeting. The paper’s case-level analysis reports that newly covered branches usually correspond to deep conditional structures, boundary-specific behaviors, and exception-triggering paths, supporting the claim that explicit branch guidance improves semantic exploration rather than merely increasing assertion volume (Zhou et al., 23 Jul 2025).
4. Evaluation, benchmarks, and ablation results
The evaluation uses Defects4J projects spanning 666 focal classes and 8,192 focal methods across Gson 2.10.1, Commons-Lang 3.1.0, Commons-Cli 1.6.0, Commons-Csv 1.10.0, and JFreeChart 1.5.4 (Zhou et al., 23 Jul 2025). The environment uses Java 8, JUnit 4, and JaCoCo for branch and line coverage. The reported baselines include ChatGPT-3.5, ChatGPT-4.0, ChatUniTest, ChatTester, and TestART. Seed&Steer is evaluated with gpt-3.5-turbo, gpt-4o, and additionally with Qwen2.5-Coder-32B-Instruct and Qwen2.5-Coder-7B-Instruct.
Four metrics are emphasized: compilation pass rate, test execution pass rate, branch coverage, and line coverage. Overall results for Seed&Steer are:
- Compile pass rate: 92.77% with
gpt-3.5-turbo, 95.80% withgpt-4o - Test execution pass rate: 69.87% with
gpt-3.5-turbo, 69.34% withgpt-4o - Branch coverage: 72.19% with
gpt-3.5-turbo, 73.30% withgpt-4o - Line coverage: 71.20% with
gpt-3.5-turbo, 75.26% withgpt-4o(Zhou et al., 23 Jul 2025)
Compared to raw ChatGPT-3.5, compile pass rises from 74.39% to 92.77%, branch coverage from 43.10% to 72.19%, and line coverage from 42.58% to 71.20%. Compared to TestART, the paper reports about +5.72% compile-pass improvement, +2.79% branch-coverage improvement, and +3.03% line-coverage improvement (Zhou et al., 23 Jul 2025). The seed component alone recovers 792 previously failing cases on gpt-3.5-turbo and 887 previously failing cases on gpt-4o.
The ablation study separates SeedOnly, SteerOnly, and Full Seed&Steer. With gpt-3.5-turbo, the paper reports:
- VanillaLLM / ChatTester: compile 85.88%, branch 50.80%, line 48.68%
- SeedOnly: compile 95.54%, branch 59.70%, line 61.09%
- SteerOnly: compile 87.95%, branch 61.65%, line 65.91%
- Full: compile 92.77%, branch 72.19%, line 71.20% (Zhou et al., 23 Jul 2025)
These results directly support the decomposition: SeedOnly mostly improves compilation, SteerOnly mostly improves coverage, and the full system yields the best balance. Coverage gains by CCN are reported as relative improvements from 1.09× to 1.26×, with up to 1.6× improvement for some highly complex methods. On open-source Qwen models, Seed&Steer also outperforms ChatTester; for example, with the 32B model, compile rate is 88.77% versus 77.16%, and branch coverage is 55.92% versus 44.72% (Zhou et al., 23 Jul 2025).
5. Cross-domain uses and cognate formulations
The literature suggests that Seed&Steer is not only a software-testing framework but also a broader architectural motif in which an initial feasible configuration is established and later decisions are guided by feedback, structure, or environment-specific signals. Closely related decompositions appear in read mapping (Xin et al., 2015), adaptive influence control (Tang et al., 2019), precision agriculture (Rai et al., 27 Apr 2025), soft growing robots (Qin et al., 9 Jul 2025), planktonic prey localization (Redaelli et al., 28 Jan 2026), and deformation-aware agricultural pose estimation (Chatzis et al., 28 Mar 2026).
| Domain | Seed component | Steering mechanism |
|---|---|---|
| Read mapping | Non-overlapping seeds in a read | Dynamic programming over seed placement and length |
| Adaptive influence control | Seed nodes selected in rounds | Residual-graph feedback from prior cascades |
| Precision agriculture | Vision-based sensing of trench state | Equipment adjustment, row cleaner selection, and better steering |
| Soft growing robotics | Tip insertion into a passage | External tip steering and wall bracing in 3D |
| Planktonic sensing | Two spatially separated flow measurements | Steering toward inferred source direction plus roll |
In read mapping, the Optimal Seed Solver (OSS) formulates seed selection as the problem of finding the least frequently-occurring set of 1 non-overlapping seeds in an 2-bp read while optimizing both placement and length. The dynamic program is built around
3
and the paper reports average time complexity 4, worst-case time complexity 5, and a 3-fold reduction of average seed frequency over the best previous seed-selection optimization, OPS (Xin et al., 2015). Here, “steering” corresponds to directing seed boundaries away from frequent patterns that would inflate verification cost.
In adaptive seed minimization, ASTI chooses seeds sequentially rather than in one batch and uses observed cascade outcomes to steer later choices toward the remaining inactive portion of the network. Its objective is to minimize the expected number of seeds while guaranteeing a target spread 6 in every realization. The paper reports expected runtime
7
and an approximation guarantee of
8
for the batched variant (Tang et al., 2019). This is a particularly explicit instance of steering through feedback: seed choice is revised after each observed diffusion step.
In precision agriculture, a vision-based system monitors furrow quality immediately after row cleaner operation. Multiple air seeders were equipped with a camera and industrial PC; 2605 images were gathered for dataset creation, and 5800 images across five row cleaner configurations were collected for field comparison. A segmentation model labeled straw, soil, and background, and the best-performing architecture, SegFormer, achieved IoU 74.3% for straw, 80.9% for soil, 92.92% for background, with 11.75 ms inference time (Rai et al., 27 Apr 2025). The paper then computes per-frame class percentages,
9
to quantify row cleaner performance. The stated practical value is that precision agriculture operations can move from reactive manual inspection to real-time, data-driven control of seeding quality. This suggests a seed-and-steer decomposition in which sensing the trench provides the basis for better steering and equipment adjustment (Rai et al., 27 Apr 2025).
In soft growing robotics, a vine robot for pipes and burrows grows by eversion and uses an external tip mount to steer in three degrees of freedom. The system demonstrates active branch selection with a maximum steerable angle of 0, navigation in pipe networks with radii as small as 2.5 cm, and real-time 3D localization in GPS-denied environments using tip-mounted sensors and continuum body odometry (Qin et al., 9 Jul 2025). The robot’s behavior is explicitly sequential: the tip is first positioned into a branch, the wall-bracing mechanism stabilizes the tip if needed, and the body then grows through the selected path.
In planktonic prey detection, the steer’n roll strategy combines two spatially separated flow measurements with body steering and roll to disambiguate symmetric hydrodynamic signals. The inferred source direction is constructed from two local direction estimates 1, and steering uses
2
The paper reports a 100% success rate in the idealized model and robustness to flow sensing noise, orientational diffusion, and turbulence (Redaelli et al., 28 Jan 2026). Although the terminology differs slightly, the architecture is again seed-like sensory sampling followed by steering through an inferred direction field.
A further cognate example is SEED for deformation-aware 6D pose estimation of agricultural produce. It jointly predicts pose and explicit lattice deformation from RGB input, with output
3
and outperforms MegaPose on 6 out of 8 categories under identical RGB-only conditions on the PEAR benchmark (Chatzis et al., 28 Mar 2026). This suggests a related decomposition in which a category base mesh acts as an initial representational substrate and explicit deformation prediction steers the estimate toward the true instance geometry.
6. Limitations, misconceptions, and future directions
A common misconception would be to treat Seed&Steer as a single formal algorithm applicable across domains. The available literature instead suggests a family of domain-specific decompositions that share a high-level logic—establish a viable seed, then steer subsequent computation or action—but differ in objective functions, observability, guarantees, and physical or semantic constraints (Zhou et al., 23 Jul 2025). In software testing, for example, the framework’s gains come from decoupling compilation from control-flow coverage; in influence control they come from residual-graph feedback; in robotics they depend on embodied steering hardware rather than on symbolic reasoning.
The named unit-test-generation framework also has explicit limitations. It currently depends on EvoSuite, which is tied to Java 8; this constrains use in newer Java environments. The framework incurs extra runtime cost from seed construction and is reported to be somewhat slower than ChatTester, although the paper states that the overhead is acceptable given the gains. The evaluation covers only five Java projects from Defects4J, and the reported metrics—compile pass, execution pass, branch coverage, and line coverage—do not fully capture semantic correctness (Zhou et al., 23 Jul 2025).
Analogous limitations appear in the cognate literatures. The furrow-monitoring system focuses on visible surface trench conditions and does not directly measure seed placement depth, emergence, or final yield (Rai et al., 27 Apr 2025). The pose-estimation system SEED is trained entirely on synthetic data and is motivated by a shape gap that still degrades state-of-the-art methods by up to 6x when category templates replace true meshes (Chatzis et al., 28 Mar 2026). The steerable vine robot notes that localization could be improved by fusing visual data and that rigid tip components constrain the minimum navigable diameter (Qin et al., 9 Jul 2025). These cases reinforce a broader point: the “steer” component is only as reliable as the feedback, representation, or actuation on which it depends.
Future directions named in the Seed&Steer unit-testing paper include adapting the framework to other languages such as Python or C++, replacing EvoSuite with other compatible tools, using semantic-aware evaluation or human-in-the-loop assessment, and exploring broader industrial-scale codebases (Zhou et al., 23 Jul 2025). A plausible implication is that the most durable contribution of Seed&Steer is methodological rather than domain-bound: it provides a template for splitting generation into a feasibility stage and a goal-directed steering stage, then assigning each stage its own signals, tools, and repair loop.