Documentation ¶
Index ¶
- func AssertRequestResult(t *testing.T, actual *task.Result, actualErr error, expected *task.Result, ...)
- func ConveyTest(t *testing.T, tests []ExecutorTest)
- func NewMockHttpClient(mocks []MockResult) rest.HTTPClient
- func TestConnection(tester ConnectionTester) (*task.Result, error)
- type ConnectionTester
- type ExecutorTest
- func (fixture *ExecutorTest) Build() (*ExecutorTest, error)
- func (fixture ExecutorTest) GetInputFilepath() string
- func (fixture ExecutorTest) GetOutputFilepath() string
- func (fixture ExecutorTest) LoadOutputResult() ([]byte, error)
- func (fixture *ExecutorTest) WithAssert(assert convey.Assertion) *ExecutorTest
- func (fixture *ExecutorTest) WithExpectedOutputFile(filename string) *ExecutorTest
- func (fixture *ExecutorTest) WithInputFile(filename string) *ExecutorTest
- func (fixture *ExecutorTest) WithOutputFile(filename string) *ExecutorTest
- func (fixture *ExecutorTest) WithRunnerFunction(function runner.Runner) *ExecutorTest
- type ExecutorTestConfig
- type Mock
- type MockBody
- type MockHttpClient
- type MockResult
- type TestConnectionResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertRequestResult ¶
func AssertRequestResult(t *testing.T, actual *task.Result, actualErr error, expected *task.Result, expectedErr error)
AssertRequestResult compares the actual and expected results of a task in a testing context.
func ConveyTest ¶
func ConveyTest(t *testing.T, tests []ExecutorTest)
ConveyTest executes the executor tests using Convey from goconvey.
func NewMockHttpClient ¶
func NewMockHttpClient(mocks []MockResult) rest.HTTPClient
NewMockHttpClient creates a new instance of MockHttpClient based on the provided mock results.
func TestConnection ¶ added in v0.2.40
func TestConnection(tester ConnectionTester) (*task.Result, error)
TestConnection performs a connection test using the provided ConnectionTester.
It returns a task.Result containing the JSON representation of the TestConnectionResult. If the connection test encounters an error, the 'Success' field is set to false, and the 'Output' field contains the error message.
Types ¶
type ConnectionTester ¶ added in v0.2.40
type ConnectionTester interface {
TestConnection() error
}
ConnectionTester is an interface for testing connections.
Implementations should provide the TestConnection method for conducting the actual connection test.
type ExecutorTest ¶
type ExecutorTest struct { ExecutorTestConfig Input []byte Expected []byte // contains filtered or unexported fields }
ExecutorTest represents an executor test case.
func CreateExecutorTest ¶
func CreateExecutorTest(path string) *ExecutorTest
CreateExecutorTest creates a new executor test case.
func CreateExecutorTestSet ¶
func CreateExecutorTestSet(basePath string, tests map[string]runner.Runner) []ExecutorTest
CreateExecutorTestSet creates a set of executor tests based on the specified base path and runners.
func (*ExecutorTest) Build ¶
func (fixture *ExecutorTest) Build() (*ExecutorTest, error)
Build creates the executor test case.
func (ExecutorTest) GetInputFilepath ¶
func (fixture ExecutorTest) GetInputFilepath() string
GetInputFilepath returns the file path of the input file.
func (ExecutorTest) GetOutputFilepath ¶
func (fixture ExecutorTest) GetOutputFilepath() string
GetOutputFilepath returns the file path of the output file.
func (ExecutorTest) LoadOutputResult ¶
func (fixture ExecutorTest) LoadOutputResult() ([]byte, error)
LoadOutputResult loads the output result from the test case.
func (*ExecutorTest) WithAssert ¶
func (fixture *ExecutorTest) WithAssert(assert convey.Assertion) *ExecutorTest
WithAssert adds an assertion for the executor test.
func (*ExecutorTest) WithExpectedOutputFile ¶
func (fixture *ExecutorTest) WithExpectedOutputFile(filename string) *ExecutorTest
WithExpectedOutputFile sets the expected output file name for the executor test.
func (*ExecutorTest) WithInputFile ¶
func (fixture *ExecutorTest) WithInputFile(filename string) *ExecutorTest
WithInputFile sets the input file name for the executor test.
func (*ExecutorTest) WithOutputFile ¶
func (fixture *ExecutorTest) WithOutputFile(filename string) *ExecutorTest
WithOutputFile sets the output file name for the executor test.
func (*ExecutorTest) WithRunnerFunction ¶
func (fixture *ExecutorTest) WithRunnerFunction(function runner.Runner) *ExecutorTest
WithRunnerFunction sets the runner function for the executor test.
type ExecutorTestConfig ¶
ExecutorTestConfig holds the configuration for an executor test.
type Mock ¶ added in v0.2.56
type Mock struct {
// contains filtered or unexported fields
}
Mock is a definition of mock consisting of mocked path, queries and mock response body which is returned on matched mock pattern
type MockBody ¶
type MockBody struct {
// contains filtered or unexported fields
}
MockBody is a mock implementation of the http.Response.Body interface.
type MockHttpClient ¶
type MockHttpClient struct {
// contains filtered or unexported fields
}
MockHttpClient is a mock implementation of the rest.HTTPClient interface.
type MockResult ¶
type MockResult struct { Method string Path string QueryParams url.Values Filename string Data []byte StatusCode int }
MockResult represents a mocked HTTP response.
func (MockResult) ToMock ¶ added in v0.2.56
func (mr MockResult) ToMock() *Mock
ToMock create Mock reference out of the MockResult
type TestConnectionResult ¶ added in v0.2.40
TestConnectionResult represents the result of a connection test.
It includes a boolean flag 'Success' indicating whether the test was successful, and a string 'Output' containing additional information or error message.