Skip to content

How integrate with goconvey? #143

Answered by tyranron
aleus asked this question in Q&A
Discussion options

You must be logged in to vote

At the moment I'm doing the following trick

  1. Reporter that causes GoConvey assertion fail:
type ConveyReporter struct {
	convey.C
}

// Implements httpexpect.Reporter interface.
func (c ConveyReporter) Errorf(message string, args ...interface{}) {
	c.C.So(fmt.Sprintf(message, args...), assertionFails)
}

func assertionFails(actual interface{}, _ ...interface{}) string {
	return actual.(string)
}
  1. Printer that causes GoConvey assertion success:
type ConveyPrinter struct {
	convey.C
}

// Request implements Printer.Request.
func (ConveyPrinter) Request(*http.Request) {
	// Does nothing.
}

// Response implements Printer.Response.
func (p ConveyPrinter) Response(*http.Response, time.Duration

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by gavv
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #143 on November 12, 2022 20:43.