# test-authoring

Adopt this skill: https://proskills.md/skills/other/netcracker-qubership-ai-packages-agent-packages-test-authoring-apm-skills-test-a

Page: https://proskills.md/skills/other/netcracker-qubership-ai-packages-agent-packages-test-authoring-apm-skills-test-a
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: agent-packages/test-authoring/.apm/skills/test-authoring/SKILL.md
size: 8016
upstream: https://github.com/netcracker/qubership-ai-packages/blob/main/agent-packages/test-authoring/.apm/skills/test-authoring/SKILL.md

```text
---
name: test-authoring
description: >-
  Load before writing, editing, or reviewing a test in any language, and at the end of a coding task
  that changed behavior ("fix the bug"): the change owes tests, and this skill decides which. Also
  load when asked whether a change is tested enough, at which level a test belongs, why a test is
  flaky, whether a test could fail at all, how to name a case, how related cases share their
  setup, whether several cases may share one check, whether a new test takes its file's shape or
  reuses its helpers, which assertion to use and what it prints, how to fake a dependency, when a
  property-based or exhaustiveness test is owed, or how to read a mutation or coverage report. Its
  references cover JUnit 4, JUnit 5 and 6, AssertJ, Truth, Hamcrest, Mockito, jetCheck, ArchUnit,
  pytest, Go testing and testify, cargo test, Jest, Vitest, and node:test. Wording belongs to the
  developer-style skill of the repository's language, and the comment above a test to the
  doc-comment skill of its programming language; load those too.
---

# Authoring a test

This skill governs **what a test establishes, at which level, with which inputs, and how its failure reads**. Wording,
tone, and the phrasing of a name or a message once its content is decided belong to the developer-style skill of the
language the repository writes in: `english-developer-style` unless the repository's instructions name another, such
as `russian-developer-style` or `french-developer-style`; load it too. The comment or docstring above a test belongs
to the doc-comment skill of its programming language (`javadoc-authoring`, `godoc-authoring`, `pythondoc-authoring`,
`rustdoc-authoring`, `jsdoc-authoring`). The commit message and the pull request description belong to
`change-description-authoring`.

Where the expected value is unknown and has to be learned by querying another system (a legacy service being ported, a
vendor binary without source, a reference stand that answers a parity or golden suite), which questions to send it is
`blackbox-test-design`'s subject; load it too. This skill still governs each test that carries a question.

## 0. Which references to open

The rules below hold in every framework. What each framework prints, which of its assertions carry the values, where
the message goes, and how a case is named are in `references/`, one file per **role** a library plays in the test,
grouped by ecosystem. **Before writing the first assertion, read the file for the project's test engine and the file
for its assertion library** (a matcher library on JUnit adds the JUnit assertions file, as the rule on report forms
below says). Open the other roles' files where the change calls for them, and no other.

| Role | Decides | Files |
| --- | --- | --- |
| Test engine | The container and the name in the report (§7), parameterized case names, random order (§8) | `java/junit5.md` (JUnit 5 and 6), `java/junit4.md`, `python/pytest.md`, `go/testing.md`, `rust/libtest.md`, `javascript/jest.md`, `javascript/vitest.md`, `javascript/node-test.md` |
| Assertion library | Which call prints the operands, the operand order, where the message goes, grouped assertions, error assertions (§7) | `java/junit5-assertions.md`, `java/junit4-assert.md`, `java/assertj.md`, `java/truth.md`, `java/hamcrest.md`, `go/testify.md`. pytest, Go `testing`, cargo test, Jest, Vitest, and `node:test` are both engine and assertions, and their engine file covers this role |
| Test doubles | How the shapes of §5 and §6 look in the library, what a verification failure prints | `java/mockito.md` |
| Property-based testing | The seed, the reproducer, the explicit example a counterexample becomes (§4) | `java/jetcheck.md` |
| Structural tests | The test on an open set of classes (§4) | `java/archunit.md` |
| Mutation | What the tool's verdicts mean (§1, §10) | `mutation-tools.md`, one table covering every ecosystem |

Which files, in this order:

1. **The repository's instructions name the stack.** A line such as `Tests: JUnit 5 engine, JUnit 5 assertions; Mockito
   for doubles; jetCheck for property-based tests; ArchUnit for structural tests` selects the files, and nothing else is
   opened. Where the line is missing, propose it in one sentence: to the user where the session has one, in the review
   where the task is a review, and in the pull request description otherwise. The proposal edits no file. Write the line
   into the repository's instructions file (`AGENTS.md`, `CLAUDE.md`) only after the user agrees. A change made with no
   user to ask, a change to a repository that somebody else maintains, and a review all stop at the proposal. Where the
   instructions file is generated, as its header or the repository's build shows, the agreed line goes into the source
   the file is generated from. An edit to the output is lost at the next generation. Where the repository has no
   instructions file, ask the user whether to add the line in a new `AGENTS.md`, and create no instructions file
   unasked. A change that finds the line present adds to it only a fact about the harness that the change had to
   establish (§7), under the same condition. The line names the major version where the reference files split by it
   (`junit4.md`, `junit5.md`). Besides the libraries, it may carry a rule that decides how a new test is written, such
   as a library new tests do not use. For a harness that has no reference file here, the project's own or a library's,
   it also says whether one call of the harness reports every mismatch and how it names each case (§7). Maintainers may
   write their tests as if a harness reported every mismatch, or named each case by content, before it does, and accept
   a harder diagnosis until the harness does; the line then says so (§7). It may name the follow-up that asks a harness
   for what it lacks, such as a label (§7). It carries no more: no rationale, and nothing about one test.
2. **Otherwise the imports of the nearest existing test of the same unit decide** (`org.junit.jupiter` against
   `org.junit.Test`, `org.assertj` against `org.junit.jupiter.api.Assertions`), then the build file. §9 already
   requires reading that test. In a repository with more than one test stack, the stack is the module's, not the
   repository's: the nearest test and the module's build file decide, and a stack line in the module's own
   instructions beats one at the root.
3. **The report rules of §7 come from the assertion library's file, never from the engine's.** `assertAll` is
   JUnit's grouping and `assertSoftly` AssertJ's; a project on AssertJ does not get the JUnit form because its engine
   is JUnit. A matcher library on JUnit (Hamcrest, Truth) borrows grouping and throw assertions from the JUnit
   assertions file, so such a project opens both.
4. **A reference is written for the latest minor of the major it names**, and marks no minor of its own. Where the
   project resolves an older minor and a call the reference names does not exist there, use the form that does. The
   compiler says so on the JVM, in Go, and in Rust; pytest, Jest, Vitest, and `node:test` say so at collection or on
   the first run; and the resolved version is one `grep` of the lock or build file away when a call looks new. A
   file covers one major, and where two majors differ in how a test is written they have two files (`junit4.md`,
   `junit5.md`).
5. **A role whose library has no file here** (Spock, Kotest, RSpec, PHPUnit, xUnit.net, GoogleTest, a doubles
   library other than Mockito, a property tool other than jetCheck) still follows the section that names the role.
   Take §7's report rules from the library itself: write one deliberately failing assertion in each form the change
   needs, read what it prints, and keep the form that prints the operands. Do not substitute the nearest file: a
   JUnit form inside an AssertJ test compiles and reports worse.

## 1. The correction that matters most

**A
```

## File: README.md
upstream: https://github.com/netcracker/qubership-ai-packages/blob/main/README.md

````text
# qubership-ai-packages

This repository is an APM marketplace of Qubership agent packages. Use it to install shared skills, instructions, and
umbrella packages for agents such as Claude Code, Codex, Cursor, and GitHub Copilot.

## Contents

- [Prerequisites](#prerequisites)
- [Quick start](#quick-start)
- [About APM](#about-apm)
- [APM installation](#apm-installation)
- [Repository onboarding](#repository-onboarding)
- [Qubership user essentials](#qubership-user-essentials)
- [Guides](#guides)

## Prerequisites

Microsoft APM is used to manage packages. Install APM as described in the
[APM installation section](#apm-installation), or update it to the latest version by running:

```shell
apm self-update
```

## Quick start

### Register the marketplace

```shell
apm marketplace add Netcracker/qubership-ai-packages
```

### Install the recommended package set

Install it in the global user scope, then compile it.
The `--target` value is your local harness list. The example uses the default Qubership targets.

```shell
apm install qubership-user-essentials@qubership-ai-packages --target claude,codex,cursor -g
apm compile -g
```

### Optional: pin the marketplace version

The default marketplace registration tracks the `main` branch.
To pin the marketplace for reproducible installs, pass `--ref` with a release tag, branch, or commit SHA:

```shell
apm marketplace add Netcracker/qubership-ai-packages --ref <tag-or-sha>
```

## About APM

[Agent Package Manager (APM)](https://github.com/microsoft/apm) installs and deploys AI-agent primitives:
instructions, skills, prompts, agents, hooks, plugins, and MCP servers.

Use the official Microsoft APM docs for the full workflow:

- [APM quick start](https://microsoft.github.io/apm/quickstart/)
- [APM installation guide](https://microsoft.github.io/apm/getting-started/installation/)
- [APM CLI reference](https://microsoft.github.io/apm/reference/cli/install/)
- [APM package anatomy](https://microsoft.github.io/apm/concepts/package-anatomy/)
- [Primitives and targets](https://microsoft.github.io/apm/concepts/primitives-and-targets/)
- [`apm.yml` manifest schema](https://microsoft.github.io/apm/reference/manifest-schema/)

See the [package-manager evaluation](research/apm-research/) for a comparison with other open-source managers for
skills, MCP servers, and agent context.

### When to run `apm compile`

For project installs, `apm install` deploys primitives and runs `apm compile` internally during the integrate phase. Run
`apm compile` directly when you are iterating on local `.apm/instructions/*.instructions.md`, need flags such as
`--dry-run`, `--validate`, or `--clean`, or need to refresh generated root context files without changing
dependencies.

For global installs, run `apm compile -g` after `apm install -g` when the installed packages include instructions.
A global install fetches and deploys the package, but global compilation is explicit and writes user-scoped root
context files such as `~/.codex/AGENTS.md` and `~/.claude/CLAUDE.md`.

See the official [APM compile guide](https://microsoft.github.io/apm/producer/compile/). The Claude-specific
discussion in [microsoft/apm#1807](https://github.com/microsoft/apm/issues/1807) explains why always-on or
read-only-session guidance may need native context-file placement instead of only path-scoped rules.

## APM installation

Install APM with the package manager for your platform when one is available.
Follow the [official APM installation guide](https://microsoft.github.io/apm/getting-started/installation/).

## Repository onboarding

- [Qubership repository onboarding skill](agent-packages/qubership-agent-support-pr/) — create an onboarding PR for a
  repository.

To add the Qubership repository baseline, install the marketplace and the onboarding skill globally:

```shell
apm marketplace add Netcracker/qubership-ai-packages
apm install qubership-agent-support-pr@qubership-ai-packages --target codex,claude -g
```

Then ask your agent to prepare the PR from inside the target Git repository:

```text
Use qubership-agent-support-pr to create a PR that adds Qubership agent support
to this repository.
```

The skill installs [`qubership-essentials`](agent-packages/qubership-essentials/) in the repository and prepares the
generated agent assets for the selected harnesses.

## Qubership user essentials

Recommended package to be used when working with any Qubership repository. It must be installed once, globally,
into the user space.

- [Qubership user essentials](agent-packages/qubership-user-essentials/) — the global baseline package.

Choose the agent harnesses you use and install the package globally. This example uses the default Qubership
targets; replace `--target` with the harnesses you use:

```shell
apm marketplace add Netcracker/qubership-ai-packages
apm install qubership-user-essentials@qubership-ai-packages --target claude,codex,cursor -g
apm compile -g
```

## Guides

- [Consuming packages](docs/consuming-packages.md) — register the marketplace, then install, update, and remove
  packages.
- [Publishing packages](docs/publishing-packages.md) — add a package and release a new marketplace version.
- [Renovate APM dependency updates](docs/renovate-apm-dependencies.md) — understand Renovate APM PRs and the manual
  marketplace index refresh.
````
