/xwiki:xwiki-test-guidelinesfrom xwiki
Provides XWiki-specific test writing rules covering unit, integration, and Docker-based functional tests. Load before creating or modifying any test to avoid common pitfalls with rights, page-object boundaries, waits, and ordering.
Ships in xwiki. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
For the declarative testing map — test kinds and naming, the no-stdout rule, the lightest-base rule, coverage, and where each test framework lives — see kb/testing/strategy.md (via the xwiki-knowledge skill). This skill is the procedure for writing a test.
When converting existing tests (JUnit4/JMock → JUnit5/Mockito), use the xwiki-convert-tests skill in addition to this one.
When writing a test:
kb/testing/unit-test-framework.md follows the code)*IT — or an existing @Test method inside it — already builds the fixture you need, and extend that instead of adding a new one: a functional test is a scenario, and no two methods should build the same fixture. This is not a licence to merge everything into one unreadable method — a distinct fixture justifies a distinct method, a merely distinct assertion does not. Methods share a fixture through @Order: a later method may rely on what an earlier one built, unless the fixture is cheap enough to rebuild so the method can run alone. Give every @Test method an @Order(n), numbered in source order, even when there is only one. See the scenario and @Order rules in kb/testing/strategy.md.kb/testing/strategy.md)kb/testing/strategy.md describes — even where the nearest existing module doesn't.TestUtils#getString — executeAndGetBodyAsString drives the browser too (see the assertion-channel rule in kb/testing/strategy.md).getDriver(), By/selector, CSS class, DOM attribute value, WebElement or executeScript — not even handed to a page-object method (contentContainsElement(By.cssSelector(...))). If you need one, an API is missing from a page object; add it there, in the user's terms, and call that instead (see the page-object boundary rule in kb/testing/strategy.md).waitUntil… after calling it; a wait there belongs in that method (page-object rules in kb/testing/strategy.md).xwiki-capture-ui-change. Shoot the "before" on an instance without the change, on the fixture the test builds; then deploy the change to that instance (xwiki-deploy-extension) and shoot the "after" while the test runs or once it passes, the test's own containers being gone after the run. One instance, one scripted capture per state.xwiki-build skill has the pre-run checks (port 8080, JDK on PATH).kb/testing/ci-watch.md).kb/testing/test-value.md). A test needing many stubs, a captor to reach the result, a doAnswer faking a side effect, InOrder or reflection is design feedback: extract the logic or test higher up (same file). Use @OldcoreTest only when needed — code saving documents needs it.-Pquality -Dxwiki.jacoco.instructionRatio=1.00 which should fail but provide the current threshold value that can then be used to replace the current value.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub xwiki/xwiki-dev-llm --plugin xwiki38 skills in this plugin
/xwiki-backportBackport any change (bug fix, feature, refactor, or test) to an older branch of an XWiki repo (xwiki-platform / xwiki-commons / xwiki-rendering / xwiki-contrib). Cherry-pick `-x` the source commit(s) into a worktree, ADAPT the result to the older branch (module pom versions, Java level, `@since` tags, data migration versions and skip ranges, style/API divergence), verify it compiles against that branch, and push / open a PR. Use whenever a commit that exists on one branch needs to be applied to an older/maintenance branch. For the `testneeded`-labelled test sweep use xwiki-backport-testneeded (which builds on this skill); for Maven commands use xwiki-build; for PR/commit conventions use xwiki-pull-request; for the versioning/`@since` conventions (the format and what carries `@since`) use xwiki-knowledge./xwiki-backport-testneededBackport the automated test of one JIRA issue labelled `testneeded` to the currently-supported stable branches, adjust its `@since` tags across all branches, and open the PRs. Use when asked to backport the test of a given testneeded issue, or to catch a stable branch up with a recently-added test. (For several issues at once, the user will say so — then apply this per issue.) This is the test-specific layer on top of xwiki-backport (which owns the generic cherry-pick / adapt-to-branch / verify mechanics — including the mandatory pom-version, Java-version and `@since` checks). For Maven use xwiki-build; for PR/commit conventions use xwiki-pull-request; for the `@since` rules use xwiki-knowledge; for querying JIRA (the testneeded sweep) use xwiki-jira./xwiki-buildBuild and test XWiki Maven modules. Use when building XWiki, running its tests, or when the user mentions mvn, a build, a failing test, or a specific XWiki module./xwiki-capture-ui-changeCapture the "before" screenshot of a fix to existing XWiki UI when the branch can no longer produce it (the fix is already in the working tree) - on the released version's Docker image, or by building and deploying the pre-fix code on a local instance - and shoot the same fixture in both states. Costs minutes to tens of minutes, so propose it and run it only with the user's explicit approval. Not for a new feature or a redesign (there is no "before"), nor when the bug can still be shot on a running instance before applying the fix. For deploying an extension without a comparison use xwiki-deploy-extension; for Maven commands use xwiki-build; for the PR/JIRA screenshot conventions use xwiki-pull-request; for manually testing every fix of a release use xwiki-manual-test./xwiki-ci-checkEXPLICIT INVOCATION ONLY — never load this skill to answer a question about CI. The daily acting sweep of ci.xwiki.org: it turns what is red on the maintained branches into incidents, attributes each to the commit that caused it and comments there, opens PRs for mechanical fixes (a failing quality gate or a build break first), files proven flicker issues, drafts a fix for one flicker, and posts a digest to Matrix. Only with --write does it write to GitHub, JIRA and Matrix; otherwise it analyses to stdout and asks before each write. Use ONLY when named — `/xwiki-ci-check`, "run the CI check", or a scheduled routine invoking it by name. Do NOT use it for "what's the CI status?", "is master green?", "why is this test failing?" or any other read-only CI question: those are xwiki-release-test-triage. To fix one flicker use xwiki-fix-flickering-docker-test, to file an issue use xwiki-jira, to open a PR use xwiki-pull-request, for Maven use xwiki-build, for Sonar findings use xwiki-fix-sonarqube-issue./xwiki-contrib-releaseRelease an xwiki-contrib extension (groupId org.xwiki.contrib) end to end — preflight, `mvn release:prepare`/`release:perform` to nexus.xwiki.org, the issue-tracker version (JIRA or OpenProject), the extensions.xwiki.org import and release notes, then the hand-off to the announcement. Use when asked to release or publish a version of a contrib extension ("release v1.15 of the doc app"). Not for xwiki-commons/rendering/platform releases (use xwiki-xs-release). For the blog post use xwiki-contrib-release-blog-post; for Maven/JDK use xwiki-build; for tracker calls use xwiki-jira or xwiki-openproject.