当前位置:网站首页>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/
边栏推荐
- In pgplsql: = and=
- 多线程&高并发(全网最新:面试题 + 导图 + 笔记)面试手稳心不慌
- Salesforce zero foundation learning (116) workflow - & gt; On flow
- 痞子衡嵌入式:MCUXpresso IDE下将源码制作成Lib库方法及其与IAR,MDK差异
- Where are MySQL version numbers 6 and 7?
- Qt项目-安防监控系统(各个界面功能实现)
- Notes of Teacher Li Hongyi's 2020 in-depth learning series 7
- 采坑记录:TypeError: 'module' object is not callable
- salesforce零基础学习(一百一十六)workflow -&gt; flow浅谈
- Collection of common online testing tools
猜你喜欢

Technical operation

芯片的功耗

Analysis of WPF multi finger application development

Notes of Teacher Li Hongyi's 2020 in-depth learning series 8

Add a little surprise to life and be a prototype designer of creative life -- sharing with X contestants in the programming challenge

Opengauss kernel analysis: query rewriting

Bug summary

Salesforce zero foundation learning (116) workflow - & gt; On flow

HLS编程入门

云计算三类巨头:IaaS、PaaS、SaaS,分别是什么意思,应用场景是什么?
随机推荐
Google Earth engine - the use of the neighborhood tobands function
Restructuredtext grammar summary for beginners
买收益百分之6的理财产品,需要开户吗?
这个月 google的“AI具备意识”的事件的想法
基于TensorFlow和Keras的卷积神经网络实现猫狗数据集分类实验
SQLite database operation
[Nuxt 3] (十)运行时配置
SQL rewriting Series 6: predicate derivation
Efficiency increased by 98%! AI weapon behind operation and maintenance inspection of high altitude photovoltaic power station
Shardingsphere database sub database sub table introduction
Entity service is an anti pattern
ES6 adds -iterator traversal, for..Of loop
Answers to some problems encountered in the process of Xperia XZ (f8332) brushing and root
Salesforce zero foundation learning (116) workflow - & gt; On flow
MATLAB basic grammar (II)
Pit record: typeerror:'module'object is not callable
多线程&高并发(全网最新:面试题 + 导图 + 笔记)面试手稳心不慌
Digital stopwatch based on Verilog HDL
Live broadcast preview | online seminar on open source security governance models and tools
Which securities account is the best and safest for beginners