diff --git a/docs/cn/MatrixOne/Test/mo-tester.md b/docs/cn/MatrixOne/Test/mo-tester.md index a52b04b02c05a76b69aaf5bce07b3c2c710e4446..492159e7a976d7a583c6778ea626655ce6e6d0a5 100644 --- a/docs/cn/MatrixOne/Test/mo-tester.md +++ b/docs/cn/MatrixOne/Test/mo-tester.md @@ -39,7 +39,7 @@ MO-Tester 娴嬭瘯鐢ㄤ緥濡備笅琛ㄦ墍绀猴細 * 璇峰厛纭宸插畨瑁� jdk8銆� -* 鍚姩 MatrixOne 鎴栧叾浠栨暟鎹簱鐢ㄤ緥銆傚弬瑙佹洿澶氫俊鎭� >>[瀹夎鍗曟満鐗� MatrixOne](https://docs.matrixorigin.io/0.5.0/MatrixOne/Get-Started/install-standalone-matrixone/). +* 鍚姩 MatrixOne 鎴栧叾浠栨暟鎹簱鐢ㄤ緥銆傚弬瑙佹洿澶氫俊鎭� >>[瀹夎鍗曟満鐗� MatrixOne](../Get-Started/install-standalone-matrixone.md). * 鍏嬮殕 MO-Tester 浠撳簱. @@ -49,7 +49,7 @@ MO-Tester 娴嬭瘯鐢ㄤ緥濡備笅琛ㄦ墍绀猴細 ## 2. 閰嶇疆 MO-Tester -MO-tester 鍩轰簬 Java 璇█杩涜寮€鍙戯紝鍥犳 JDBC 椹卞姩绋嬪簭闇€瑕侀厤缃弬鏁颁俊鎭細鎵撳紑 `mo.yml` 鏂囦欢锛岄厤缃湇鍔″櫒鍦板潃銆侀粯璁ょ殑鏁版嵁搴撳悕绉般€佺敤鎴峰悕鍜屽瘑鐮佺瓑銆� +MO-tester 鍩轰簬 Java 璇█杩涜寮€鍙戯紝鍥犳 Mo-tester 鎵€渚濊禆鐨� Java 鏁版嵁搴撹繛鎺ワ紙JDBC锛孞ava Database Connectivity锛� 椹卞姩绋嬪簭闇€瑕侀厤缃� *mo.yml* 鏂囦欢閲岀殑鍙傛暟淇℃伅锛氳繘鍏ュ埌 *mo-tester* 鏈湴浠撳簱锛屾墦寮€ *mo.yml* 鏂囦欢锛岄厤缃湇鍔″櫒鍦板潃銆侀粯璁ょ殑鏁版嵁搴撳悕绉般€佺敤鎴峰悕鍜屽瘑鐮佺瓑銆� 浠ヤ笅鏄湰鍦扮嫭绔嬬増鏈� MatrixOne 鐨勯粯璁ょず渚嬨€� @@ -79,42 +79,41 @@ MO-tester 鍩轰簬 Java 璇█杩涜寮€鍙戯紝鍥犳 JDBC 椹卞姩绋嬪簭闇€瑕侀厤缃� ## 3. 杩愯 MO-Tester -杩愯浠ヤ笅鎵€绀哄懡浠よ锛孲QL 鎵€鏈夋祴璇曠敤渚嬪皢鑷姩杩愯锛屽苟灏嗘姤鍛婂拰閿欒娑堟伅鐢熸垚鑷� `report/report.txt` 鍜� `report/error.txt` 鏂囦欢涓€� +杩愯浠ヤ笅鎵€绀哄懡浠よ锛孲QL 鎵€鏈夋祴璇曠敤渚嬪皢鑷姩杩愯锛屽苟灏嗘姤鍛婂拰閿欒娑堟伅鐢熸垚鑷� *report/report.txt* 鍜� *report/error.txt* 鏂囦欢涓€� ``` > ./run.sh ``` -濡傛灉浣犳兂璋冩暣娴嬭瘯鑼冨洿锛屼綘鍙互淇敼 `run.yml` 鏂囦欢涓殑 `path` 鍙傛暟銆傛垨鑰咃紝鍦ㄦ墽琛� `run.sh` 鍛戒护鏃讹紝浣犱篃鍙互鎸囧畾涓€浜涘弬鏁帮紝鍙傛暟濡備笅锛� +濡傛灉浣犳兂璋冩暣娴嬭瘯鑼冨洿锛屼綘鍙互淇敼 `run.yml` 鏂囦欢涓殑 `path` 鍙傛暟銆傛垨鑰咃紝鍦ㄦ墽琛� `run.sh` 鍛戒护鏃讹紝浣犱篃鍙互鎸囧畾涓€浜涘弬鏁帮紝鍙傛暟瑙i噴濡備笅锛� + +|鍙傛暟|鍙傛暟閲婁箟| +|---|---| +|-p|璁剧疆鐢� MO-tester 鎵ц鐨勬祴璇曠敤渚嬬殑璺緞銆傞粯璁ゅ€煎彲浠ュ弬瑙� *run.yml* 鏂囦欢涓� `path` 鐨勯厤缃弬鏁皘 +|-m|璁剧疆 MO-tester 娴嬭瘯鐨勬柟娉曪紝鍗崇洿鎺ヨ繍琛屾垨鑰呯敓鎴愭柊鐨勬祴璇曠粨鏋溿€傞粯璁ゅ€煎彲浠ュ弬瑙� *run.yaml* 鏂囦欢涓� `method` 鐨勯厤缃弬鏁皘 +|-t| 璁剧疆 MO-tester 鎵ц SQL 鍛戒护鐨勬牸寮忕被鍨嬨€傞粯璁ゅ€煎彲浠ュ弬瑙� *run.yml* 鏂囦欢涓� `type` 鐨勯厤缃弬鏁般€倈 +|-r| 璁剧疆娴嬭瘯鐢ㄤ緥搴旇杈惧埌鐨勬垚鍔熺巼銆傞粯璁ゅ€煎彲浠ュ弬瑙� *run.yml* 鏂囦欢涓� `rate` 鐨勯厤缃弬鏁般€倈 +|-i|璁剧疆鍖呭惈鍒楄〃锛屽彧鏈夎矾寰勪腑鍚嶇О鍖呭惈鍏朵腑涓€涓垪琛ㄧ殑鑴氭湰鏂囦欢灏嗚鎵ц锛屽鏋滄湁澶氫釜锛屽鏋滄病鏈夋寚瀹氾紝鐢�'锛�'鍒嗛殧锛屾寚鐨勬槸鍖呭惈鐨勬墍鏈夋儏鍐祍et the including list, and only script files in the path whose name contains one of the lists will be executed, if more than one, separated by `,`, if not specified, refers to all cases included| +|-e|璁剧疆鎺掗櫎鍒楄〃锛屽鏋滆矾寰勪笅鐨勮剼鏈枃浠剁殑鍚嶇О鍖呭惈涓€涓帓闄ゅ垪琛紝鍒欎笉浼氳鎵ц锛屽鏋滄湁澶氫釜锛岀敤'锛�'鍒嗛殧锛屽鏋滄病鏈夋寚瀹氾紝琛ㄧず涓嶆帓闄や换浣曟儏鍐祍et the excluding list, and script files in the path whose name contains one of the lists will not be executed, if more than one, separated by `,`, if not specified, refers to none of the cases excluded| +|-g|琛ㄧず甯︽湁[-- @bvt:issue#{issueNO.}]鏍囧織鐨� SQL 鍛戒护灏嗕笉浼氳鎵ц锛岃鏍囧織浠� [-- @bvt:issue#{issueNO.}]寮€濮嬶紝浠� [-- @bvt:issue]缁撴潫銆備緥濡傦紝<br>-- @bvt:issue#3236<br/><br>select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);<br/><br>select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);<br/><br>-- @bvt:issue<br/><br>杩欎袱涓� SQL 鍛戒护涓庨棶棰� #3236 鐩稿叧鑱旓紝瀹冧滑灏嗕笉浼氬湪 MO-tester 娴嬭瘯涓墽琛岋紝鐩村埌闂 #3236 淇鍚庢爣绛剧Щ闄ゆ墠鍙互鍦ㄦ祴璇曚腑鎵ц銆�<br/>| +|-n|琛ㄧず鍦ㄦ瘮杈冪粨鏋滄椂灏嗗拷鐣ョ粨鏋滈泦鐨勫厓鏁版嵁| + +**绀轰緥**锛� ``` --p set the path of test cases needed to be executed by mo-tester, the default value is configured by the `path` in `run.yaml` --m set the method that mo-tester will run with, the default value is configured by the `method` in `run.yaml` --t set the type of the format that mo-tester executes the SQL command in, the default value is configured by the `type` in `run.yaml` --r set The success rate that test cases should reach, the default value is configured by the `rate` in `run.yaml` --i set the including list, and only script files in the path whose name contains one of the lists will be executed, if more than one, separated by `,`, if not specified, refers to all cases included --e set the excluding list, and script files in the path whose name contains one of the lists will not be executed, if more than one, separated by `,`, if not specified, refers to none of the cases excluded --g means SQL commands which is marked with [bvt:issue] flag will not be executed,this flag starts with [-- @bvt:issue#{issueNO.}],and ends with [-- @bvt:issue],eg: - -- @bvt:issue#3236 - select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE); - select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH); - -- @bvt:issue - Those two sql commands are associated with issue#3236, and they will not be executed in bvt test, until the flag is removed when issue#3236 is fixed. - --n means the metadata of the resultset will be ignored when comparing the result -Examples: -bash run.sh -p case -m run -t script -r 100 -i select,subquery -e substring -g +./run.sh -p case -m run -t script -r 100 -i select,subquery -e substring -g ``` -濡傛灉浣犳兂娴嬭瘯鏂扮殑 SQL 鐢ㄤ緥骞惰嚜鍔ㄧ敓鎴� SQL 缁撴灉锛屼綘鍙渶瑕佸皢 `run` 涓殑 `method` 鍙傛暟 `yml` 淇敼涓� `genrs`銆傝繍琛� `run.sh` 鍚庯紝鍦╜result/` 璺緞涓嬪皢鐩存帴璁板綍娴嬭瘯缁撴灉鍙婂叾鍘熷鏂囦欢鍚嶃€� +濡傛灉浣犳兂娴嬭瘯鏂扮殑 SQL 鐢ㄤ緥骞惰嚜鍔ㄧ敓鎴� SQL 缁撴灉锛岃繍琛屽懡浠や腑鍙互灏� `-m run` 鏇存敼涓� `-m genrs`锛屾垨鑰呭皢 *run.yml* 鏂囦欢閲岀殑 `method` 鍙傛暟淇敼涓� `genrs`锛岀浉鍏崇ず渚嬪弬瑙�<p><a href="#new_test_scenario">绀轰緥 4</a></p> -娉ㄦ剰锛氭瘡娆¤繍琛� `run.sh` 閮戒細瑕嗙洊 `error.txt`銆乣report.txt` 鍜� `success.txt` 鎶ュ憡鏂囦欢銆� +!!! note + 姣忔杩愯 `./run.sh` 閮戒細瑕嗙洊 *report/* 璺緞涓� *error.txt*銆�*report.txt* 鍜� *success.txt* 鎶ュ憡鏂囦欢銆� ## 4. 鏌ョ湅娴嬭瘯鎶ュ憡 -娴嬭瘯瀹屾垚鍚庯紝MO-Tester 鐢熸垚 `error.txt`锛宍report.txt` 鍜� `success.txt` 鎶ュ憡鏂囦欢銆� +娴嬭瘯瀹屾垚鍚庯紝MO-Tester 鐢熸垚 *error.txt*銆�*report.txt* 鍜� *success.txt* 鎶ュ憡鏂囦欢銆� -* `report.txt` 绀轰緥濡備笅锛� +* *report.txt* 绀轰緥濡備笅锛� ``` [SUMMARY] TOTAL : 486, SUCCESS : 486, ERROR :0, NOEXE :0, SUCCESS RATE : 100% @@ -124,7 +123,7 @@ bash run.sh -p case -m run -t script -r 100 -i select,subquery -e substring -g [cases/transaction/isolation_1.sql] TOTAL : 217, SUCCESS : 217, ERROR :0, NOEXE :0, SUCCESS RATE : 100% ``` -* `error.txt` 绀轰緥濡備笅锛� +* *error.txt* 绀轰緥濡備笅锛� ``` [ERROR] @@ -139,3 +138,126 @@ c d c d 1 1 ``` + +## 5. 娴嬭瘯绀轰緥 + +### 绀轰緥 1 + +**绀轰緥鎻忚堪**锛氳繍琛� *mo-tester* 浠撳簱鍐呯殑 */cases* 璺緞涓嬬殑鎵€鏈夋祴璇曠敤渚嬨€� + +**姝ラ**锛� + +1. 鎷夊彇鏈€鏂扮殑 *mo-tester* 杩滅浠撳簱銆� + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. 杩愯濡備笅鍛戒护锛屽嵆杩愯 *mo-tester* 浠撳簱鍐呮墍鏈夌殑娴嬭瘯鐢ㄤ緥锛� + + ``` + ./run.sh + ``` + +3. 鍦� *report/* 璺緞涓嬬殑 *error.txt*銆�*report.txt* 鍜� *success.txt* 鎶ュ憡鏂囦欢涓煡鐪嬭繍琛岀粨鏋溿€� + +### 绀轰緥 2 + +**绀轰緥鎻忚堪**锛氳繍琛� *mo-tester* 浠撳簱鍐� */cases/transaction/* 璺緞涓嬬殑娴嬭瘯鐢ㄤ緥銆� + +**姝ラ**锛� + +1. 鎷夊彇鏈€鏂扮殑 *mo-tester* 杩滅浠撳簱銆� + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. 杩愯濡備笅鍛戒护锛屽嵆杩愯 *mo-tester* 浠撳簱鍐� *cases/transaction/* 璺緞鐨勬墍鏈夋祴璇曠敤渚嬶細 + + ``` + ./run.sh -p cases/transaction/ + ``` + +3. 鍦� *report/* 璺緞涓嬬殑 *error.txt*銆�*report.txt* 鍜� *success.txt* 鎶ュ憡鏂囦欢涓煡鐪嬭繍琛岀粨鏋溿€備緥濡傦紝棰勬湡 *report.txt* 鎶ュ憡濡備笅鎵€绀猴細 + + ``` + [SUMMARY] TOTAL : 486, SUCCESS : 486, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/atomicity.sql] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/isolation.sql] TOTAL : 202, SUCCESS : 202, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/isolation_1.sql] TOTAL : 217, SUCCESS : 217, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + ``` + +### 绀轰緥 3 + +**绀轰緥鎻忚堪**锛氳繍琛� *mo-tester* 浠撳簱鍐� *cases/transaction/atomicity.sql* 鍗曚釜娴嬭瘯鐢ㄤ緥銆� + +**姝ラ**锛� + +1. 鎷夊彇鏈€鏂扮殑 *mo-tester* 杩滅浠撳簱銆� + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. 杩愯濡備笅鍛戒护锛屽嵆杩愯 *mo-tester* 浠撳簱鍐� *cases/transaction/atomicity.sql* 娴嬭瘯鐢ㄤ緥锛� + + ``` + ./run.sh -p cases/transaction/atomicity.sql + ``` + +3. 鍦� *report/* 璺緞涓嬬殑 *error.txt*銆�*report.txt* 鍜� *success.txt* 鎶ュ憡鏂囦欢涓煡鐪嬭繍琛岀粨鏋溿€備緥濡傦紝棰勬湡 *report.txt* 鎶ュ憡濡備笅鎵€绀猴細 + + ``` + [SUMMARY] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/atomicity.sql] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + ``` + +### <h3><a name="new_test_scenario">绀轰緥 4</a></h3> + +**绀轰緥鎻忚堪**锛� + +- 鏂板缓涓€涓懡鍚嶄负 *local_test* 鐨勬枃浠跺す锛屾斁鍦� */cases* 鐩綍涓� +- 鏈湴鏂板涓€涓懡鍚嶄负娴嬭瘯鏂囦欢 *new_test.sql*锛屾斁鍦� *cases/local_test/* 璺緞涓� +- 浠呮兂瑕佽繍琛� *new_test.sql** 娴嬭瘯鐢ㄤ緥 + +**姝ラ** + +1. 鎷夊彇鏈€鏂扮殑 *mo-tester* 杩滅浠撳簱銆� + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. 鐢熸垚娴嬭瘯缁撴灉锛� + + - 鏂瑰紡 1锛氳繍琛屽涓嬪懡浠わ紝鐢熸垚娴嬭瘯缁撴灉銆� + + ``` + ./run.sh -p cases/local_test/new_test.sql -m genrs -g + ``` + + - 鏂瑰紡 2锛氭墦寮€ *run.yml* 鏂囦欢锛屽厛灏� *method* 鍙傛暟鐢遍粯璁ょ殑 `run` 淇敼涓� `genrs`锛屽啀杩愯濡備笅鍛戒护锛岀敓鎴愭祴璇曠粨鏋溿€� + + ``` + ./run.sh -p cases/local_test/new_test.sql + ``` + +3. 鍦� *result/* 璺緞涓嬫煡鐪� *local_test/new_test.result* 缁撴灉銆� + +4. 杩愯濡備笅鍛戒护锛屽嵆杩愯 *mo-tester* 浠撳簱鍐� *cases/local_test/new_test.sql* 娴嬭瘯鐢ㄤ緥锛� + + ``` + ./run.sh -p cases/local_test/new_test.sql -m run -g + ``` + +4. 鍦� *report/* 璺緞涓嬬殑 *error.txt*銆�*report.txt* 鍜� *success.txt* 鎶ュ憡鏂囦欢涓煡鐪嬭繍琛岀粨鏋溿€備緥濡傦紝*report.txt* 涓粨鏋滃涓嬫墍绀猴細 + + ``` + [SUMMARY] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/local_test/new_test.sql] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + ``` diff --git a/docs/en/MatrixOne/Test/mo-tester.md b/docs/en/MatrixOne/Test/mo-tester.md index a449f6cb318bc6abb96a6a31479741b1d448b9fc..d4f04625326b5b02f1b60c25be7a0f44a74975c9 100644 --- a/docs/en/MatrixOne/Test/mo-tester.md +++ b/docs/en/MatrixOne/Test/mo-tester.md @@ -39,7 +39,7 @@ MO-Tester includes testing cases in the following table. * Make sure you have installed jdk8. -* Launch MatrixOne or other database instance. Please refer to more information about [how to install and launch MatrixOne](https://docs.matrixorigin.io/0.5.0/MatrixOne/Get-Started/install-standalone-matrixone/). +* Launch MatrixOne or other database instance. Please refer to more information about [how to install and launch MatrixOne](../Get-Started/install-standalone-matrixone/). * Clone `mo-tester` repository. @@ -49,7 +49,7 @@ MO-Tester includes testing cases in the following table. ## 2. Configure `mo-tester` -* In `mo.yml` file, configure the server address, default database name, username&password, etc. MO-tester is based on java, so these parameters are required for the JDBC driver. Below is a default example for a local standalone version MatrixOne. +* In `mo.yml` file, configure the server address, default database name, username, and password, etc. MO-tester is based on java, so these parameters are required for the JDBC(JDBC锛孞ava Database Connectivity) driver. Below is a default example for a local standalone version MatrixOne. ``` #jdbc @@ -77,42 +77,41 @@ MO-Tester includes testing cases in the following table. ## 3. Run mo-tester -* With the simple below command, all the SQL test cases will automatically run and generate reports and error messages to `report/report.txt` and `report/error.txt`. +* With the simple below command, all the SQL test cases will automatically run and generate reports and error messages to *report/report.txt* and *report/error.txt*. ``` > ./run.sh ``` -If you'd like to adjust the test range, you can just change the `path` parameter of `run.yml`. And you can also specify some parameters when executing the command `run.sh`, parameters are as followings: +If you'd like to adjust the test range, you can just change the `path` parameter of `run.yml`. And you can also specify some parameters when executing the command `run.sh`, parameters are as followings: + +|Parameters|Description| +|---|---| +|-p|set the path of test cases needed to be executed by mo-tester, the default value is configured by the `path` in `run.yaml`| +|-m|set the method that mo-tester will run with, the default value is configured by the `method` in `run.yaml`| +|-t| set the type of the format that mo-tester executes the SQL command in, the default value is configured by the `type` in `run.yaml`| +|-r|set The success rate that test cases should reach, the default value is configured by the `rate` in `run.yaml`| +|-i|set the including list, and only script files in the path whose name contains one of the lists will be executed, if more than one, separated by `,`, if not specified, refers to all cases included| +|-e|set the excluding list, and script files in the path whose name contains one of the lists will not be executed, if more than one, separated by `,`, if not specified, refers to none of the cases excluded| +|-g|means SQL commands which is marked with [bvt:issue] flag will not be executed,this flag starts with [-- @bvt:issue#{issueNO.}],and ends with [-- @bvt:issue],eg:<br>-- @bvt:issue#3236<br/><br>select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);<br/><br>select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);<br/><br>-- @bvt:issue<br/><br>Those two sql commands are associated with issue#3236, and they will not be executed in bvt test, until the flag is removed when issue#3236 is fixed.<br/>| +|-n|means the metadata of the resultset will be ignored when comparing the result| + +**Examples**: ``` --p set the path of test cases needed to be executed by mo-tester, the default value is configured by the `path` in `run.yaml` --m set the method that mo-tester will run with, the default value is configured by the `method` in `run.yaml` --t set the type of the format that mo-tester executes the SQL command in, the default value is configured by the `type` in `run.yaml` --r set The success rate that test cases should reach, the default value is configured by the `rate` in `run.yaml` --i set the including list, and only script files in the path whose name contains one of the lists will be executed, if more than one, separated by `,`, if not specified, refers to all cases included --e set the excluding list, and script files in the path whose name contains one of the lists will not be executed, if more than one, separated by `,`, if not specified, refers to none of the cases excluded --g means SQL commands which is marked with [bvt:issue] flag will not be executed,this flag starts with [-- @bvt:issue#{issueNO.}],and ends with [-- @bvt:issue],eg: - -- @bvt:issue#3236 - select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE); - select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH); - -- @bvt:issue - Those two sql commands are associated with issue#3236, and they will not be executed in bvt test, until the flag is removed when issue#3236 is fixed. - --n means the metadata of the resultset will be ignored when comparing the result -Examples: -bash run.sh -p case -m run -t script -r 100 -i select,subquery -e substring -g +./run.sh -p case -m run -t script -r 100 -i select,subquery -e substring -g ``` -If you want to automatically generate SQL results for the new SQL cases, you can just change the `method` parameter of `run.yml` to `genrs`. Running the `run.sh` scripts will directly record test results in the `result/` path with their original filenames. +If you want to automatically generate SQL results for the new SQL cases, you can just change the `method` parameter of `run.yml` file to `genrs`, or you can just change the command `-m run` to `-m genrs`. Running the `run.sh` scripts will directly record test results in the `result/` path with their original filenames. For more information on example, see <a href="#new_test_scenario">Example 4</a>. -Note: every time running `run.sh` will overwrite the `error`, `report`, and `success` reports. +!!! note + Every time running `run.sh` will overwrite the report of the *error.txt* file, *report.txt* file, and *success.txt* file. ## 4. Check the report -* Once the test is finished, `mo-tester` generates `error`, `report` and `success` reports in `txt` format. +* Once the test is finished, *mo-tester* generates *error.txt* file, *report.txt* file and *success.txt* file reports . -* An example of `report.txt` looks like this: +* An example of *report.txt* file looks like this: ``` [SUMMARY] TOTAL : 486, SUCCESS : 486, ERROR :0, NOEXE :0, SUCCESS RATE : 100% @@ -122,7 +121,7 @@ Note: every time running `run.sh` will overwrite the `error`, `report`, and `suc [cases/transaction/isolation_1.sql] TOTAL : 217, SUCCESS : 217, ERROR :0, NOEXE :0, SUCCESS RATE : 100% ``` -* An example of `error.txt` looks like this: +* An example of *error.txt* file looks like this: ``` [ERROR] @@ -137,3 +136,126 @@ c d c d 1 1 ``` + +## 5. Test Examples + +### Example 1 + +**Example Description**: Run all test cases in the */cases* path of the *mo-tester* repository. + +**Steps**: + +1. Get the latest *mo-tester* code. + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. To run all the test cases of the *mo-tester* repository, see the following commands: + + ``` + ./run.sh + ``` + +3. Check the result reports in the *error.txt* file, *report.txt* file, and *success.txt* file in the *report/* path. + +### Example 2 + +**Example Description**: Run the test cases in the */cases/transaction/* path of the *mo-tester* repository. + +**Steps**: + +1. Get the latest *mo-tester* code. + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. To run the test cases in the *cases/transaction/* path of the *mo-tester* repository, see the following commands: + + ``` + ./run.sh -p cases/transaction/ + ``` + +3. Check the result reports in the *error.txt* file, *report.txt* file, and *success.txt* file in the *report/* path. The example of the expected *report.txt* looks like this: + + ``` + [SUMMARY] TOTAL : 486, SUCCESS : 486, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/atomicity.sql] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/isolation.sql] TOTAL : 202, SUCCESS : 202, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/isolation_1.sql] TOTAL : 217, SUCCESS : 217, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + ``` + +### Example 3 + +**Example Description**: Run the single test case *cases/transaction/atomicity.sql*. + +**Steps**: + +1. Get the latest *mo-tester* code. + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. To run the test cases *cases/transaction/atomicity.sql*, see the following commands: + + ``` + ./run.sh -p cases/transaction/atomicity.sql + ``` + +3. Check the result reports in the *error.txt* file, *report.txt* file, and *success.txt* file in the *report/* path. The example of the expected *report.txt* looks like this: + + ``` + [SUMMARY] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/transaction/atomicity.sql] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + ``` + +### <h3><a name="new_test_scenario">Example 4</a></h3> + +**Example Description**: + +- Create a new folder named *local_test* and place it in */cases* +- Add a test file named *new_test.sql* to *cases/local_test/* +- Only run the single test case *new_test.sql** + +**Steps** + +1. Get the latest *mo-tester* code. + + ``` + cd mo-tester + git pull https://github.com/matrixorigin/mo-tester.git + ``` + +2. Generate test results: + + - Method 1: To generate the test result, run the following command. + + ``` + ./run.sh -p cases/local_test/new_test.sql -m genrs -g + ``` + + - Method 2: Open the *run.yml* file, change the *method* parameter from the default `run` to `genrs`, and run the following command to generate the test result. + + ``` + ./run.sh -p cases/local_test/new_test.sql + ``` + +3. Check the result file in the *result/* path. + +4. To run the test cases *cases/local_test/new_test.sql*, see the following commands: + + ``` + ./run.sh -p cases/local_test/new_test.sql -m run -g + ``` + +4. Check the result reports in the *error.txt* file, *report.txt* file, and *success.txt* file in the *report/* path. The example of the expected *report.txt* looks like this: + + ``` + [SUMMARY] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + [cases/local_test/new_test.sql] TOTAL : 67, SUCCESS : 67, ERROR :0, NOEXE :0, SUCCESS RATE : 100% + ```