diff --git a/demo/lang/bat/1_string_match.bat b/demo/lang/bat/1_string_match.bat index fd9606f8d8b69538421ab709cadc2d39ea9e550f..7ab383f3595d26e73d13d85a8829c9abe9b3f89a 100644 --- a/demo/lang/bat/1_string_match.bat +++ b/demo/lang/bat/1_string_match.bat @@ -1,19 +1,18 @@ @echo off goto start [case] - title=check string matches pattern cid=0 pid=0 [group] -1. exactly match >> hello -2. regular expression match >> 1[0-9]{10} -3. format string match >> %s%d + 1. exactly match >> hello + 2. regular expression match >> 1[0-9]{10} + 3. format string match >> %s%d [esac] :start echo ^>^> hello echo ^>^> 13905120512 -echo ^>^> abc123 +echo ^>^> abc123 \ No newline at end of file diff --git a/demo/lang/bat/2_webpage_extract.bat b/demo/lang/bat/2_webpage_extract.bat index 3f6fc2752a7c5b2ecb13ecf48e03ce027feffd39..f3d05e51b32293c2997f106caff92fea91e5e735 100644 --- a/demo/lang/bat/2_webpage_extract.bat +++ b/demo/lang/bat/2_webpage_extract.bat @@ -2,15 +2,14 @@ setlocal enabledelayedexpansion goto start [case] - title=extract content from webpage cid=0 pid=0 [group] -1. Load web page from url http://xxx -2. Retrieve img element zt-logo.png in html -3. Check img exist >> .*zt-logo.png + 1. Load web page from url http://xxx + 2. Retrieve img element zt-logo.png in html + 3. Check img exist >> .*zt-logo.png [esac] :start @@ -21,4 +20,4 @@ for /f "delims=" %%a in ('curl -s "http://pms.zentao.net/user-login.html" ^| fi for /f "tokens=2 delims='" %%i in ("!var!") do ( set var2=%%~i ) -echo ^>^> !var2! +echo ^>^> !var2! \ No newline at end of file diff --git a/demo/lang/bat/3_http_inteface_call.bat b/demo/lang/bat/3_http_inteface_call.bat index fc85ed1f084989f23947e90301716ae5c914f957..521fc67205343c9d05484607da67de981c861ca2 100644 --- a/demo/lang/bat/3_http_inteface_call.bat +++ b/demo/lang/bat/3_http_inteface_call.bat @@ -2,15 +2,14 @@ setlocal enabledelayedexpansion goto start [case] - title=check remote interface response cid=0 pid=0 [group] -1. Send a request to interface http://xxx -2. Retrieve sessionID field from response json -3. Validate its format >> ^[a-z0-9]{26} + 1. Send a request to interface http://xxx + 2. Retrieve sessionID field from response json + 3. Validate its format >> ^[a-z0-9]{26} [esac] :start diff --git a/demo/lang/js/1_string_match.js b/demo/lang/js/1_string_match.js index 7474f25b3bf3da4bd17ea811c5841043f5f9d730..70da105ec99bd14cc405d86f7ca7dab594d6b976 100755 --- a/demo/lang/js/1_string_match.js +++ b/demo/lang/js/1_string_match.js @@ -1,15 +1,14 @@ #!/usr/bin/env node /** [case] - title=check string matches pattern cid=0 pid=0 [group] -1. exactly match >> hello -2. regular expression match >> 1\d{10} -3. format string match >> %s%d + 1. exactly match >> hello + 2. regular expression match >> 1\d{10} + 3. format string match >> %s%d [esac] */ @@ -18,4 +17,4 @@ pid=0 console.log(">> hello"); console.log(">> 13905120512"); -console.log(">> abc123"); +console.log(">> abc123"); \ No newline at end of file diff --git a/demo/lang/js/2_webpage_extract.js b/demo/lang/js/2_webpage_extract.js index df9635ccea6612a1bcc17942ae4a912bb0f47acb..acf96a6ae3c5a4523325ea2b382af3c7a2f1c29f 100755 --- a/demo/lang/js/2_webpage_extract.js +++ b/demo/lang/js/2_webpage_extract.js @@ -1,15 +1,14 @@ #!/usr/bin/env node /** [case] - title=extract content from webpage cid=0 pid=0 [group] -1. Load web page from url http://xxx -2. Retrieve img element zt-logo.png in html -3. Check img exist >> .*zt-logo.png + 1. Load web page from url http://xxx + 2. Retrieve img element zt-logo.png in html + 3. Check img exist >> .*zt-logo.png [esac] */ @@ -30,4 +29,4 @@ http.get('http://pms.zentao.net/user-login.html', function(req) { console.log(">>" + res[1]) }); -}); +}); \ No newline at end of file diff --git a/demo/lang/js/3_http_inteface_call.js b/demo/lang/js/3_http_inteface_call.js index d694b25b910d7b0c49b88adeed211fc7e515c7fa..2642f32f2a11d96c1a59ee8810526779eed41580 100755 --- a/demo/lang/js/3_http_inteface_call.js +++ b/demo/lang/js/3_http_inteface_call.js @@ -1,15 +1,14 @@ #!/usr/bin/env node /** [case] - title=check remote interface response cid=0 pid=0 [group] -1. Send a request to interface http://xxx -2. Retrieve sessionID field from response json -3. Validate its format >> ^[a-z0-9]{26} + 1. Send a request to interface http://xxx + 2. Retrieve sessionID field from response json + 3. Validate its format >> ^[a-z0-9]{26} [esac] */ @@ -32,4 +31,4 @@ http.get('http://pms.zentao.net/?mode=getconfig', function(req) { } } }); -}); +}); \ No newline at end of file diff --git a/demo/lang/lua/1_string_match.lua b/demo/lang/lua/1_string_match.lua index 6c643100507abe360e0557d4c39acaf9b2629859..12ba92a20ea7dbf1cc70d047ebe4b6c322a7fc17 100755 --- a/demo/lang/lua/1_string_match.lua +++ b/demo/lang/lua/1_string_match.lua @@ -1,19 +1,18 @@ #!/usr/bin/env lua --[[ [case] - title=check string matches pattern cid=0 pid=0 [group] -1. exactly match >> hello -2. regular expression match >> 1\d{10} -3. format string match >> %s%d + 1. exactly match >> hello + 2. regular expression match >> 1\d{10} + 3. format string match >> %s%d [esac] ]] print(">> hello"); print(">> 13905120512"); -print(">> abc123"); +print(">> abc123"); \ No newline at end of file diff --git a/demo/lang/lua/2_webpage_extract.lua b/demo/lang/lua/2_webpage_extract.lua index 934a91607c276020f50f0bbb786b26a9856193ad..a91c5cf1f8b1e3602b8c9f46a1b6a692938516cb 100755 --- a/demo/lang/lua/2_webpage_extract.lua +++ b/demo/lang/lua/2_webpage_extract.lua @@ -1,15 +1,14 @@ #!/usr/bin/env lua --[[ [case] - title=extract content from webpage cid=0 pid=0 [group] -1. Load web page from url http://xxx -2. Retrieve img element zt-logo.png in html -3. Check img exist >> .*zt-logo.png + 1. Load web page from url http://xxx + 2. Retrieve img element zt-logo.png in html + 3. Check img exist >> .*zt-logo.png [esac] ]] @@ -31,4 +30,4 @@ if c~= 200 then else _, _, src = string.find(body, "") print(">>" .. src) -end +end \ No newline at end of file diff --git a/demo/lang/lua/3_http_inteface_call.lua b/demo/lang/lua/3_http_inteface_call.lua index 01414369b5bf1bbb8f250d1d332108e5ecc30b48..8c0affff026c2cb36442c4ce778b2440b864ac3e 100755 --- a/demo/lang/lua/3_http_inteface_call.lua +++ b/demo/lang/lua/3_http_inteface_call.lua @@ -1,15 +1,14 @@ #!/usr/bin/env lua --[[ [case] - title=check remote interface response cid=0 pid=0 [group] -1. Send a request to interface http://xxx -2. Retrieve sessionID field from response json -3. Check its format >> ^[a-z0-9]{26} + 1. Send a request to interface http://xxx + 2. Retrieve sessionID field from response json + 3. Check its format >> ^[a-z0-9]{26} [esac] ]] diff --git a/demo/lang/perl/1_string_match.pl b/demo/lang/perl/1_string_match.pl index a32752475b1970a767f7cc517cb2cd99f5c762bb..979033b98ed8184f59a42ed6a5afb06201b718d0 100755 --- a/demo/lang/perl/1_string_match.pl +++ b/demo/lang/perl/1_string_match.pl @@ -1,19 +1,18 @@ #!/usr/bin/env perl =pod [case] - title=check string matches pattern cid=0 pid=0 [group] -1. exactly match >> hello -2. regular expression match >> 1\d{10} -3. format string match >> %s%d + 1. exactly match >> hello + 2. regular expression match >> 1\d{10} + 3. format string match >> %s%d [esac] =cut print ">> hello\n"; print ">> 13905120512\n"; -print ">> abc123\n"; +print ">> abc123\n"; \ No newline at end of file diff --git a/demo/lang/perl/2_webpage_extract.pl b/demo/lang/perl/2_webpage_extract.pl index 89f0ca2c6ccecc91989bcd0cbe5cfddd76b2d6b0..dd6e8ab5c77ab2bf98a235c5c71f9eefffe4b95c 100755 --- a/demo/lang/perl/2_webpage_extract.pl +++ b/demo/lang/perl/2_webpage_extract.pl @@ -1,15 +1,14 @@ #!/usr/bin/env perl =pod [case] - title=extract content from webpage cid=0 pid=0 [group] -1. Load web page from url http://xxx -2. Retrieve img element zt-logo.png in html -3. Check img exist >> .*zt-logo.png + 1. Load web page from url http://xxx + 2. Retrieve img element zt-logo.png in html + 3. Check img exist >> .*zt-logo.png [esac] =cut @@ -19,4 +18,4 @@ $html = get('http://pms.zentao.net/user-login.html'); if ( $html =~ // ) { print ">> $1\n"; -} +} \ No newline at end of file diff --git a/demo/lang/perl/3_http_inteface_call.pl b/demo/lang/perl/3_http_inteface_call.pl index 1c5685fef50db78c8a3d5185fb02f8083e3660c2..8033370f4426e7e32609ef1ee9ecf895111b262c 100755 --- a/demo/lang/perl/3_http_inteface_call.pl +++ b/demo/lang/perl/3_http_inteface_call.pl @@ -1,15 +1,14 @@ #!/usr/bin/env perl =pod [case] - title=check remote interface response cid=0 pid=0 [group] -1. Send a request to interface http://xxx -2. Retrieve sessionID field from response json -3. Check its format >> ^[a-z0-9]{26} + 1. Send a request to interface http://xxx + 2. Retrieve sessionID field from response json + 3. Check its format >> ^[a-z0-9]{26} [esac] =cut @@ -19,4 +18,4 @@ $json = get('http://pms.zentao.net/?mode=getconfig'); if ( $json =~ /"sessionID":"([^"]*)"/ ) { print ">> $1\n"; -} +} \ No newline at end of file diff --git a/demo/lang/ruby/1_string_match.rb b/demo/lang/ruby/1_string_match.rb index cd25e8c889ccabdb24673eb4c54829d74eb9ff15..c267e8249476e41fdc06ee386058fa7eb67a9fea 100755 --- a/demo/lang/ruby/1_string_match.rb +++ b/demo/lang/ruby/1_string_match.rb @@ -1,19 +1,18 @@ #!/usr/bin/env ruby =begin [case] - title=check string matches pattern cid=0 pid=0 [group] -1. exactly match >> hello -2. regular expression match >> 1\d{10} -3. format string match >> %s%d + 1. exactly match >> hello + 2. regular expression match >> 1\d{10} + 3. format string match >> %s%d [esac] =end print(">> hello\n"); print(">> 13905120512\n"); -print(">> abc123\n"); +print(">> abc123\n"); \ No newline at end of file diff --git a/demo/lang/ruby/2_webpage_extract.rb b/demo/lang/ruby/2_webpage_extract.rb index 925d83b8981ed84d97ccfa5814dcae7e1b014da3..07d0deee7ed22904bd90e4f66940197d5675341a 100755 --- a/demo/lang/ruby/2_webpage_extract.rb +++ b/demo/lang/ruby/2_webpage_extract.rb @@ -1,15 +1,14 @@ #!/usr/bin/env ruby =begin [case] - title=extract content from webpage cid=0 pid=0 [group] -1. Load web page from url http://xxx -2. Retrieve img element zt-logo.png in html -3. Check img exist >> .*zt-logo.png + 1. Load web page from url http://xxx + 2. Retrieve img element zt-logo.png in html + 3. Check img exist >> .*zt-logo.png [esac] =end @@ -23,4 +22,4 @@ open(uri) do |http| end elem = html.match(//).captures -puts '>> ' + elem[0] +puts '>> ' + elem[0] \ No newline at end of file diff --git a/demo/lang/ruby/3_http_inteface_call.rb b/demo/lang/ruby/3_http_inteface_call.rb index c7d10e38fdee289fd091a61ca0bfc2f468eb0010..5960d713abdd1226d4ee2c970f69e2a100e689d7 100755 --- a/demo/lang/ruby/3_http_inteface_call.rb +++ b/demo/lang/ruby/3_http_inteface_call.rb @@ -1,15 +1,14 @@ #!/usr/bin/env ruby =begin [case] - title=check remote interface response cid=0 pid=0 [group] -1. Send a request to interface http://xxx -2. Retrieve sessionID field from response json -3. Check its format >> ^[a-z0-9]{26} + 1. Send a request to interface http://xxx + 2. Retrieve sessionID field from response json + 3. Check its format >> ^[a-z0-9]{26} [esac] =end @@ -24,4 +23,4 @@ open(uri) do |http| end json = JSON.parse(html) # need json library (gem install json) -puts '>> ' + json['sessionID'] +puts '>> ' + json['sessionID'] \ No newline at end of file diff --git a/demo/lang/tcl/1_string_match.tl b/demo/lang/tcl/1_string_match.tl index ed31ec2b724fc3348f662570bd03c704cd27f14b..830d9f9e381b519a24bb8638a770d30f7cb0b4bf 100755 --- a/demo/lang/tcl/1_string_match.tl +++ b/demo/lang/tcl/1_string_match.tl @@ -1,19 +1,18 @@ #!/usr/bin/env tclsh set case { [case] - title=check string matches pattern cid=0 pid=0 [group] -1. exactly match >> hello -2. regular expression match >> 1\d{10} -3. format string match >> %s%d + 1. exactly match >> hello + 2. regular expression match >> 1\d{10} + 3. format string match >> %s%d [esac] } puts ">> hello" puts ">> 13905120512" -puts ">> abc123" +puts ">> abc123" \ No newline at end of file diff --git a/demo/lang/tcl/2_webpage_extract.tl b/demo/lang/tcl/2_webpage_extract.tl index 73061fbe87a590375593abddf9aad98eea0df3c2..7995229186498091bf7a22f1213833682141b328 100755 --- a/demo/lang/tcl/2_webpage_extract.tl +++ b/demo/lang/tcl/2_webpage_extract.tl @@ -1,15 +1,14 @@ #!/usr/bin/env tclsh set case { [case] - title=extract content from webpage cid=0 pid=0 [group] -1. Load web page from url http://xxx -2. Retrieve img element zt-logo.png in html -3. Check img exist >> .*zt-logo.png + 1. Load web page from url http://xxx + 2. Retrieve img element zt-logo.png in html + 3. Check img exist >> .*zt-logo.png [esac] } @@ -22,4 +21,4 @@ set http [::http::geturl $url] set html [::http::data $http] regexp -- {} $html match elem -puts ">> $elem" +puts ">> $elem" \ No newline at end of file diff --git a/demo/lang/tcl/3_http_inteface_call.tl b/demo/lang/tcl/3_http_inteface_call.tl index 4b25d951161a418392467f4485943cb8b63d35c8..0e89e44d0369f65aef36a5ba4d6b395067756562 100755 --- a/demo/lang/tcl/3_http_inteface_call.tl +++ b/demo/lang/tcl/3_http_inteface_call.tl @@ -1,15 +1,14 @@ #!/usr/bin/env tclsh set case { [case] - title=check remote interface response cid=0 pid=0 [group] -1. Send a request to interface http://xxx -2. Retrieve sessionID field from response json -3. Check its format >> ^[a-z0-9]{26} + 1. Send a request to interface http://xxx + 2. Retrieve sessionID field from response json + 3. Check its format >> ^[a-z0-9]{26} [esac] } @@ -24,4 +23,4 @@ set jsonStr [::http::data $http] # need json library, you may use ActiveTcl set jsonObj [json::json2dict $jsonStr] -puts ">> [dict get $jsonObj sessionID]" +puts ">> [dict get $jsonObj sessionID]" \ No newline at end of file diff --git a/src/action/run.go b/src/action/run.go index e9c9a6c10cb55e88cd4180261fb13a35263dd743..4a5c58020dff3336246da173dfdefbf259d8ffa0 100644 --- a/src/action/run.go +++ b/src/action/run.go @@ -125,7 +125,7 @@ func runCases(files []string) { ext = ext[1:] } lang := vari.ScriptExtToNameMap[ext] - if commonUtils.GetFieldVal(conf, stringUtils.Ucfirst(lang)) == "" { // filter by interpreter + if lang != "bat" && commonUtils.GetFieldVal(conf, stringUtils.Ucfirst(lang)) == "" { // filter by interpreter continue } } else if !commonUtils.IsWin() { // filter by os diff --git a/src/service/testing/report.go b/src/service/testing/report.go index a70a958b8f3db62fd2dd29dccc0fb76e4f76c867..5aa47a5662f2d2c39de0fbf51d415c9f304b2216 100644 --- a/src/service/testing/report.go +++ b/src/service/testing/report.go @@ -15,6 +15,10 @@ import ( ) func Report(report model.TestReport, pathMaxWidth int) { + if len(report.Cases) == 0 { + return + } + // print failed case failedCount := 0 failedCaseLines := make([]string, 0)