Skip to content

Commit 070c65d

Browse files
Burgynclaude
andcommitted
Merge origin/master into copilot/add-install-skills-command
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 parents c58ccbb + 93f0635 commit 070c65d

71 files changed

Lines changed: 2304 additions & 127 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/teapie/SKILL.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
---
22
name: teapie
3-
description: Comprehensive TeaPie framework expertise for API integration testing. Use when: (1) Working with TeaPie projects, API testing, .http files, C# test scripts (.csx), test collections, directives, variables, functions, authentication, retrying, (2) Creating and scaffolding test cases using `teapie generate`, renumbering tests, initializing TeaPie projects, (3) Running tests with `teapie test`, finding tests for API endpoints, debugging test failures, generating reports, (4) Analyzing .teapie folder structure, discovering custom functions/directives/auth providers registered in init.csx, understanding project-specific configurations, or (5) When users need guidance on TeaPie CLI commands, test structure, framework capabilities, or test organization.
3+
description: Comprehensive TeaPie framework expertise for API integration testing. Use when: (1) Working with TeaPie projects, API testing, .http files, .tp files, C# test scripts (.csx), test collections, directives, variables, functions, authentication, retrying, (2) Creating and scaffolding test cases using `teapie generate`, renumbering tests, initializing TeaPie projects, (3) Running tests with `teapie test`, finding tests for API endpoints, debugging test failures, generating reports, (4) Analyzing .teapie folder structure, discovering custom functions/directives/auth providers registered in init.csx, understanding project-specific configurations, or (5) When users need guidance on TeaPie CLI commands, test structure, framework capabilities, or test organization.
44
---
55

66
# TeaPie Framework
77

88
## Overview
99

10-
TeaPie (TEsting API Extension) is a lightweight CLI tool for API testing that combines `.http` files with C# scripts for comprehensive integration testing. This skill provides expert knowledge on all TeaPie capabilities, syntax, and best practices.
10+
TeaPie (TEsting API Extension) is a lightweight CLI tool for API testing that combines `.http` files with C# scripts or uses `.tp` files that cover both types of files within one for comprehensive integration testing. This skill provides expert knowledge on all TeaPie capabilities, syntax, and best practices.
1111

1212
## Quick Reference
1313

1414
### Test Case Structure
1515

16-
Each test case consists of:
16+
TeaPie supports two equivalent formats. Choose based on script complexity and structure preferences; both can coexist in the same collection.
17+
18+
**Multi-file format:**
1719

1820
- **`<name>-req.http`** (required) - HTTP request file (one or more requests)
1921
- **`<name>-init.csx`** (optional) - Pre-request script for setup
2022
- **`<name>-test.csx`** (optional) - Post-response script for validation
2123

24+
**Single-file format (`.tp`):**
25+
26+
- **`<name>.tp`** - All sections in one file using markers: `--- TESTCASE`, `--- INIT`, `--- HTTP`, `--- TEST`, `--- END`
27+
2228
### Naming Convention
2329

2430
Use zero-padded numeric prefixes for ordering:
@@ -55,7 +61,7 @@ teapie test [path] # Run tests (default command)
5561
teapie generate <name> [-i] [-t] # Scaffold new test case
5662
teapie init # Initialize .teapie folder
5763
teapie explore [path] # Explore collection structure
58-
teapie compile|comp|c <path> # Attempt to compile the C# script at the specified path to check for compile-time errors
64+
teapie compile|comp|c <path> # Compile C# script (.csx) or test case (.tp) at the specified path to check for compile-time errors
5965
```
6066

6167
### Directives

.claude/skills/teapie/references/cli-commands.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ teapie test [path] [--temp-path <path>] [-e|--env <envName>] [--env-file <file>]
1616

1717
**Arguments:**
1818

19-
- `path` - Path to the collection or test case. Defaults to current directory.
19+
- `path` - Path to the collection, test case (`.http`), or single-file test case (`.tp`). Defaults to current directory.
2020

2121
**Options:**
2222

@@ -112,7 +112,7 @@ teapie explore [path] [--env-file <file>] [-i|--init-script <script>] [logging o
112112

113113
**Arguments:**
114114

115-
- `path` - Path to collection or test case. Defaults to current directory.
115+
- `path` - Path to collection, request file (`.http`), or single-file test case (`.tp`). Defaults to current directory.
116116

117117
**Options:**
118118

@@ -125,7 +125,7 @@ teapie explore [path] [--env-file <file>] [-i|--init-script <script>] [logging o
125125

126126
**Command name:** `compile`, `comp`, or `c`
127127

128-
**Purpose:** Compile a script at the specified path. Check for compile-time exceptions.
128+
**Purpose:** Compile a script or test case at the specified path. Check for compile-time exceptions.
129129

130130
**Full Syntax:**
131131

@@ -135,7 +135,7 @@ teapie compile <path> [logging options...] [--no-logo]
135135

136136
**Arguments:**
137137

138-
- `path` - Path to script to compile (required).
138+
- `path` - Path to script (`.csx`) or test case file (`.tp`) to compile. For `.tp` files, INIT and TEST sections are compiled. Required.
139139

140140
**Options:**
141141

.claude/skills/teapie/references/test-structure.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@ Complete reference for TeaPie test case and collection structure.
44

55
## Test Case Structure
66

7-
### Required Files
7+
TeaPie supports two equivalent formats. Choose based on script complexity and structure preferences; both can coexist in the same collection.
8+
9+
### Multi-File Format
10+
11+
**Required:**
812

913
- **`<name>-req.http`** - Request file containing HTTP request(s). Must follow Microsoft HTTP file conventions.
1014

11-
### Optional Files
15+
**Optional:**
1216

1317
- **`<name>-init.csx`** - Pre-request script for data setup and initialization
1418
- **`<name>-test.csx`** - Post-response script for validation and assertions
1519

20+
### Single-File Format (`.tp`)
21+
22+
- **`<name>.tp`** - All sections in one file using markers: `--- TESTCASE`, `--- INIT`, `--- HTTP`, `--- TEST`, `--- END`
23+
- Optional alternative to multi-file format; supports single or multiple test cases per file
24+
1625
### File Naming Convention
1726

1827
**Pattern:** `<prefix>-<descriptive-name>-<suffix>.<ext>`
@@ -51,7 +60,8 @@ Tests/
5160
│ ├── 002-Edit-Car-test.csx
5261
│ ├── 003-Check-Car-init.csx
5362
│ ├── 003-Check-Car-req.http
54-
│ └── 003-Check-Car-test.csx
63+
│ ├── 003-Check-Car-test.csx
64+
│ └── 004-Car-Operations.tp # Single-file format (optional alternative)
5565
└── 003-Car-Rentals/ # Another collection
5666
├── 001-Rent-Car-init.csx
5767
├── 001-Rent-Car-req.http
@@ -86,12 +96,12 @@ Collections can contain optional files:
8696

8797
Test cases are executed in alphabetical order (ensured by numeric prefixes):
8898

89-
1. Structure exploration - Scans for test cases and related files
99+
1. Structure exploration - Scans for test cases (`-req.http` files and `.tp` files) and related files
90100
2. Initialization script execution (if present)
91101
3. For each test case (in alphabetical order):
92-
- Pre-request script execution (`-init.csx`)
93-
- HTTP request(s) execution (`-req.http`)
94-
- Post-response script execution (`-test.csx`)
102+
- Pre-request script execution (`-init.csx` or `--- INIT` section in `.tp`)
103+
- HTTP request(s) execution (`-req.http` or `--- HTTP` section in `.tp`)
104+
- Post-response script execution (`-test.csx` or `--- TEST` section in `.tp`)
95105

96106
## .teapie Folder Structure
97107

@@ -128,11 +138,12 @@ The `$teapie` wildcard resolves to the absolute path of the `.teapie` folder, av
128138
TeaPie discovers test cases by:
129139

130140
1. Recursively scanning directories (depth-first)
131-
2. Finding all `.http` files ending with `-req.http`
132-
3. Matching associated scripts by name:
141+
2. Finding all `.http` files ending with `-req.http` and all `.tp` files
142+
3. For multi-file format: matching associated scripts by name:
133143
- `{test-case-name}-init.csx` for pre-request
134144
- `{test-case-name}-test.csx` for post-response
135-
4. Processing files in alphabetical order (ensured by numerical prefixes)
145+
4. For `.tp` format: parsing section markers within the file
146+
5. Processing files in alphabetical order (ensured by numerical prefixes)
136147

137148
## Best Practices
138149

@@ -160,6 +171,7 @@ This ensures consistent ordering across all environments and prevents incorrect
160171
- `001-Add-Customer-req.http` - Creates a new customer
161172
- `002-Edit-Customer-req.http` - Updates an existing customer
162173
- `003-Delete-Customer-req.http` - Deletes a customer
174+
- `004-Car-Operations.tp` - Single-file format with multiple test cases
163175

164176
### Multiple Requests in One File
165177

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,10 @@ dotnet_diagnostic.IDE0130.severity = warning
432432

433433
## Analyzers by file
434434

435+
[tests/TeaPie.Tests/Integration/DemoProjectShould.cs]
436+
# IDE0005: Testcontainers Containers namespace is required for IContainer; analyzer incorrectly flags it
437+
dotnet_diagnostic.IDE0005.severity = none
438+
435439
[*{Query,Command,Should,Test,Tests}.cs]
436440

437441
# CA1034: Do not nest type. Alternatively, change its accessibility so that it is not externally visible.

.github/workflows/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ jobs:
9191
run: dotnet pack --configuration Release --no-build
9292

9393
- name: Find and Publish NuGet Package
94-
run: dotnet nuget push $(find . -type f -name "*.nupkg") --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
94+
run: dotnet nuget push $(find ./src -type f -name "*.nupkg") --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

Directory.Packages.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
2323
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
2424
<PackageVersion Include="Spectre.Console.Cli" Version="0.50.0" />
25+
<PackageVersion Include="Testcontainers" Version="4.8.0" />
2526
<PackageVersion Include="Spectre.Console.Testing" Version="0.50.0" />
2627
<PackageVersion Include="Spectre.Console" Version="0.50.0" />
2728
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta7.25380.108" />
2829
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
2930
<PackageVersion Include="xunit" Version="2.9.3" />
3031
<PackageVersion Include="xunit.assert" Version="2.9.3" />
32+
<PackageVersion Include="Verify.Xunit" Version="31.9.0" />
3133
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
3234
</ItemGroup>
3335
</Project>

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
![Logo](logo.png)
88

9-
TeaPie is a **lightweight API testing framework** designed for **automation-friendly, scriptable API testing** with `.http` files.
9+
TeaPie is a **lightweight API testing framework** designed for **automation-friendly, scriptable API testing** with `.http` and `.tp` files.
1010
It provides **pre-request scripting, post-response validation, retry strategies, flexible authentication, environments support and custom test directives**.
1111

1212
## 📖 Documentation
@@ -17,6 +17,8 @@ It provides **pre-request scripting, post-response validation, retry strategies,
1717

1818
**Universal HTTP Requests Definition** – Define HTTP requests using `.http` files
1919

20+
**Flexible Test Structure** – Use multi-file (`.http` + `.csx`) or single-file (`.tp`) format based on your needs
21+
2022
**Pre-Request & Post-Response Scripts** – Extend HTTP request with C# scripts for data
2123

2224
**Custom Authentication Providers** – Supports OAuth2 & user-defined authentication providers
@@ -77,6 +79,12 @@ Execute a single test case:
7779
teapie test ".\demo\Tests\002-Cars\002-Edit-Car-req.http"
7880
```
7981

82+
Or run a single-file test case (`.tp`):
83+
84+
```sh
85+
teapie test ".\demo\Tests\002-Cars\004-Car-Operations.tp"
86+
```
87+
8088
For more usage details, visit the **[Wiki](https://kros-sk.github.io/TeaPie/docs/introduction.html)**.
8189

8290
## 🤝 Contributing
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// This file uses the single-file (.tp) format. A .tp file can contain one or more test cases,
2+
// each defined by section markers: --- TESTCASE, --- INIT, --- HTTP, --- TEST, and --- END.
3+
//
4+
// --- TESTCASE <Name> Starts a named test case (required when multiple test cases are in one file).
5+
// --- INIT Pre-request C# script (optional). Same role as <name>-init.csx.
6+
// --- HTTP HTTP request definition (required). Same format as .http files.
7+
// --- TEST Post-response validation script (optional). Same role as <name>-test.csx.
8+
// --- END Ends the current test case block.
9+
//
10+
// Both .tp and multi-file formats can co-exist in the same collection.
11+
12+
--- TESTCASE Add Another Car
13+
14+
--- INIT
15+
// Load the shared car generator definition.
16+
#load "$teapie/Definitions/GenerateNewCar.csx"
17+
18+
var car = GenerateCar();
19+
tp.SetVariable("AnotherCar", car.ToJsonString(), "cars");
20+
21+
--- HTTP
22+
## TEST-EXPECT-STATUS: [201]
23+
## TEST-HAS-BODY
24+
// Add a new car using data prepared in the INIT section.
25+
# @name AddAnotherCarRequest
26+
POST {{ApiBaseUrl}}{{ApiCarsSection}}
27+
Content-Type: application/json
28+
29+
{{AnotherCar}}
30+
31+
--- TEST
32+
await tp.Test("Newly added car should be returned with an assigned Id.", async () =>
33+
{
34+
dynamic responseJson = await tp.Responses["AddAnotherCarRequest"].GetBodyAsExpandoAsync();
35+
NotNull(responseJson);
36+
True(responseJson.Id > 0);
37+
38+
// Store the Id for later use within this file.
39+
tp.SetVariable("AnotherCarId", (long)responseJson.Id, "cars");
40+
});
41+
42+
--- END
43+
44+
--- TESTCASE Get All Cars
45+
46+
--- HTTP
47+
## TEST-EXPECT-STATUS: [200]
48+
## TEST-HAS-BODY
49+
// Retrieve the full list of cars.
50+
# @name GetAllCarsRequest
51+
GET {{ApiBaseUrl}}{{ApiCarsSection}}
52+
53+
--- TEST
54+
tp.Test("Response body should not be empty.", () =>
55+
{
56+
NotNull(tp.Response);
57+
NotNull(tp.Response.Content);
58+
});
59+
60+
--- END
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--- TESTCASE Health Check
2+
3+
--- HTTP
4+
## TEST-EXPECT-STATUS: [200]
5+
## TEST-HAS-BODY
6+
# This test case uses the .tp format - a single file combining HTTP request and test script.
7+
GET {{ApiBaseUrl}}/health
8+
9+
--- TEST
10+
tp.Test("Health response should contain status field.", async () =>
11+
{
12+
dynamic responseJson = await tp.Response.GetBodyAsExpandoAsync();
13+
NotNull(responseJson);
14+
NotNull(responseJson.status);
15+
});
16+
17+
--- END

demo/server/CarRentalServer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,35 @@
9595
],
9696
"responseMode": null
9797
},
98+
{
99+
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
100+
"type": "http",
101+
"documentation": "Health check endpoint",
102+
"method": "get",
103+
"endpoint": "health",
104+
"responses": [
105+
{
106+
"uuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
107+
"body": "{\"status\": \"healthy\"}",
108+
"latency": 0,
109+
"statusCode": 200,
110+
"label": "Healthy",
111+
"headers": [],
112+
"bodyType": "INLINE",
113+
"filePath": "",
114+
"databucketID": "",
115+
"sendFileAsBody": false,
116+
"rules": [],
117+
"rulesOperator": "OR",
118+
"disableTemplating": false,
119+
"fallbackTo404": false,
120+
"default": true,
121+
"crudKey": "id",
122+
"callbacks": []
123+
}
124+
],
125+
"responseMode": null
126+
},
98127
{
99128
"uuid": "d4c7ea29-0855-433b-b9cb-992991ce3afe",
100129
"type": "http",
@@ -151,6 +180,10 @@
151180
"type": "route",
152181
"uuid": "ab6eecbe-7d35-4b3d-8a26-552bd3154ef4"
153182
},
183+
{
184+
"type": "route",
185+
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
186+
},
154187
{
155188
"type": "route",
156189
"uuid": "d4c7ea29-0855-433b-b9cb-992991ce3afe"

0 commit comments

Comments
 (0)