本文整理汇总了Golang中github.com/matryer/silk/runner.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestIssue31
// https://github.com/matryer/silk/issues/31
func TestIssue31(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
r.RunFile("../testfiles/success/issue-31.silk.md")
is.False(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:10,代码来源:run_test.go
示例2: TestRunFileSuccessNoBody
func TestRunFileSuccessNoBody(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
r.RunFile("../testfiles/success/echo.nobody.success.silk.md")
is.False(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:9,代码来源:run_test.go
示例3: TestBodyField
func TestBodyField(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoDataHandler())
defer s.Close()
r := runner.New(subT, s.URL)
r.RunFile("../testfiles/success/body-as-field.silk.md")
is.False(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:9,代码来源:run_test.go
示例4: testFunc
func testFunc(t *testing.T) {
r := runner.New(t, *url)
files, err := filepath.Glob(root)
if err != nil {
log.Fatalln(err)
}
fmt.Println("running", len(files), "file(s)")
r.RunGlob(files, nil)
}
开发者ID:lucmichalski,项目名称:silk,代码行数:9,代码来源:main.go
示例5: TestStandardSeparator
// https://github.com/matryer/silk/issues/37
func TestStandardSeparator(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
os.Setenv("$AppNameFromEnv", "Silk")
r := runner.New(subT, s.URL)
r.RunFile("../testfiles/success/issue-37.silk.md")
is.False(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:11,代码来源:run_test.go
示例6: TestGlob
func TestGlob(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
r.Log = func(s string) {} // don't bother logging
r.RunGlob(filepath.Glob("../testfiles/failure/echo.*.silk.md"))
is.True(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:10,代码来源:run_test.go
示例7: TestHello
func TestHello(t *testing.T) {
// start test server
server := httptest.NewServer(example.NewServer())
defer server.Close()
// make a new runner using the server URL as the target
// and run the test file.
runner.New(t, server.URL).RunFile("hello.silk.md")
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:11,代码来源:example_test.go
示例8: TestCapturedVars
// https://github.com/matryer/silk/issues/2
func TestCapturedVars(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoDataHandler())
defer s.Close()
os.Setenv("$EnvStatus", "awesome")
os.Setenv("$AppNameFromEnv", "Silk")
r := runner.New(subT, s.URL)
r.RunFile("../testfiles/success/captured-vars.silk.md")
is.False(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:12,代码来源:run_test.go
示例9: TestRunJsonModesFailure
func TestRunJsonModesFailure(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoRawHandler())
defer s.Close()
r := runner.New(subT, s.URL)
g, err := parse.ParseFile("../testfiles/failure/echoraw.failure.jsonmodes.silk.md")
is.NoErr(err)
r.RunGroup(g...)
is.True(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:11,代码来源:run_test.go
示例10: TestRunGroupSuccess
func TestRunGroupSuccess(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
g, err := parse.ParseFile("../testfiles/success/echo.success.silk.md")
is.NoErr(err)
r.RunGroup(g...)
is.False(subT.Failed())
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:11,代码来源:run_test.go
示例11: TestFailureFieldsDifferentTypes
func TestFailureFieldsDifferentTypes(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
var logs []string
r.Log = func(s string) {
logs = append(logs, s)
}
g, err := parse.ParseFile("../testfiles/failure/echo.failure.fieldsdifferenttypes.silk.md")
is.NoErr(err)
r.RunGroup(g...)
is.True(subT.Failed())
logstr := strings.Join(logs, "\n")
is.True(strings.Contains(logstr, `Status expected string: "400" actual float64: 200`))
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:18,代码来源:run_test.go
示例12: TestFailureWrongHeader
func TestFailureWrongHeader(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
var logs []string
r.Log = func(s string) {
logs = append(logs, s)
}
g, err := parse.ParseFile("../testfiles/failure/echo.failure.wrongheader.silk.md")
is.NoErr(err)
r.RunGroup(g...)
is.True(subT.Failed())
logstr := strings.Join(logs, "\n")
is.True(strings.Contains(logstr, `Content-Type expected string: "wrong/type" actual string: "text/plain; charset=utf-8"`))
is.True(strings.Contains(logstr, "--- FAIL: GET /echo"))
is.True(strings.Contains(logstr, "../testfiles/failure/echo.failure.wrongheader.silk.md:22 - Content-Type doesn't match"))
}
开发者ID:buddhamagnet,项目名称:silk,代码行数:19,代码来源:run_test.go
示例13: TestFailureNonTrimmedExpection
// https://github.com/matryer/silk/issues/28
func TestFailureNonTrimmedExpection(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoDataHandler())
defer s.Close()
r := runner.New(subT, s.URL)
var logs []string
r.Log = func(s string) {
logs = append(logs, s)
}
g, err := parse.ParseFile("../testfiles/failure/echo.failure.nontrimmedexpectation.silk.md")
is.NoErr(err)
r.RunGroup(g...)
is.True(subT.Failed())
logstr := strings.Join(logs, "\n")
is.True(strings.Contains(logstr, `Data.body.status expected: "awesome" actual: " awesome"`))
is.True(strings.Contains(logstr, "--- FAIL: GET /echo"))
is.True(strings.Contains(logstr, "../testfiles/failure/echo.failure.nontrimmedexpectation.silk.md:18 - Data.body.status doesn't match"))
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:21,代码来源:run_test.go
示例14: TestFailureWrongBody
func TestFailureWrongBody(t *testing.T) {
is := is.New(t)
subT := &testT{}
s := httptest.NewServer(testutil.EchoHandler())
defer s.Close()
r := runner.New(subT, s.URL)
var logs []string
r.Log = func(s string) {
logs = append(logs, s)
}
g, err := parse.ParseFile("../testfiles/failure/echo.failure.wrongbody.silk.md")
is.NoErr(err)
r.RunGroup(g...)
is.True(subT.Failed())
logstr := strings.Join(logs, "\n")
is.True(strings.Contains(logstr, "body expected:"))
is.True(strings.Contains(logstr, "GET /echo"))
is.True(strings.Contains(logstr, "Hello silky."))
is.True(strings.Contains(logstr, "actual:"))
is.True(strings.Contains(logstr, "GET /echo"))
is.True(strings.Contains(logstr, "Hello silk."))
is.True(strings.Contains(logstr, "--- FAIL: GET /echo"))
is.True(strings.Contains(logstr, "../testfiles/failure/echo.failure.wrongbody.silk.md:14 - body doesn't match"))
}
开发者ID:Cedric-Venet,项目名称:silk,代码行数:24,代码来源:run_test.go
示例15: testFunc
func testFunc(t *testing.T) {
r := runner.New(t, *url)
fmt.Println("silk: running", len(paths), "file(s)...")
r.RunGlob(paths, nil)
}
开发者ID:matryer,项目名称:silk,代码行数:5,代码来源:main.go
示例16: TestAPI
func (q *QualityReportSuite) TestAPI(c *C) {
s := httptest.NewServer(q.Engine)
defer s.Close()
runner.New(c, s.URL).RunGlob(filepath.Glob("../api_doc/*.silk.md"))
}
开发者ID:mitre,项目名称:ecqm,代码行数:5,代码来源:quality_reports_test.go
注:本文中的github.com/matryer/silk/runner.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论