Qt Testlib 基本使用 2

2021-06-20 00:18:32 字數 1025 閱讀 3297

資料驅動測試,在乙個測試用例上新增多個資料,執行多次的測試用例。

新增一組資料:

qcompare(qstring

("hello").toupper(),

qstring

("hello"));

qcompare(qstring

("hello").toupper(),

qstring

("hello"));

qcompare(qstring

("hello").toupper(),

qstring

("hello"));

這組資料都會呼叫同 乙個測試用例。

qt testlib 提供很簡單的新增資料方式,只需要在class 中多定義乙個 private slot,

並且函式的名字與test case 的名字相同,然後在函式結尾處+ _data, 表示這是乙個新增資料的函式。

class

testqstring

:public

qobject

;

測試資料會以類似**的方式儲存,下面就是建立這個資料**

void

testqstring

::toupper_data

()

新增資料之後的結果示意圖如下:
index

name

string

result

0all lower

"hello"

hello

1mixed

"hello"

hello

2all

upper

"hello"

hello

void

testqstring

::toupper

()

RxJava基本使用2

map變換操作符 將傳送的資料按指定的函式去變化 例子 observable.create new observableonsubscribe map new function subscribe new consumer flatmap變換操作符 將傳送的事件分解成多個事件後發送回接收方 注意 f...

Node基本API使用2

fs.createreadstream path options fs.createwritestream path options const path require path const fs require fs let spath path.join dirname,03 source f...

pm2基本使用

pm2官方文件 pm2是極其強大的程序管理工具,可以託管各種程式,豐富的環境日誌部署能力。這裡只記錄本專案中使用的功能。npm install g pm2 pm2 stop all 停止所有 pm2 restart all 重啟所有 pm2 list 檢視所有服務情況 pm2 logs 檢視所有日誌...