- Support run test.js file or with folder
- Generate curl command from testcase
- Support debug request and response
- Support test api with http method
- Vscode extension (make easier to run testcase)
- Pre-request (setup, testcase)
- Post-response (setup, testcase)
- Build in function
- Support upload file
- Load env to test.js file
- Summary testcase report
- Export report
- JSON
- CSV
# Download the latest release for your platform
wget https://github.com/bakatest-me/tesuto/releases/download/v0.0.1/tesuto-darwin.tar.gz
# or other platform
# https://github.com/bakatest-me/tesuto/releases
# Extract the archive
tar -xzvf tesuto-darwin.tar.gz
# Move the tesuto binary to /usr/local/bin
sudo mv tesuto /usr/local/bin/tesuto
# Verify the installation
tesuto version
Run testcase file:
tesuto run example/get_user_by_id.js
Run testcases in folder:
tesuto run example/
- example/get_user_by_id.js
- example/query_user.js
- example/login.js
Mock api with mockoon file example/mockoon.json
for testing example files
- Create js file for test script
touch testcase/get_user_by_id.js
- Setup Object:
const baseURL = "http://localhost:8080";
const setup = {
url: `${baseURL}/api/v1/users/{id}`,
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer 1234567890",
},
};
The setup object contains the configuration for the HTTP request:
- url: The endpoint for fetching user data, where {id} is a placeholder for the user ID.
- method: Specifies that the request method is GET.
- headers: Sets the request headers, including the content type and an authorization token.
- Testcase Object:
var testcase = {
"should return 200": {
params: {
id: "1234567890",
},
expected: (res) => res.status === 200,
},
};
The testcase object contains the test cases:
- "should return 200": The name of the test case.
- params: The parameters for the test case.
- expected: The expected result of the test case.
Finally file:
const baseURL = "http://localhost:8080";
const setup = {
url: `${baseURL}/api/v1/users/{id}`,
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer 1234567890",
},
};
var testcase = {
"should return 200": {
params: {
id: "1234567890",
},
expected: (res) => res.status === 200,
},
};
- Run testcase:
tesuto run testcase/get_user_by_id.js
- params: params with replace
{key}
with value - query: will add to url as query string
?key=value
var testcase = {
"should return 200": {
params: {
id: "1234567890",
},
query: {
name: "book",
},
expected: (res) => res.status === 200,
},
};
tesuto run <testcase_file.js or directory>
show debug request and response
--debug
-d
generate curl command from testcase
--curl
-c
Reference:
- HTTP Request Resty for now use v3