mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 08:09:45 +08:00
fix: stop logcat only when enabled
This commit is contained in:
@@ -138,6 +138,10 @@ func (dev *AndroidDevice) UUID() string {
|
||||
return dev.SerialNumber
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) LogEnabled() bool {
|
||||
return dev.LogOn
|
||||
}
|
||||
|
||||
func (dev *AndroidDevice) NewDriver(capabilities Capabilities) (driverExt *DriverExt, err error) {
|
||||
var driver WebDriver
|
||||
if dev.UIA2 {
|
||||
|
||||
@@ -581,6 +581,7 @@ func NewData(data map[string]interface{}, options ...DataOption) map[string]inte
|
||||
// current implemeted device: IOSDevice, AndroidDevice
|
||||
type Device interface {
|
||||
UUID() string // ios udid or android serial
|
||||
LogEnabled() bool
|
||||
NewDriver(capabilities Capabilities) (driverExt *DriverExt, err error)
|
||||
|
||||
StartPerf() error
|
||||
|
||||
@@ -281,6 +281,10 @@ func (dev *IOSDevice) UUID() string {
|
||||
return dev.UDID
|
||||
}
|
||||
|
||||
func (dev *IOSDevice) LogEnabled() bool {
|
||||
return dev.LogOn
|
||||
}
|
||||
|
||||
func (dev *IOSDevice) NewDriver(capabilities Capabilities) (driverExt *DriverExt, err error) {
|
||||
// init WDA driver
|
||||
if capabilities == nil {
|
||||
|
||||
@@ -625,13 +625,16 @@ func (r *SessionRunner) GetSummary() (*TestCaseSummary, error) {
|
||||
|
||||
for uuid, client := range r.caseRunner.hrpRunner.uiClients {
|
||||
// add WDA/UIA logs to summary
|
||||
log, err := client.Driver.StopCaptureLog()
|
||||
if err != nil {
|
||||
return caseSummary, err
|
||||
}
|
||||
logs := map[string]interface{}{
|
||||
"uuid": uuid,
|
||||
"content": log,
|
||||
"uuid": uuid,
|
||||
}
|
||||
|
||||
if client.Device.LogEnabled() {
|
||||
log, err := client.Driver.StopCaptureLog()
|
||||
if err != nil {
|
||||
return caseSummary, err
|
||||
}
|
||||
logs["content"] = log
|
||||
}
|
||||
|
||||
// stop performance monitor
|
||||
|
||||
Reference in New Issue
Block a user