Grillon - API 測試框架
-
優雅、直觀和富有表現力的 API
-
內置測試功能
-
支持擴展
用法:
use grillon::{dsl::*, dsl::*, json, Grillon, StatusCode, Result}; use grillon::{HeaderValue, CONTENT_LENGTH, CONTENT_TYPE}; #[tokio::test] async fn end_to_end_test() -> Result<()> { Grillon::new("https://jsonplaceholder.typicode.com")? .post("posts") .payload(json!({ "title": "foo", "body": "bar", "userId": 1 })) .assert() .await .status(is_success()) .status(is(201)) .response_time(is_less_than(700)) .json_body(is(json!({ "id": 101, }))) .json_body(schema(json!({ "properties": { "id": { "type": "number" } } }))) .json_path("$.id", is(json!(101))) .headers(contains(vec![ ( CONTENT_TYPE, HeaderValue::from_static("application/json; charset=utf-8"), ), (CONTENT_LENGTH, HeaderValue::from_static("15")), ])) .assert_fn(|assert| { assert!(!assert.headers.is_empty()); assert!(assert.status == StatusCode::CREATED); assert!(assert.json.is_some()); println!("Json response : {:#?}", assert.json); }); Ok(()) }
qcd - 快速切換目錄
qcd是一個Linux工具,有助于提高命令行的效率。
切換目錄
qcd ENTRY [-n] Chdir to path with idx or alias ENTRY (w/o -n: adds work dir to stack) qcd -o (pop) Chdir to top of stack, remove that entry from stack
添加或刪除入口
qcd -a PATH [-i IDX] [-s ALIAS] Add PATH to database qcd -p [-i IDX] [-s ALIAS] Add current working directory to database qcd -r ENTRY Remove row with idx or alias ENTRY qcd -u (push) Add current working directory to (top of) stack
審核編輯:湯梓紅
-
測試
+關注
關注
8文章
4517瀏覽量
125219 -
Linux
+關注
關注
87文章
11004瀏覽量
206867 -
API
+關注
關注
2文章
1398瀏覽量
61034
原文標題:【Rust日報】2023-09-06 Grillon - API 測試框架
文章出處:【微信號:Rust語言中文社區,微信公眾號:Rust語言中文社區】歡迎添加關注!文章轉載請注明出處。
發布評論請先 登錄
相關推薦
評論