当前位置:网站首页>1. Smoke test
1. Smoke test
2022-07-24 23:48:00 【Clean night mortal dust】
Introduce
have access to k6 Perform multiple types of tests , Each type has different uses .

Each type of test is designed to give you different insights into the system :
Smoke Test The function of is to verify whether your system can handle the minimum load , No problem .
The load test It mainly involves evaluating the performance of the system in terms of concurrent users or requests per second .
Stress test and peak test It involves evaluating the limit and stability of the system under extreme conditions .
Soak Test It can let you know the reliability and performance of the system in a long time .
The important thing to understand is , Each test can be executed using the same test script . You can write a script and use it to perform all the above tests . The only change is the test configuration , Logic remains unchanged .
Different test types will teach you different knowledge about the system , And provide you with the insight you need to understand or optimize performance .
Smoke testing
smoke test It's a routine load test , Configured for minimum load . Every time you write a new script or modify an existing script , You all want to run smoke test As an integrity check .
You want to run smoke test With :
Verify that your test script has no errors .
Verify that your system will not cause any errors under minimum load .
k6 Run simple somke test
import http from 'k6/http';
import {
check, group, sleep, fail } from 'k6';
export let options = {
vus: 1, // 1 A user cycle 1 minute
duration: '1m',
thresholds: {
http_req_duration: ['p(99)<1500'], // 99% Your request must be in 1.5 seconds
},
};
const BASE_URL = 'https://test-api.k6.io';
const USERNAME = 'TestUser';
const PASSWORD = 'SuperCroc2020';
export default () => {
let loginRes = http.post(`${
BASE_URL}/auth/token/login/`, {
username: USERNAME,
password: PASSWORD,
});
check(loginRes, {
'logged in successfully': (resp) => resp.json('access') !== '',
});
let authHeaders = {
headers: {
Authorization: `Bearer ${
loginRes.json('access')}`,
},
};
let myObjects = http.get(`${
BASE_URL}/my/crocodiles/`, authHeaders).json();
check(myObjects, {
'retrieved crocodiles': (obj) => obj.length > 0 });
sleep(1);
};
If your smoke test produces any errors , You must correct the script or repair your environment , Before we can continue .
The output is as follows :

Once your smoke Test display 0 A mistake , As shown in the screenshot above , You can go to the next step and execute The load test To evaluate the performance of the system
Refer to official documentation
Official document address : https://k6.io/docs/
边栏推荐
- With screen and nohup running, there is no need to worry about deep learning code anymore | exiting the terminal will not affect the operation of server program code
- 基于FPGA的VGA显示
- Use of serial queues
- How to put long links into Excel
- Analysis of WPF multi finger application development
- Shell调试Debug的三种方式
- cloud chart
- Qt | 事件系统 QEvent
- Mandatory interview questions: 1. shallow copy and deep copy_ Shallow copy
- Do you need to open an account to buy a wealth management product with a 6% income?
猜你喜欢

给生活加点惊喜,做创意生活的原型设计师丨编程挑战赛 x 选手分享

郑慧娟:基于统一大市场的数据资产应用场景与评估方法研究

How to put long links into Excel

JDBC 驱动升级到 Version 8.0.28 连接 MySQL 的踩坑记录

做一个文艺的测试/开发程序员,慢慢改变自己......

Architecture design of multi live shopping mall

谢振东:公共交通行业数字化转型升级的探索与实践

来自大佬洗礼!2022 头条首发纯手打 MySQL 高级进阶笔记, 吃透 P7 有望

Implementation of cat and dog data set classification experiment based on tensorflow and keras convolutional neural network

Notes of Teacher Li Hongyi's 2020 in-depth learning series 7
随机推荐
ShardingSphere-数据库分库分表简介
SQLite database operation
网上怎么炒股手机上炒股安全吗
Mandatory interview questions: 1. shallow copy and deep copy_ Deep copy
I'd like to ask if the table creation DDL of ODPs can't be directly executed in MySQL. The string type is incompatible. Can you only adjust this by yourself
yolov5
痞子衡嵌入式:MCUXpresso IDE下将源码制作成Lib库方法及其与IAR,MDK差异
Do you need to open an account to buy a wealth management product with a 6% income?
Vite3.0 has been released, can you still roll it (list of new features)
Be an artistic test / development programmer and slowly change yourself
[nuxt 3] (x) runtime configuration
How to propose effective solutions for high-end products? (1 methodology + 2 cases + 1 List)
Notes of Teacher Li Hongyi's 2020 in-depth learning series 7
JS ------ Chapter 5 functions and events
Implementation of cat and dog data set classification experiment based on tensorflow and keras convolutional neural network
多线程&高并发(全网最新:面试题 + 导图 + 笔记)面试手稳心不慌
Processing PDF and JPG files in VB6
郑慧娟:基于统一大市场的数据资产应用场景与评估方法研究
salesforce零基础学习(一百一十六)workflow -&gt; flow浅谈
Is it safe for Guosen Securities to open a mobile account