mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
package option
|
|
|
|
import "github.com/httprunner/funplugin"
|
|
|
|
type DriverOptions struct {
|
|
Capabilities Capabilities
|
|
Plugin funplugin.IPlugin
|
|
WithImageService bool
|
|
WithResultFolder bool
|
|
}
|
|
|
|
func NewDriverOptions(opts ...DriverOption) *DriverOptions {
|
|
driverOptions := &DriverOptions{
|
|
WithImageService: true,
|
|
WithResultFolder: true,
|
|
}
|
|
for _, option := range opts {
|
|
option(driverOptions)
|
|
}
|
|
return driverOptions
|
|
}
|
|
|
|
type DriverOption func(*DriverOptions)
|
|
|
|
func WithDriverCapabilities(capabilities Capabilities) DriverOption {
|
|
return func(options *DriverOptions) {
|
|
options.Capabilities = capabilities
|
|
}
|
|
}
|
|
|
|
func WithDriverImageService(withImageService bool) DriverOption {
|
|
return func(options *DriverOptions) {
|
|
options.WithImageService = withImageService
|
|
}
|
|
}
|
|
|
|
func WithDriverResultFolder(withResultFolder bool) DriverOption {
|
|
return func(options *DriverOptions) {
|
|
options.WithResultFolder = withResultFolder
|
|
}
|
|
}
|
|
|
|
func WithDriverPlugin(plugin funplugin.IPlugin) DriverOption {
|
|
return func(options *DriverOptions) {
|
|
options.Plugin = plugin
|
|
}
|
|
}
|