Skip to content

Commit a7c2228

Browse files
committed
testcase example added
1 parent 0b22917 commit a7c2228

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

docs/04-Examples/041-http-examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Http spec. examples
2+
title: Http examples
33
---
44

55
:::note
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Testcase examples
3+
---
4+
5+
:::note
6+
- This page should be use as reference for specification files.
7+
- This page is subject to change. It is requested to check this page frequently.
8+
:::
9+
10+
:::note
11+
Case-wise more example can be found in [https://github.com/chkware/cli](https://github.com/chkware/cli/blob/main/tests/resources/storage/sample_config/bitcoin-usd-testcase.chk) repository
12+
:::
13+
14+
## Testcase examples:
15+
16+
Testcase is an experimental feature, in _`PRE_ALPHA`_ stage.
17+
18+
19+
### Testcase with in-file request
20+
21+
```yaml
22+
---
23+
version: 'default:testcase:0.7.2'
24+
25+
variables:
26+
Name: 'Morpheus'
27+
Job: 'leader'
28+
Response: ~
29+
Server: https://reqres.in/api/v1
30+
31+
request:
32+
url: "{$Server}/users"
33+
method: POST
34+
body[json]: {
35+
'name': $Name,
36+
'job': $Job,
37+
}
38+
return: ~
39+
40+
spec:
41+
execute:
42+
file: ~
43+
result: $Response
44+
45+
asserts:
46+
- {type: AssertEqual, actual: $Response.code, expected: 201}
47+
- {type: AssertIsMap, actual: $Response.body}
48+
```

0 commit comments

Comments
 (0)