Skip to content

Commit 9df6649

Browse files
committed
Readme (#14)
* tweak readme * jitpack * Update README
1 parent 1bb0f76 commit 9df6649

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

.sdkmanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Enable auto-env through the sdkman_auto_env config
22
# Add key=value pairs of SDKs to use below
33
java=21.0.1-tem
4-
maven=3.9.5
4+
maven=3.9.9

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,58 @@
11
# Playtest2
22

3-
[![Tests](https://github.com/uzabase/playtest2/actions/workflows/test.yaml/badge.svg)](https://github.com/uzabase/playtest2/actions/workflows/test.yaml)
3+
[![Tests](https://github.com/uzabase/playtest2/actions/workflows/test.yaml/badge.svg)](https://github.com/uzabase/playtest2/actions/workflows/test.yaml)
44
[![JitPack](https://jitpack.io/v/uzabase/playtest2.svg)](https://jitpack.io/#uzabase/playtest2)
5+
[![Maven Central Version](https://img.shields.io/maven-central/v/com.uzabase.playtest2/playtest2)](https://central.sonatype.com/artifact/com.uzabase.playtest2/playtest2)
6+
7+
## Installation
8+
9+
テストプロジェクトに必要な依存関係を記述します。Playtest2では、現在以下のモジュールを提供しています。
10+
11+
| モジュール名 | 必須 | 説明 |
12+
|-------------------|-----|---------------------------------------|
13+
| playtest-core | [x] | Playtest2の設定やアサーションのためのモジュール |
14+
| playtest-http | [ ] | HTTPリクエストを送信して、レスポンスを検証可能にするモジュール |
15+
| playtest-wiremock | [ ] | WireMockを使って外部APIへのリクエストを検証可能にするモジュール |
16+
17+
## Usage
18+
19+
Playtest2では設定のためのDSLを提供しています。`playtest2`関数に各モジュールが提供する設定関数(`http`, `wireMock`など)で設定を追加していくことで、Playtest2が提供するステップを利用することができるようになります。
20+
21+
```kotlin
22+
import com.uzabase.playtest2.core.config.Configuration.Companion.playtest2
23+
import com.uzabase.playtest2.core.config.plus
24+
import com.uzabase.playtest2.http.config.http
25+
import com.uzabase.playtest2.wiremock.config.wireMock
26+
27+
class Hooks {
28+
@BeforeSuite
29+
fun beforeSuite() {
30+
playtest2 {
31+
http(URI("http://localhost:8080").toURL()) +
32+
wireMock("InnerAPI", URI("http://localhost:3000").toURL())
33+
}
34+
}
35+
}
36+
```
37+
38+
Playtest2が提供するステップを利用すると以下のようにGaugeのスペック(`.spec`)を記述することができます。
39+
40+
```example.spec
41+
## /pingに対するテスト
42+
* パス"/ping"
43+
* メソッド"GET"
44+
* メディアタイプ"application/json"
45+
* リクエストを送る
46+
* レスポンスのステータスコードが
47+
* 整数値の"200"である
48+
```
49+
50+
Gaugeのコンセプト(`.cpt`)に利用することもできます。
51+
52+
```example.cpt
53+
# GETメソッドでパス<path>にリクエストを送る
54+
* パス<path>に
55+
* メソッド"GET"で
56+
* メディアタイプ"application/json"で
57+
* リクエストを送る
58+
```

examples/simple-api-test/src/test/kotlin/Steps.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Steps {
1515
fun beforeSuite() {
1616
playtest2 {
1717
http(URI("http://localhost:8080").toURL()) +
18-
wireMock("InnerAPI", URI("http://localhost:3000").toURL())
18+
wireMock("InnerAPI", URI("http://localhost:3000").toURL())
1919
}
2020
App.startServer()
2121
innerApi.start()

jitpack.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
before_install:
2+
- sdk e install

0 commit comments

Comments
 (0)