Skip to content

Add test skills#566

Merged
Havret merged 3 commits into
masterfrom
add-test-skills
May 3, 2026
Merged

Add test skills#566
Havret merged 3 commits into
masterfrom
add-test-skills

Conversation

@Havret
Copy link
Copy Markdown
Owner

@Havret Havret commented May 3, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two “skills” documents under .claude/skills/ describing conventions for writing unit tests (in-process AMQP/TestKit/pure model) and integration tests (real Artemis broker) in this repository.

Changes:

  • Introduces a unit test style guide covering infrastructure choices, naming, resource management, synchronization, and assertion conventions.
  • Introduces an integration test style guide covering base class usage, naming, isolation, cancellation patterns, DI/hosting fixtures, and multi-step scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
.claude/skills/unit-test-style/SKILL.md Adds unit test style guidance (Core/TestKit/Pure model), but contains a few inaccuracies vs current repo patterns and some markdown table formatting issues.
.claude/skills/integration-test-style/SKILL.md Adds integration test style guidance, but includes examples/rules that conflict with existing integration tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to +43
- Every test is `async Task` — no synchronous tests
- Use `[Fact]` only — no `[Theory]`
- Method names read as sentences: `Should_acknowledge_message`, `Should_send_message_with_priority`
Comment on lines +16 to +20
| Kind | Projects | Infrastructure |
|---|---|---|
| **Core unit tests** | `test/ArtemisNetClient.UnitTests/` | `ActiveMQNetSpec` base class + `TestContainerHost` (in-process AMQP server) |
| **TestKit unit tests** | `test/ArtemisNetClient.Testing.UnitTests/` | `TestKit` (the in-process broker from the test kit library), no base class |
| **Pure model tests** | either project | No infrastructure — pure C# assertions |
Comment thread .claude/skills/unit-test-style/SKILL.md Outdated

## Core Unit Tests — Base Class

All core unit test classes inherit from `ActiveMQNetSpec`:
Comment thread .claude/skills/unit-test-style/SKILL.md Outdated
Comment on lines +69 to +79
TestKit specs do not inherit from `ActiveMQNetSpec`. Set up AMQP tracing in the constructor and use `EndpointUtil` directly:

```csharp
public class MyTestKitSpec
{
public MyTestKitSpec(ITestOutputHelper output)
{
Trace.TraceLevel = TraceLevel.Information;
var logger = new XUnitLogger(output, "logger");
Trace.TraceListener += (_, format, args) => logger.LogTrace(format, args);
}
Comment thread .claude/skills/unit-test-style/SKILL.md Outdated
Comment on lines +175 to +179
`TestContainerHost` implements `IDisposable` — always declare it with `using var`:

```csharp
using var host = CreateOpenedContainerHost(endpoint);
```
- Files use the `*Spec.cs` suffix (BDD-style), e.g. `MessageAcknowledgementSpec.cs`
- Core tests live in `test/ArtemisNetClient.IntegrationTests/`
- Extension tests live in their own `*.IntegrationTests/` project
- Subtopics go in subdirectories (e.g. `TopologyManagement/FilterExpressionsSpec.cs`)
@Havret
Copy link
Copy Markdown
Owner Author

Havret commented May 3, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented May 3, 2026

@copilot apply changes based on the comments in this thread

Applied all the review feedback in commit 01c1be9:

  • integration-test-style: [Theory] is now allowed alongside [Fact] (with an example using [InlineData]); example subdirectory path updated to a real file (TopologyManagement/CreateAddressSpec.cs); summary checklist updated accordingly.
  • unit-test-style: ActiveMQNetSpec inheritance clarified — only applies to tests needing in-process AMQP infrastructure (pure model tests need no base class); AMQP tracing in constructor is now optional/conditional rather than mandatory; TestContainerHost disposal rule softened to "prefer using var unless you need to dispose at a specific point mid-test".

Copilot finished work on behalf of Havret May 3, 2026 10:05
@Havret Havret force-pushed the add-test-skills branch from 01c1be9 to 04d68a5 Compare May 3, 2026 10:06
@Havret Havret merged commit f7c33bb into master May 3, 2026
1 check passed
@Havret Havret deleted the add-test-skills branch May 3, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants