airtest.core.helper module¶
-
class
G
[源代码]¶ 基类:
object
Represent the globals variables
-
BASEDIR
= []¶
-
LOGGER
= <airtest.utils.logwraper.AirtestLogger object>¶
-
LOGGING
= <Logger airtest.core.api (DEBUG)>¶
-
SCREEN
= None¶
-
DEVICE
= None¶
-
DEVICE_LIST
= []¶
-
RECENT_CAPTURE
= None¶
-
RECENT_CAPTURE_PATH
= None¶
-
CUSTOM_DEVICES
= {}¶
-
-
set_logdir
(dirpath)[源代码]¶ set log dir for logfile and screenshots.
参数: dirpath – directory to save logfile and screenshots Returns:
-
log
(arg, timestamp=None, desc='', snapshot=False)[源代码]¶ Insert user log, will be displayed in Html report.
参数: - arg – log message or Exception object
- timestamp – the timestamp of the log, default is time.time()
- desc – description of log, default is arg.class.__name__
- snapshot – whether to take a screenshot, default is False
返回: None
实际案例
>>> log("hello world", snapshot=True) >>> log({"key": "value"}, timestamp=time.time(), desc="log dict") >>> try: 1/0 except Exception as e: log(e)