AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Java Testing Advanced

skill-linlannet-agent-skills-java-testing-advanced · by linlannet

Advanced testing - Testcontainers, contract testing, mutation testing, property-based

No reviews yet
0 installs
26 views
0.0% view→install

Install

$ agentstack add skill-linlannet-agent-skills-java-testing-advanced

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-linlannet-agent-skills-java-testing-advanced)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
7mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Java Testing Advanced? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Java 高级测试技能

用于全面测试覆盖的高级测试技术。

概述

本技能涵盖高级测试模式,包括用于集成测试的 Testcontainers、使用 Pact 的契约测试、使用 PIT 的突变测试和基于属性的测试。

何时使用此技能

当您需要以下操作时使用:

  • 使用真实数据库进行测试(Testcontainers)
  • 验证 API 契约
  • 使用突变测试发现测试漏洞
  • 自动生成测试用例

快速参考

Testcontainers

@Testcontainers
@SpringBootTest
class OrderRepositoryIT {

    @Container
    static PostgreSQLContainer postgres =
        new PostgreSQLContainer<>("postgres:15")
            .withDatabaseName("test")
            .withUsername("test")
            .withPassword("test");

    @Container
    static KafkaContainer kafka =
        new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.4.0"));

    @DynamicPropertySource
    static void configure(DynamicPropertyRegistry registry) {
        registry.add("spring.datasource.url", postgres::getJdbcUrl);
        registry.add("spring.kafka.bootstrap-servers", kafka::getBootstrapServers);
    }

    @Test
    void shouldPersistOrder() {
        Order saved = repository.save(new Order("item", 100.0));
        assertThat(saved.getId()).isNotNull();
    }
}

契约测试(Pact)

@ExtendWith(PactConsumerTestExt.class)
class UserServiceContractTest {

    @Pact(consumer = "order-service", provider = "user-service")
    public RequestResponsePact createPact(PactDslWithProvider builder) {
        return builder
            .given("user exists")
            .uponReceiving("get user request")
                .path("/users/1")
                .method("GET")
            .willRespondWith()
                .status(200)
                .body(new PactDslJsonBody()
                    .integerType("id", 1)
                    .stringType("name", "John"))
            .toPact();
    }

    @Test
    @PactTestFor(pactMethod = "createPact")
    void testGetUser(MockServer mockServer) {
        User user = client.getUser(mockServer.getUrl(), 1L);
        assertThat(user.getName()).isEqualTo("John");
    }
}

突变测试(PIT)


    org.pitest
    pitest-maven
    1.15.0
    
        
            com.example.service.*
        
        80
    

基于属性的测试

@Property
void shouldReverseListTwiceReturnsOriginal(@ForAll List list) {
    Collections.reverse(list);
    Collections.reverse(list);
    // Original order restored
}

测试金字塔

     /\        E2E 测试(少量)
    /  \       契约测试
   /----\      集成测试
  /------\     单元测试(大量)

故障排除

| 问题 | 解决方案 | |------|----------| | 容器缓慢 | 重用容器 | | 端口冲突 | 随机端口 | | 不稳定的测试 | 等待策略 |

使用方法

Skill("java-testing-advanced")

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.