# Record playback

Developers can record test actions well in advance and then playback the test process by executing a recording script.

# Requirements for the operating environment

  • Download and install1.05.2110202or later Developer Tools, download address
  • Base library version is2.19.6and above

# Use Procedure

# 1. Tools -> Automated Testing

Entrance

# 2. Create a new use case and start recording

Start recording A new window pops up when you start.

  1. Allow modification of use case names
  2. Choose whether to start a mock
  3. Modify the maximum wait time when recording. The maximum wait time is the maximum wait time between two steps at the time of recording, if set to 3 seconds, then even if the interval between two operations is more than 3 seconds, the recorded waitfor value will be 3 seconds. The default value is 10 s.
  4. You can configure your rules to ignore randomly generated classnames if they affect the playback success rate.
  5. If you need to simulate a new application, you can configure clearing the cache Record the pop-up window After recording, click the Weixin Mini Program element normally to record, and after recording, you can fine-tune the waiting time, etc. Use case details

# 3. cgi mock

Supports interfaces such as mock wx.request / wx.cloud.callFunction. Note: The minimum tool version supported for cloud development-related interfaces is1.06.2206242 mock

# 4. Assertions / checks

Data snapshots / wxml snapshots can be recorded during recording for match verification when playing back Or choose to check the element, assert that the element exists / innertext is equal Assertion

# 4.1 Data snapshot

Clickdata snapshotrecords the currentpage.datadata. Go to that step when you play back and get anotherpage's datato match. The default is full data match. After 1.06.2206242 version support for selecting partial keys for matching Select fields Playback Tips

# 4.2 Wxml snapshot

Same as data snapshots, only wxml character strings

# 4.3 Check the elements

Select the check element, the icon will be highlighted, at this point you can select an element of Weixin Mini Program, click will not trigger the binding event Check the elements The default is to check whether the element exists or not. After recording, you can manually turn on the switch to check text Checking text

# 4.4 Screenshots (the minimum available version of the tool is 1.06.2206090)

When you click on the screenshot, the screenshot results are stored in the test case in base64 format screenshot When you play back, you show the screenshot from the recording as well as the screenshot that is currently playing back Screenshot results

# 5. Re-record

Re-record Note that re-recording covers previously recorded use case steps

# 6. to replay

Click playback to playback and the failure will be marked with the reason for the failure. Additionally, it supports playback of use cases on the real machine after scanning. to replay

# 7. Replay All

Select Playback All and a simple test report is generated and saved locally Replay the report

You can also choose to use the tool Command Line Playback, see Command Line Call for detailed instructions

# 打开自动化测试窗口
cli auto-replay --project /Users/username/demo
# 打开自动化测试窗口并回放全部测试用例
cli auto-replay --project /Users/username/demo --replay-all

# 8. Playback configuration

Tool version1.06.2211012above allows configuration of screenshots when playback If you take a screenshot when configuration fails, the image content is stored in the playback result file as base64

If you configure each step with a screenshot, the picture is saved in the same name folder as the playback result file

# 9. Weixin Mini Program Cloud measurement playback

When local playback is based on the developer tool's local code version.If a developer wants to test in other Weixin Mini Program releases (such as regression testing to play back multiple use cases in the Experience Edition), they can try using the Mini Program cloud test

Weixin Mini Program Cloud testing Supports playback of recorded use cases, in-development versions, experience versions, and online versions, supports scheduled tasks / API tasks, and generates detailed test reports.Detailed usage documentation can refer to Using recording playback in cloud measurement services

# Other

# Enterprise Weixin Mini Program Support

The tool version1.06.2209152above supports enterprise Weixin Mini Program for recording and playback automatic testing Switch to enterprise Weixin Mini Program mode, then enterprise WeChat base library select 2.20.3, you can use the same as normal Weixin Mini Program recording playback function Enterprise Weixin Mini Program mode

# Click on the avatar to switch test accounts

Test Account

# Configuration file explaination

The test save directory defaults tominitest /and can be modified inproject.config.json

"testRoot": "minitest/",