---
title: 'Seed&Steer: Two-Stage Test Generation'
url: https://www.emergentmind.com/topics/seed-steer
type: topic
---

# Seed&Steer: Two-Stage Test Generation

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 [2507.17271]. 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 [1506.08235].

## 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 [2507.17271]. 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 \(V\), object creations \(O\), method calls before invoking the focal method \(M\), and parameters \(P\). The score is

\[
\text{Initialization Complexity} = w_1 \cdot \widehat{V} + w_2 \cdot \widehat{O} + w_3 \cdot \widehat{M} + w_4 \cdot \widehat{P},
\]

with final weight setting

\[
[w_1, w_2, w_3, w_4] = [0.1, 0.1, 0.4, 0.4].
\]

The reported motivation is that \(M\) and \(P\) 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 [2507.17271].

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 [2507.17271].

## 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 [2507.17271]. 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 [2507.17271]. 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** [2507.17271]. 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

\[
\mathcal{C} = \{\text{name}, \text{type}, \text{superclass}, \text{content}, \text{fields}, \mathcal{M}\}
\]

and focal methods as

\[
\mathcal{F} = \{ f_i = (\text{name}, \text{params}, \text{invocation}, \text{signature}, \text{content}) \mid f_i \in \mathcal{M}_{\text{focal}} \}.
\]

The resulting seed stage is therefore not simply prompt engineering; it is a hybrid retrieval-and-repair subsystem centered on compilable exemplars [2507.17271].

## 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

\[
\mathcal{B}_{\text{cond}}.
\]

For each branch \(b_i \in \mathcal{B}_{\text{cond}}\), the LLM is prompted to infer a natural-language branch condition, such as describing the input pattern that triggers a particular path [2507.17271].

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 \(\mathcal{P}_{\text{pass}}\), branch intentions \(\mathcal{I}_{\text{branch}}\), and a function-level intention summary \(\mathcal{I}_{\text{func}}\), which describes purpose, input/output behavior, side effects, and corner cases. In the paper’s notation, the effective prompt composition is

\[
\mathcal{P}_{\text{pass}} + \mathcal{I}_{\text{branch}} + \mathcal{I}_{\text{func}}.
\]

After assertion generation, the produced test is syntactically cleaned, compiled, executed, and corrected using compiler or runtime feedback. The repair interface is formalized as

\[
\text{Fix}(\mathcal{T}, \mathcal{E}, \delta) \rightarrow \mathcal{T}^* \text{ or } \perp,
\]

where \(\mathcal{T}\) is the test, \(\mathcal{E}\) is the error feedback, and \(\delta\) is the maximum number of repair attempts [2507.17271]. If the full process fails, the framework falls back to a simpler sequence described as

\[
\text{Seed Template} + \text{Intention Steer} \rightarrow \text{Iterative Generate/Repair}.
\]

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 [2507.17271].

## 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** [2507.17271]. 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%** with `gpt-4o`
- **Test execution pass rate**: **69.87%** with `gpt-3.5-turbo`, **69.34%** with `gpt-4o`
- **Branch coverage**: **72.19%** with `gpt-3.5-turbo`, **73.30%** with `gpt-4o`
- **Line coverage**: **71.20%** with `gpt-3.5-turbo`, **75.26%** with `gpt-4o` [2507.17271]

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 [2507.17271]. 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%** [2507.17271]

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%** [2507.17271].

## 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 [1506.08235], adaptive influence control [1907.09668], precision agriculture [2504.19334], soft growing robots [2507.07225], planktonic prey localization [2601.20421], and deformation-aware agricultural pose estimation [2603.27429].

| 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 \(x\) non-overlapping seeds in an \(L\)-bp read while optimizing both placement and length. The dynamic program is built around

\[
Opt(U, m+1) = \min_i \; Opt(R[1:i-1], m) + Opt(R[i:u], 1),
\]

and the paper reports **average time complexity** \(\mathcal{O}(x \times L)\), **worst-case time complexity** \(\mathcal{O}(x \times L^2)\), and a **3-fold reduction of average seed frequency** over the best previous seed-selection optimization, **OPS** [1506.08235]. 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 \(\eta\) in every realization. The paper reports expected runtime

\[
O\Big(\frac{\eta \cdot (m+n)}{\varepsilon^2}\ln n \Big)
\]

and an approximation guarantee of

\[
\frac{(\ln \eta+1)^2}{(1 - (1-1/b)^b) (1-1/e)(1-\varepsilon)}
\]

for the batched variant [1907.09668]. 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 [2504.19334]. The paper then computes per-frame class percentages,

\[
P_{\text{class}, i} = \frac{A_{\text{class}}}{A_{\text{total}}},
\qquad
C_{\text{avg}} = \frac{1}{N}\sum_{i=1}^{N} P_{\text{class}, i},
\]

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 [2504.19334].

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 \(51.7^\circ\)**, 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 [2507.07225]. 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 \(\boldsymbol{\hat s}^\pm\), and steering uses

\[
\boldsymbol{\omega}_{\rm steer} = \omega_{\rm steer} \frac{\boldsymbol{\hat t}\times \boldsymbol{\hat d}}{\|\boldsymbol{\hat t}\times \boldsymbol{\hat d}\|},
\qquad
\boldsymbol{\omega}_{\rm roll}=\omega_{\rm roll}\,\boldsymbol{\hat t}.
\]

The paper reports a **100% success rate** in the idealized model and robustness to flow sensing noise, orientational diffusion, and turbulence [2601.20421]. 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

\[
(R, t, \delta), \qquad \delta \in \mathbb{R}^{24},
\]

and outperforms MegaPose on **6 out of 8 categories** under identical RGB-only conditions on the **PEAR** benchmark [2603.27429]. 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 [2507.17271]. 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 [2507.17271].

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 [2504.19334]. 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 [2603.27429]. The steerable vine robot notes that localization could be improved by fusing visual data and that rigid tip components constrain the minimum navigable diameter [2507.07225]. 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 [2507.17271]. 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.

Source: https://www.emergentmind.com/topics/seed-steer