mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
change: update unittest for regex check
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
**go version**
|
**go version**
|
||||||
|
|
||||||
- change: set http request timeout to 120s
|
- change: set http request timeout default to 120s
|
||||||
|
|
||||||
## v4.1.4 (2022-06-17)
|
## v4.1.4 (2022-06-17)
|
||||||
|
|
||||||
|
|||||||
+23
-5
@@ -34,15 +34,33 @@ func TestSearchJmespath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSearchRegexp(t *testing.T) {
|
func TestSearchRegexp(t *testing.T) {
|
||||||
testText := `hrp aims to be a one-stop solution for HTTP(S) testing, covering API testing, load testing and digital experience monitoring (DEM).`
|
testText := `
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a href="/order/addToCart" style="color: white"><i class="fa fa-shopping-cart fa-2x"></i><span class="badge">0</span></a></li>
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#" style="color: white">
|
||||||
|
Leo <i class="fa fa-cog fa-2x"></i><span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="/user/changePassword">Change Password</a></li>
|
||||||
|
<li><a href="/user/addAddress">Shipping</a></li>
|
||||||
|
<li><a href="/user/addCard">Payment</a></li>
|
||||||
|
<li><a href="/order/orderHistory">Order History</a></li>
|
||||||
|
<li><a href="/user/signOut">Sign Out</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li> </li>
|
||||||
|
<li><a href="/user/signOut" style="color: white"><i class="fa fa-sign-out fa-2x"></i>
|
||||||
|
Sign Out</a></li>
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
testData := []struct {
|
testData := []struct {
|
||||||
raw string
|
raw string
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{"covering (.*) testing,", "API"},
|
{"/user/signOut\">(.*)</a></li>", "Sign Out"},
|
||||||
{" (.*) to", "aims"},
|
{"<li><a href=\"/user/(.*)\" style", "signOut"},
|
||||||
{"^(.*) aims", "hrp"},
|
{" (.*) <i class=\"fa fa-cog fa-2x\"></i>", "Leo"},
|
||||||
{".* (.*?)$", "(DEM)."},
|
|
||||||
}
|
}
|
||||||
// new response object
|
// new response object
|
||||||
resp := http.Response{}
|
resp := http.Response{}
|
||||||
|
|||||||
Reference in New Issue
Block a user