-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ➖ remove register feature * 📚 update README content * 📚 add korean localisation * 💄 npx cli
- Loading branch information
Showing
9 changed files
with
105 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,50 @@ | ||
|
||
# pusakatest | ||
|
||
<img width="682" alt="image" src="https://user-images.githubusercontent.com/6134774/181021798-15d57ebd-63c2-4925-90cc-5ae607cd272b.png"> | ||
[![asciicast](https://asciinema.org/a/511165.svg)](https://asciinema.org/a/511165) | ||
|
||
## :bulb: how to use | ||
you can simply run this command | ||
## :gear: setup | ||
- make sure `nodejs` and `npm` is already installed. you can verify it using these commands | ||
```bash | ||
node -v | ||
``` | ||
```bash | ||
npm -v | ||
``` | ||
- you can create new folder/directory to setup `pusakatest` and don't forget to change the folder/directory location. for example | ||
```bash | ||
mkdir hello-pusakatest && cd hello-pusakatest | ||
``` | ||
- to setup `pusakatest`, you can simply run this command (and follow the instructions) | ||
```bash | ||
npx pusakatest | ||
``` | ||
nothing else after that, just run it! | ||
- nothing else after that, just run it! | ||
```bash | ||
npm run test | ||
``` | ||
- if you want to publish the file report to [Cucumber Reports](https://reports.cucumber.io), just use | ||
```bash | ||
npm run test-publish | ||
``` | ||
|
||
## :bulb: writing feature script | ||
- to create new feature script, just add `.feature` file under `/features` folder/directory | ||
- after that, just re-run it | ||
```bash | ||
npm run test | ||
``` | ||
- example: | ||
```gherkin | ||
Feature: API REQRES.IN | ||
Scenario: Get all users list on REQRES.IN API | ||
Given I make a "POST" request to "https://reqres.in/api/users" | ||
When I receive a response | ||
Then I expect response should have a status "200" | ||
``` | ||
|
||
## :bookmark: credits | ||
- [pactum-cucumber-boilerplate](https://github.com/pactumjs/pactum-cucumber-boilerplate) | ||
- [Dominik Kundel](https://www.twilio.com/blog/how-to-build-a-cli-with-node-js) | ||
- [old-README](https://github.com/depapp/pusakatest/tree/0af4d1c0a0ce712fd2380f8de50b1562134468e4#readme) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"default": { | ||
"language": "ko", | ||
"format": ["summary", "html:cucumber-report.html"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { request, settings } = require('pactum') | ||
const { Before } = require('@cucumber/cucumber') | ||
|
||
Before(() => { | ||
settings.setReporterAutoRun(false) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const pactum = require('pactum') | ||
const { Given, When, Then, Before, After } = require('@cucumber/cucumber') | ||
|
||
let spec = pactum.spec() | ||
|
||
Before(() => { | ||
spec = pactum.spec() | ||
}) | ||
|
||
Given(/^나는 만든다 "(.*)" 요청하다 "(.*)"$/, function (method, endpoint) { | ||
spec[method.toLowerCase()](endpoint) | ||
}) | ||
|
||
When('나는 응답을 받는다', async function () { | ||
await spec.toss() | ||
}) | ||
|
||
Then('응답에 상태가 있어야 합니다. "{int}"', function (code) { | ||
spec.response().should.have.status(code) | ||
}) | ||
|
||
After(() => { | ||
spec.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
기능: API REQRES.IN | ||
|
||
시나리오: 모든 사용자 목록 가져오기 API REQRES.IN | ||
조건 나는 만든다 "GET" 요청하다 "https://reqres.in/api/users" | ||
만일 나는 응답을 받는다 | ||
그러면 응답에 상태가 있어야 합니다. "200" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "pusakatest", | ||
"version": "2.0.1", | ||
"description": "pusakatest is an automation testing tool based on pactum using bdd (cucumber) style", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "cucumber-js --config config/cucumber.json", | ||
"test-publish": "cucumber-js --config config/cucumber.json --publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/depapp/pusakatest.git" | ||
}, | ||
"author": "@depapp", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/depapp/pusakatest/issues" | ||
}, | ||
"homepage": "https://github.com/depapp/pusakatest#readme", | ||
"devDependencies": { | ||
"@cucumber/cucumber": "^8.5.0", | ||
"@faker-js/faker": "^7.3.0", | ||
"mocha": "^10.0.0", | ||
"pactum": "^3.1.13" | ||
} | ||
} |