mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
feat: init device with optional serial, port, mjpeg port
This commit is contained in:
@@ -29,6 +29,7 @@ type TConfig struct {
|
||||
ParametersSetting *TParamsConfig `json:"parameters_setting,omitempty" yaml:"parameters_setting,omitempty"`
|
||||
ThinkTimeSetting *ThinkTimeConfig `json:"think_time,omitempty" yaml:"think_time,omitempty"`
|
||||
WebSocketSetting *WebSocketConfig `json:"websocket,omitempty" yaml:"websocket,omitempty"`
|
||||
IOS []*IOSConfig `json:"ios,omitempty" yaml:"ios,omitempty"`
|
||||
Timeout float64 `json:"timeout,omitempty" yaml:"timeout,omitempty"` // global timeout in seconds
|
||||
Export []string `json:"export,omitempty" yaml:"export,omitempty"`
|
||||
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
|
||||
@@ -90,12 +91,34 @@ func (c *TConfig) SetWeight(weight int) *TConfig {
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *TConfig) SetWebSocket(times, interval, timeout, size int64) {
|
||||
func (c *TConfig) SetWebSocket(times, interval, timeout, size int64) *TConfig {
|
||||
c.WebSocketSetting = &WebSocketConfig{
|
||||
ReconnectionTimes: times,
|
||||
ReconnectionInterval: interval,
|
||||
MaxMessageSize: size,
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *TConfig) SetIOS(device WDADevice) *TConfig {
|
||||
// each device can have its own settings
|
||||
if device.UDID != "" {
|
||||
c.IOS = append(c.IOS, &IOSConfig{
|
||||
WDADevice: device,
|
||||
})
|
||||
return c
|
||||
}
|
||||
|
||||
// device UDID is not specified ,settings will be shared
|
||||
iosConfig := &IOSConfig{
|
||||
WDADevice: device,
|
||||
}
|
||||
if len(c.IOS) == 0 {
|
||||
c.IOS = append(c.IOS, iosConfig)
|
||||
} else {
|
||||
c.IOS[0] = iosConfig
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
type ThinkTimeConfig struct {
|
||||
|
||||
Reference in New Issue
Block a user