Official agent skill

Java SDK E2E Test with Replay Snapshot

by github in github/copilot-sdk

Creates a Java SDK end-to-end test for the Copilot SDK that runs against a recorded YAML snapshot through a replay proxy, so CI needs no real authentication.

OfficialMITAuto-check passedTesting & QA

Install Java SDK E2E Test with Replay Snapshot

skills CLI
$ npx skills add github/copilot-sdk --skill sdk-java-e2e-test -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install github/copilot-sdk sdk-java-e2e-test --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/github/copilot-sdk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/sdk-java-e2e-test .claude/skills/sdk-java-e2e-test && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sdk-java-e2e-test
GitHub stars
11k
Token cost
~1.8k tokens
SKILL.md length
603 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Creates a Java SDK end-to-end test for the Copilot SDK that runs against a recorded YAML snapshot through a replay proxy, so CI needs no real authentication.

  • Works in 4 steps: Choose a snapshot category and snapshot… → Use a recorded snapshot → Create the Java IT test class → …
  • Adding an end-to-end test for the Java SDK's public surface
  • SKILL.md covers Repository layout, Overview, Step-by-Step Workflow and Key Classes and Files, plus 1 more section
  • Calls pnpm

What it does

Java SDK surface-area tests for the Copilot SDK run against a replay proxy that intercepts HTTP calls to the Copilot API and returns pre-recorded responses from YAML snapshot files. Because the Java proxy start always sets GITHUB_ACTIONS, the proxy runs read-only, so a Java test cannot record a snapshot and every request must match an existing one. Shared runtime behavior that is reachable through the SDK belongs in the TypeScript suite instead.

The workflow begins by choosing a snapshot category, a folder under test/snapshots, and a base name in lowercase snake_case that is passed verbatim to configureForTest, which does not split camelCase. Snapshots must be recorded, not hand-written, so the agent reuses a capture from another SDK suite or records one through the TypeScript suite with the same name and prompt.

Replay rules shape the test: system messages are replaced before matching, so assertions on replies cannot prove a system-message setting reached the model, user content must match the snapshot exactly after normalization, and the test's temp working directory is represented by a token in tool arguments and results. Paths are relative to the SDK root, src/sdk when it exists.

When your agent uses it

  • Adding an end-to-end test for the Java SDK's public surface
  • Choosing a snapshot category and name for a new replay test
  • Reusing a recorded snapshot from another SDK suite

Example prompts

  • “Add a Java E2E test for the session resume API using an existing replay snapshot.”
  • “Which snapshot name should I use for a test that checks a replaced system message section?”
  • “Why does my Java test fail to match its replay snapshot for the user prompt?”

Requirements

  • A checkout of the Copilot SDK repository
  • A recorded YAML snapshot, or the TypeScript SDK suite to record one

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Choose a snapshot category and snapshot base name
  2. Use a recorded snapshot
  3. Create the Java IT test class
  4. Verify

What it can do on your machine

Read from SKILL.md and the folder at commit 2023ed2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Java SDK E2E Test with Replay Snapshot loads about 1.8k tokens when it runs. Until then it costs about 33 tokens; SKILL.md has 603 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~33
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from github/copilot-sdk at commit 2023ed2, republished under its MIT licence (© github). 603 words, ~1,807 tokens.

Download SKILL.mdSave it as .claude/skills/sdk-java-e2e-test/SKILL.md (or your agent's skills folder).
name
sdk-java-e2e-test
description
Use this skill when creating a Java SDK surface-area E2E integration test backed by a replay proxy YAML snapshot

Creating a New Java E2E Test with a Replay Proxy YAML Snapshot

Repository layout

These instructions work in both the runtime monorepo and the standalone public SDK repository. From the repository root, use src/sdk as the SDK root when that directory exists; otherwise use the repository root itself. All paths below are relative to that SDK root.

Use this skill only when the new E2E tests Java SDK surface area; shared runtime functionality available entirely through the SDK belongs in the TypeScript SDK suite (nodejs/test/e2e/).

Overview

The Java E2E tests use a replay proxy (test/harness/replayingCapiProxy.ts) that intercepts HTTP calls to the Copilot API and returns pre-recorded responses from YAML snapshot files. This avoids needing real authentication in CI.

Key constraint: Java's CapiProxy.start() always sets GITHUB_ACTIONS=true, which forces the replay proxy into read-only mode: a Java test cannot record a snapshot, and every request must match an existing one.

Step-by-Step Workflow

Step 1: Choose a snapshot category and snapshot base name
  • Category = a directory under test/snapshots/ (e.g., system_message_sections)
  • Snapshot base name = the exact filename stem, already lowercase snake_case, e.g., should_use_replaced_identity_section_in_response. Pass it verbatim to configureForTest: it lowercases and replaces non-alphanumerics with _ but does not split camelCase, so myTestMethod would look for mytestmethod.yaml.
  • Resulting file: test/snapshots/<category>/<snapshot_base_name>.yaml
Step 2: Use a recorded snapshot

The SDK guide forbids hand-authored model responses (CONTRIBUTING.md, "Recording and replaying SDK tests"). Reuse a capture that another SDK suite recorded for the same conversation, as most Java ITs do; if none exists, record one through the TypeScript SDK suite with the same snapshot name and prompt, following that guide.

Replay rules:

  • Every request's system message is replaced with ${system} before matching, so system content is never compared, and an assertion on the reply cannot prove that a system-message setting reached the model.
  • User content must exactly match the snapshot's (after normalization), so copy the prompt from the YAML.
  • ${workdir} stands for the test's temp workDir in tool arguments and results.
  • A request matches when its messages equal a conversation up to an assistant message; the proxy replies with that assistant message and any assistant messages directly after it.
  • A request that matches nothing fails. The proxy's stderr, echoed as [CapiProxy stderr], reports "No cached response found" with the first mismatching message per conversation, and configureForTest logs the prompts the snapshot expects.
Show full SKILL.md (221 more words)Show less
Step 3: Create the Java IT test class

Place it in java/sdk/src/test/java/com/github/copilot/ with an IT suffix (e.g., MyFeatureIT.java). The failsafe plugin picks up *IT.java files.

Template:

java
package com.github.copilot;

import static org.junit.jupiter.api.Assertions.*;

import java.util.concurrent.TimeUnit;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import com.github.copilot.generated.AssistantMessageEvent;
import com.github.copilot.rpc.MessageOptions;
import com.github.copilot.rpc.PermissionHandler;
import com.github.copilot.rpc.SessionConfig;
// ... other imports as needed

class MyFeatureIT {

    private static E2ETestContext ctx;

    @BeforeAll
    static void setUp() throws Exception {
        ctx = E2ETestContext.create();
    }

    @AfterAll
    static void tearDown() throws Exception {
        if (ctx != null) {
            ctx.close();
        }
    }

    @Test
    void myTestMethod() throws Exception {
        // 1. Configure the proxy to use your snapshot
        ctx.configureForTest("my_category", "my_test_method");

        // 2. Create a client (uses fake token + proxy automatically)
        try (CopilotClient client = ctx.createClient()) {

            // 3. Create a session with desired config
            CopilotSession session = client.createSession(new SessionConfig()
                    .setOnPermissionRequest(PermissionHandler.APPROVE_ALL))
                    .get(30, TimeUnit.SECONDS);

            try {
                // 4. Send the prompt (must match YAML exactly)
                AssistantMessageEvent response = session
                        .sendAndWait(new MessageOptions().setPrompt("Your prompt here"), 60_000)
                        .get(90, TimeUnit.SECONDS);

                // 5. Assert on the response
                assertNotNull(response);
                String content = response.getData().content();
                assertTrue(content.contains("expected text"));
            } finally {
                session.close();
            }
        }
    }
}
Step 4: Verify

In the runtime repository, prepare the checked-out Java projection and CLI from the runtime root:

sh
pnpm run generate:sdk:java
pnpm run build:cli

pnpm run test:sdk:java runs the whole suite and takes no test filter. For a focused Maven run, pass the same-checkout wrapper explicitly (without copilot.cli.path the tests use the release pinned by nodejs/package.json), then use the verify lifecycle so test-resource setup and failsafe:verify both run:

sh
cd src/sdk/java
./mvnw -pl sdk spotless:apply
COPILOT_CLI_PATH=<runtime-root>/dist-cli/prebuilds/<target>/copilot-runtime
./mvnw -pl sdk verify -Dit.test="MyFeatureIT#myTestMethod" -Dcopilot.cli.path="$COPILOT_CLI_PATH"

<target> is Node's <process.platform>-<process.arch> (for example linux-x64, darwin-arm64, win32-x64); use copilot-runtime.exe for the wrapper name on Windows.

In the standalone SDK repository, start at java/ and use the pinned runtime:

sh
./mvnw -pl sdk spotless:apply
./mvnw -pl sdk verify -Dit.test="MyFeatureIT#myTestMethod"

Key Classes and Files

WhatWhere
Test context (manages proxy, workDir, CLI)java/sdk/src/test/java/com/github/copilot/E2ETestContext.java
Java proxy wrapperjava/sdk/src/test/java/com/github/copilot/CapiProxy.java
Replay proxy (TypeScript)test/harness/replayingCapiProxy.ts
Proxy server entry pointtest/harness/server.ts
Snapshot filestest/snapshots/<category>/<name>.yaml
Existing IT tests for referencejava/sdk/src/test/java/com/github/copilot/**/*IT.java; SystemMessageSectionsIT reuses Node.js suite captures, including a view tool call

Tests that call built-in tools

When the snapshot has the model call a built-in tool such as view, the CLI really executes it in the test's workDir, and the next request carries its result, which must match the snapshot's. Create any file the tool reads before sending the prompt, with exactly the content the snapshot's tool result shows:

java
Files.writeString(ctx.getWorkDir().resolve("test.txt"), "Hello transform!");

© github, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/sdk-java-e2e-test of github/copilot-sdk.

Open the folder on GitHubat commit 2023ed2

Compare with similar skills

Java SDK E2E Test with Replay Snapshot next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Java SDK E2E Test with Replay Snapshot compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Java SDK E2E Test with Replay Snapshot this skillgithub/copilot-sdk11k—~1.8kAutomated safety check: PassMIT
Growing Outside In Systemslexler/skill-factory2391 repos~1.9kAutomated safety check: PassApache-2.0
Testing Strategiesancoleman/ai-design-components526—~3.8kAutomated safety check: PassMIT
Airbyte Postgres Source E2E Testsairbytehq/airbyte22k—~2.5kAutomated safety check: PassCustom licence
Interactive CLI Testing With tui-testslopus/happy24k—~603Automated safety check: PassMIT
ClickUp CLI Testingkrodak/clickup-cli120—~1.4kAutomated safety check: NotesMIT

Similar skills

  • Growing Outside In Systems

    lexler/skill-factory

    Drive feature development using Outside-In TDD with Hexagonal Architecture.

    239 GitHub starsUsed in 1 repo~1.9k tokens
    Testing & QAAuto-check passed
  • Testing Strategies

    ancoleman/ai-design-components

    Strategic guidance for choosing and implementing testing approaches across the test pyramid.

    526 GitHub stars~3.8k tokensUpdated 10 mo ago
    Testing & QAAuto-check passed
  • Official

    Starts a local PostgreSQL 16 container, loads SQL fixtures and runs the Airbyte spec, check, discover and read commands against a chosen source-postgres image.

    22k GitHub stars~2.5k tokensUpdated today
    Testing & QAAuto-check passed
  • Tests interactive CLI and TUI programs with Microsoft's tui-test, driving prompts, arrow keys and screen output in a real pseudo-terminal.

    24k GitHub stars~603 tokensUpdated today
    Testing & QAAuto-check passed
  • ClickUp CLI Testing

    krodak/clickup-cli

    Explains how to run and extend the clickup-cli tests: unit tests with a mocked client, e2e tests against a real ClickUp workspace, and the fixture data they rely on.

    120 GitHub stars~1.4k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • Mobile Testing

    irahardianto/awesome-agv

    Mobile E2E testing patterns — Flutter integrationtest, Patrol, Maestro, golden testing, device matrix, and test data management.

    157 GitHub stars~1.8k tokensUpdated 2 days ago
    Testing & QAAuto-check: notes

Works with

Categories

Questions about Java SDK E2E Test with Replay Snapshot

What does Java SDK E2E Test with Replay Snapshot do?

Creates a Java SDK end-to-end test for the Copilot SDK that runs against a recorded YAML snapshot through a replay proxy, so CI needs no real authentication. Java SDK surface-area tests for the Copilot SDK run against a replay proxy that intercepts HTTP calls to the Copilot API and returns pre-recorded responses from YAML snapshot files. Because the Java proxy start always sets GITHUB_ACTIONS, the proxy runs read-only, so a Java test cannot record a snapshot and every request must match an existing one.

When should I use Java SDK E2E Test with Replay Snapshot?

Java SDK E2E Test with Replay Snapshot fits situations like: adding an end-to-end test for the Java SDK's public surface; choosing a snapshot category and name for a new replay test; reusing a recorded snapshot from another SDK suite.

How do I install Java SDK E2E Test with Replay Snapshot in Claude Code?

Run `npx skills add github/copilot-sdk --skill sdk-java-e2e-test -a claude-code`. Or copy the skill folder (.github/skills/sdk-java-e2e-test in github/copilot-sdk) into .claude/skills/sdk-java-e2e-test in your project. Claude Code loads it when a task matches its description.

How do I install Java SDK E2E Test with Replay Snapshot in Codex?

Run `npx skills add github/copilot-sdk --skill sdk-java-e2e-test -a codex`. Or copy the skill folder (.github/skills/sdk-java-e2e-test in github/copilot-sdk) into .agents/skills/sdk-java-e2e-test in your project. Codex loads it when a task matches its description.

Can I use Java SDK E2E Test with Replay Snapshot in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add github/copilot-sdk --skill sdk-java-e2e-test -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sdk-java-e2e-test, .gemini/skills/sdk-java-e2e-test, .github/skills/sdk-java-e2e-test and .opencode/skills/sdk-java-e2e-test in your project.

What does Java SDK E2E Test with Replay Snapshot need to run?

Going by SKILL.md and its folder, Java SDK E2E Test with Replay Snapshot needs the command-line tools its instructions call (pnpm). Our summary lists: A checkout of the Copilot SDK repository; A recorded YAML snapshot, or the TypeScript SDK suite to record one.

Does Java SDK E2E Test with Replay Snapshot access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Java SDK E2E Test with Replay Snapshot safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Java SDK E2E Test with Replay Snapshot use?

Java SDK E2E Test with Replay Snapshot is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Java SDK E2E Test with Replay Snapshot use?

About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Java SDK E2E Test with Replay Snapshot?

Skills that share tags, products or a category with Java SDK E2E Test with Replay Snapshot: Growing Outside In Systems (lexler/skill-factory, 239 stars), Testing Strategies (ancoleman/ai-design-components, 526 stars), Airbyte Postgres Source E2E Tests (airbytehq/airbyte, 22k stars) and Interactive CLI Testing With tui-test (slopus/happy, 24k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Java SDK E2E Test with Replay Snapshot?

github (a GitHub organization, an official publisher) maintains it in github/copilot-sdk, which has 10,545 GitHub stars. The repository was last updated on October 7, 2026.

Source: github/copilot-sdk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.