Tasty® handles 2 types of tests: functional and load. In the functional type of tests you scrupulosly write all the cases to check whether the functionality of your designed API matches all the requirements you have. However, when you write load tests, you just bother about how your API performs under high load and how it does handle requests under such pressure. So, in load tests you just care about load scenarios, while when doing functional tests, you care about all the cases covering all the functions of API. Let's have a look at load testing first. Designed as a lighter "alternative" to functional tests, it provides all the statistics for...
- Overall structure of tests in channel
- Detailed structure of tests in channel
- Application declaration block
- Test description
- Services configuration
- Additional libraries
- Other files and folders
- Quick start
- 8.1
The structure of your project inside the channel application should look like this:
\---tasty
+---app (1)
| \---endpoint_test
+---artillery_report (2)
+---libs (3)
+---services (4)
| \---static_service
\---test (5)
+---func
\---load
It's not mandatory to call the folder "tasty", the name can be any. It is convenient to place tests project folder inside of your channel's folder.
- The app folder contains the declaration block for your tests, no matter they are functional or load;
- artillery_report is a temporary folder for load tests' output files;
- libs folder contains the necessary libraries for your test project
- services directory contains all the static config data for the outer services that you will execute during the tests(e.g. headers for yandex.weather, google.maps, etc.)
- test - main project folder containing functional and load tests
tasty
│ artilleryConfig.js
│ artilleryConfigFinal.json
│ index.js
│ package.json
├───app
│ | index.js
│ ├───endpoint1
│ | index.js
│ |
│ └───endpoint2
│ index.js
│
├───artillery_report
│ ._load.tmp.output.json
│ ._load.tmp.output.json.html
│
├───libs
│ log.js
│
├───services
│ | index.js
│ |
│ ├───service1
│ | index.js
│ |
│ └───service2
│ index.js
└───test
├───func
| ├───endpoint1_func_test
| | index.js
| |
| └───endpoint2_func_test
| index.js
|
└───load
└───endpoint1_load_test
index.js
Let's have a look at first folder of index: App
app
│ index.js (1)
│
├───endpoint1 (2)
│ index.js (3)
│
└───endpoint2
index.js- index.js contains all the necessary settings for configuring the application environment;
- The folder containing declarations for the endpoints, for convenience, called the same as your endpoints;
- index.js represents the file containing the code for tests' declarations.
For more information see App declaration and index
Another important folder to execute is ./test
test
├───func (1)
│ ├───endoint1 (3)
│ │ index.js (4)
│ │
│ └───endpoint2
│ index.js
│
└───load (2)
├───endpoint1
│ index.js
│
└───endpoint2
index.js
- Functional tests folder;
- Load tests folder;
- Custom endpoint folder. Contains file or files that logically match one single endpoint testing procedure;
- Single file or a bunch of files containing functionality of single endpoint test.
The test folder contains 2 subfolders for load and functional testing, each of which contains subfolders containing scripts defining scenarios of testing.
- get all the products and check whether the response matches required pattern
- request to the service
- check the response for correct structure
- login
- get all the products
- add product to the cart
- checkout For more information see Test description
services
│ | index.js
│ |
│ ├───service1
│ | index.js
│ |
│ └───service2
│ index.js
│
└───libs
log.jstasty
│ index.js (1)
│ package.json (2)
│ artilleryConfig.js (3)
│ artilleryConfigFinal.json (4)- index.js contains
- artilleryConfig.js is a basic configuration for load tests, that contains the target, phases of load test, network settings, etc.
module.exports = {
config: {
target: "/",
tls: {
rejectUnauthorized: false
},
http: {
timeout: 10
},
phases: [{
duration: 5,
arrivalRate: 3
}]
}
};##Structure of load tests
Each channel should have a folder with tests The structure of tests
###Declarations block