Documentation
¶
Index ¶
- Variables
- func AssertTests(t *testing.T)
- func CaptureTestcase(k *Keploy, r *http.Request, reqBody []byte, resp models.HttpResp, ...)
- func Decode(bin []byte, obj interface{}) (interface{}, error)
- func Encode(obj interface{}, arr [][]byte, pos int) error
- func GetGrpcClient() proto.RegressionServiceClient
- func Middleware(k *Keploy, router Router) error
- func ProcessDep(ctx context.Context, log *zap.Logger, meta map[string]string, ...) (bool, []interface{})
- func SetGrpcClient(c proto.RegressionServiceClient)
- func SetMode(m Mode) error
- func SetPath(path string)
- func SetTestMode()
- type AppConfig
- type BodyDumpResponseWriter
- type Config
- type Context
- type Filter
- type KError
- type KctxType
- type Keploy
- func (k *Keploy) Capture(req regression.TestCaseReq)
- func (k *Keploy) Get(id string) *models.TestCase
- func (k *Keploy) GetClock(id string) int64
- func (k *Keploy) GetDependencies(id string) []models.Dependency
- func (k *Keploy) GetMocks(id string) []*proto.Mock
- func (k *Keploy) GetResp(id string) models.HttpResp
- func (k *Keploy) PutResp(id string, resp models.HttpResp)
- func (k *Keploy) Test()
- type MockLib
- type Mode
- type Router
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
var ( MockPath string MockId = MockLib{/* contains filtered or unexported fields */} )
Functions ¶
func AssertTests ¶ added in v0.2.0
func CaptureTestcase ¶ added in v0.2.0
func Encode ¶
Encode takes obj parameter and encodes its contents into arr parameter. If obj have no exported field then, it returns an error.
func GetGrpcClient ¶ added in v0.6.0
func GetGrpcClient() proto.RegressionServiceClient
func Middleware ¶ added in v0.4.3
func ProcessDep ¶
func ProcessDep(ctx context.Context, log *zap.Logger, meta map[string]string, outputs ...interface{}) (bool, []interface{})
ProcessDep is a generic method to encode and decode the outputs of external dependecies. If request is on keploy.MODE_TEST mode, it returns (true, decoded outputs of stored binaries in keploy context). Else in keploy.MODE_RECORD mode, it encodes the outputs of external dependencies and stores in keploy context. Returns (false, nil).
func SetGrpcClient ¶ added in v0.5.0
func SetGrpcClient(c proto.RegressionServiceClient)
avoids circular dependency between mock and keploy packages
func SetMode ¶ added in v0.2.0
SetMode sets the keploy SDK mode error is returned if the mode is invalid
func SetTestMode ¶ added in v0.2.0
func SetTestMode()
SetTestMode sets the keploy SDK mode to MODE_TEST
Types ¶
type BodyDumpResponseWriter ¶ added in v0.2.0
type BodyDumpResponseWriter struct {
io.Writer
http.ResponseWriter
Status int
}
func ProcessRequest ¶ added in v0.4.0
func (*BodyDumpResponseWriter) Flush ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) Flush()
func (*BodyDumpResponseWriter) Hijack ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*BodyDumpResponseWriter) Write ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) Write(b []byte) (int, error)
func (*BodyDumpResponseWriter) WriteHeader ¶ added in v0.2.0
func (w *BodyDumpResponseWriter) WriteHeader(code int)
type Config ¶ added in v0.2.0
type Config struct {
App AppConfig
Server ServerConfig
}
type Context ¶
type KError ¶
type KError struct {
Err error
}
KError stores the error for encoding and decoding as errorString has no exported fields due to gob wasn't able to encode the unexported fields.
type Keploy ¶ added in v0.2.0
func (*Keploy) Capture ¶ added in v0.2.0
func (k *Keploy) Capture(req regression.TestCaseReq)
Capture will capture request, response and output of external dependencies by making Call to keploy server.
func (*Keploy) GetDependencies ¶ added in v0.2.1
func (k *Keploy) GetDependencies(id string) []models.Dependency
type Mode ¶ added in v0.2.0
type Mode string
Mode represents the mode at which the SDK is operating MODE_RECORD is for recording API calls to generate testcases MODE_TEST is for testing the application on previous recorded testcases MODE_OFF disables keploy SDK automatically from the application
func GetModeFromContext ¶ added in v0.2.0
GetModeFromContext returns the mode on which SDK is configured by accessing environment variable.
type Router ¶ added in v0.4.3
type Router interface {
// GetRequest provides access to the current http request object.
// Example: echo.Context.Request()
GetRequest() *http.Request
// SetRequest sets the http request with given request object parameter.
SetRequest(*http.Request)
// GetResponseWriter returns current ResponseWriter of the http handler.
GetResponseWriter() http.ResponseWriter
// SetResponseWriter sets the ResponseWriter of http handler with given parameter.
SetResponseWriter(http.ResponseWriter)
// Context returns the underlying context of the http.Request.
Context() context.Context
// Next is used to call the next handler of the middleware chain.
Next() error
// GetURLParams returns the url parameter as key:value pair.
GetURLParams() map[string]string
}