@analizza-ai/testspec 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +189 -0
  4. package/bin/cli.js +42 -0
  5. package/package.json +69 -0
  6. package/src/adapters/agents/claude.js +88 -0
  7. package/src/adapters/agents/copilot.js +39 -0
  8. package/src/adapters/agents/index.js +22 -0
  9. package/src/adapters/sdd/index.js +23 -0
  10. package/src/adapters/sdd/openspec.js +58 -0
  11. package/src/adapters/sdd/speckit.js +19 -0
  12. package/src/commands/generate.js +66 -0
  13. package/src/commands/init.js +112 -0
  14. package/src/commands/report.js +60 -0
  15. package/src/commands/validate.js +68 -0
  16. package/src/core/reporter.js +44 -0
  17. package/src/core/spec-parser.js +141 -0
  18. package/src/core/stub-generator.js +92 -0
  19. package/src/core/testcontainers.js +39 -0
  20. package/src/core/tests-builder.js +120 -0
  21. package/src/index.js +10 -0
  22. package/src/utils/config.js +29 -0
  23. package/src/utils/logger.js +13 -0
  24. package/src/utils/sdd-detector.js +23 -0
  25. package/templates/agent-instructions/AGENTS.md +39 -0
  26. package/templates/agent-instructions/CLAUDE.md +48 -0
  27. package/templates/agent-instructions/copilot.md +52 -0
  28. package/templates/agent-instructions/skills/testspec-apply-qa.md +424 -0
  29. package/templates/agent-instructions/skills/testspec-generate.md +138 -0
  30. package/templates/agent-instructions/skills/testspec-run-qa.md +338 -0
  31. package/templates/agent-instructions/skills/testspec-specify-qa.md +535 -0
  32. package/templates/stubs/jest/unit.template.js +17 -0
  33. package/templates/stubs/junit/unit.template.java +27 -0
  34. package/templates/stubs/pytest/unit.template.py +18 -0
  35. package/templates/stubs/testcontainers/node-pg-kafka.template.js +38 -0
  36. package/templates/stubs/testcontainers/node-pg.template.js +32 -0
  37. package/templates/stubs/testcontainers/spring-pg-kafka.template.java +41 -0
  38. package/templates/stubs/vitest/unit.template.js +19 -0
  39. package/templates/tests-md/default.md +43 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Integration test stub — {{FEATURE}} (change: {{CHANGE}})
3
+ * Stack: Spring Boot + PostgreSQL + Kafka (Testcontainers)
4
+ * Auto-generated by testspec. Fill in HTTP calls and DB/Kafka assertions.
5
+ */
6
+
7
+ import org.junit.jupiter.api.Test;
8
+ import org.springframework.boot.test.context.SpringBootTest;
9
+ import org.springframework.boot.test.web.client.TestRestTemplate;
10
+ import org.springframework.beans.factory.annotation.Autowired;
11
+ import org.testcontainers.containers.PostgreSQLContainer;
12
+ import org.testcontainers.containers.KafkaContainer;
13
+ import org.testcontainers.junit.jupiter.Container;
14
+ import org.testcontainers.junit.jupiter.Testcontainers;
15
+ import org.testcontainers.utility.DockerImageName;
16
+ import static org.assertj.core.api.Assertions.assertThat;
17
+
18
+ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
19
+ @Testcontainers
20
+ class {{FEATURE_CAMEL}}IntegrationTest {
21
+
22
+ @Container
23
+ static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16-alpine");
24
+
25
+ @Container
26
+ static KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.4.0"));
27
+
28
+ @Autowired
29
+ TestRestTemplate restTemplate;
30
+
31
+ // {{SCENARIOS}}
32
+
33
+ @Test
34
+ void ctPlaceholder_replaceWithRealCT() {
35
+ // Input: (from tests.md CT input field)
36
+ // Expected output: (from tests.md CT expected output field)
37
+ // DB validation: (from tests.md CT DB validation field)
38
+ assertThat(postgres.isRunning()).isTrue();
39
+ assertThat(kafka.isRunning()).isTrue();
40
+ }
41
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * {{CT_ID}} — {{TITLE}}
3
+ * Feature: {{FEATURE}}
4
+ * Auto-generated by testspec. Fill in arrange/act/assert.
5
+ */
6
+
7
+ import { describe, it, expect, beforeEach } from 'vitest';
8
+
9
+ describe('{{CT_ID}} — {{TITLE}}', () => {
10
+ beforeEach(() => {
11
+ // arrange: set up state from spec precondition
12
+ });
13
+
14
+ it('should {{TITLE}}', async () => {
15
+ // Input: (from CT input field)
16
+ // Expected output: (from CT expected output field)
17
+ expect(true).toBe(true); // replace with real assertion
18
+ });
19
+ });
@@ -0,0 +1,43 @@
1
+ ---
2
+ feature: {{FEATURE}}
3
+ change: {{CHANGE}}
4
+ generated: {{GENERATED}}
5
+ sdd: {{SDD}}
6
+ sdt: {{SDT_VERSION}}
7
+ stack: { lang: {{LANG}}, db: {{DB}} }
8
+ qa-repo: {{QA_REPO}}
9
+ ---
10
+
11
+ # Tests — {{FEATURE}}
12
+
13
+ ## Scope
14
+
15
+ -
16
+
17
+ ## Out of scope
18
+
19
+ -
20
+
21
+ ## Test cases
22
+
23
+ ### CT-01 — {{TITLE}}
24
+
25
+ | Field | Value |
26
+ |---------------------|------------------------------|
27
+ | Type | unit \| integration \| e2e \| load \| chaos |
28
+ | Layer | developer \| qa \| chaos |
29
+ | Precondition | |
30
+ | Input | |
31
+ | Expected output | |
32
+ | DB validation | |
33
+ | Acceptance criteria | · |
34
+
35
+ ## Load profile hints
36
+
37
+ | Scenario | RPS | Duration | p95 target | p99 target |
38
+ |----------|-----|----------|------------|------------|
39
+
40
+ ## Chaos scenarios
41
+
42
+ | Scenario | Failure mode | Expected behaviour |
43
+ |----------|--------------|--------------------|