Last active
March 12, 2024 07:12
-
-
Save up1/14763a5d50ffa1e7a5414e1a68f77577 to your computer and use it in GitHub Desktop.
Hello Bruno :: REST API testing
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
meta { | |
name: Get user detail | |
type: http | |
seq: 1 | |
} | |
get { | |
url: https://jsonplaceholder.typicode.com/users/1 | |
body: none | |
auth: none | |
} | |
tests { | |
test("1. Success", function() { | |
const data = res.getBody(); | |
expect(res.getStatus()).to.equal(200); | |
}); | |
test("2. should receive the token", function() { | |
const data = res.getBody(); | |
expect(data.username).to.be.a('string'); | |
expect(data.username).to.equal('Bret'); | |
}); | |
} |
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
// ติดตั้ง | |
$npm install -g @usebruno/cli | |
// ทำการ run แต่ละไฟล์ | |
$bru run 1.bru | |
Running Request | |
Get user detail (200 OK) - 224 ms | |
✓ 1. Success | |
✓ 2. should receive the token | |
Requests: 1 passed, 1 total | |
Tests: 2 passed, 2 total | |
Assertions: 0 passed, 0 total | |
Ran all requests - 224 ms | |
// ทำการ run ทั้ง folder | |
$bru run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment