C doctest 測試框架

2021-10-04 10:11:16 字數 955 閱讀 2053

doctest 是用過的最簡單好用的的單元測試框架, 只需要引用 乙個標頭檔案即可

#define doctest_config_implement_with_main

#include

"doctest.h"

intfactorial

(int number)

test_case

("testing the factorial function"

)

在函式 context 的run 執行的時候 會將所有 test_case 的巨集函式展開執行, 可以根據自己的情況安排測試

#define doctest_config_implement

#include

"doctest.h"

intmain

(int argc,

char

**ar**)

printf

("%s\n"

,"hello, world!");

system

("pause");

return0;

}int

factorial

(const

int number)

test_case

("testing the factorial function"

)

自己簡單使用的功能能夠使用了,

自己看到了 vczh 寫的乙個簡單的測試框架的實現, 了解原理,然後發現了這個c++庫, 真的很好用, 目前自己需要的功能夠用, 後續更過功能還要自己去啃 doctest 文件

但是感覺 googletest 提供的功能更多, 後續可能切換過去,

doctest 文件翻譯

doctest github 倉庫

doctest 官方例程

vczh 自定義測試框架實現

測試框架 Pytest框架(一)

目錄 pytest的安裝與執行 安裝 執行執行方式及命令 ide中執行 命令列終端執行 生成報告 報告中的亂碼處理 檢查點 斷言 基於python語言的自動化常用的框架有三種,unittest pytest rf。前兩款更多的用於白盒單元測試,rf可以很好的做系統測試使用。安裝pytest pip ...

測試框架簡介

1.linear 乙個automation test case只實現乙個manual test case,automation test case不能重用。測試資料也被hard code在automation test case裡.for example string username aaa st...

Spring測試框架

傳統測試存在的問題 1.每個測試都要重新啟動spring,啟動容器的開銷大,測試效率低下 2.不應該是測試 管理spring容器,應該是spring容器在管理測試 3.不能正常關閉spring容器,spring容器生命週期非正常退出 如何使用spring的測試框架 junit junit org.s...