# Frequently asked questions about recording playback testing

# Special note:

When a user records, it is based on the local developer tool opens the Weixin Mini Program source code records, and when synchronizing use cases to cloud testing, synchronizes only use cases, not local code

When the cloud test playback, it is based on the version Weixin Mini Program on the real machine **, such as the online version, the experiential version, and the development version [.

So the developer needs to verify that the recording and playback code is consistent.Many errors are caused by inconsistent versions of the recording and playback, such as when the playback prompts that the element cannot be found or that the element does not exist

# A general screening process for recorded playback task errors

  1. Expand the error step to see if the screenshot before and after the operation is as expected

  2. If the screenshot before the operation does not meet expectations, then go back to the previous steps to troubleshoot

    • Q: Why did the previous steps not find problems?

      A: There are several possible scenarios:

      • Some of the previous operations did not make the assertion , so they did not fail
      • The previous step set to ignore the failure of playback , even if the playback fails, because the setting ignores the following execution
      • The prestep does not operate on the element, or the element path is not unique to cause to find the wrong element , but the operation is still normal
  3. If the screenshot after the operation does not meet expectations

    A. If the current step causes the page to jump, verify that the page does not jump.If not, it is probably because the element cannot be clicked on , consider that there is a mask or has found the wrong element .

    B. If the step does not cause a page jump, but simply does not respond to , download the page wxml to find whether the corresponding elements meet expectations.

  4. There's nothing wrong with the screenshot.

    You can download the page wxml and compare the Weixin Mini Program version** when the **script was recorded to see if the structure corresponding to the same page path has changed. page structure inconsistencies are mainly caused by the inconsistencies of the previously mentioned versions, such as:

    • The cloud test is running theuploading/previewing the Weixin Mini Program version that has been uploaded by. After the user has uploaded the Mini Program,Also code locally modify / update before recording the script, at which time run-test version and recorded versions will be inconsistent, and it is easy to have page structures that are inconsistent with

    • Cloud test can supportonline version,experience versionTheversions in development are likely to have some **version differences in the code, if you are recording using ]]is a development branch, but the online versionchosen during the run-up also tends to cause inconsistent page structure ****

# Recorded playback elements can't find a problem

When running a recorded playback task, there are often problems finding elements

raise MiniElementNotFoundError("element[%s] not found" % xpath)

The above situation can be addressed in the following areas

  • Weixin Mini Program Version inconsistency.In the failed step, download the page wxml is opened in the development tool. Compare the Mini Program version of when the script was recorded and to see if the structure corresponding to the same page path has changed._Specifically refer to point 4 of the above screening process.

  • Weixin Mini Program behaves inconsistently in different environments. The recording playback task is the IDE recording script and the native playback script. You need to confirm whether **the native and native performance of the IDE is consistent, for example, the IDE Mini Program page element has a layer of elements and the Native does not

  • A cache problem.Make sure that there is no cache clear before recording, there is no authorization not to point, etc.Real-world playback on a cloud test will reinstall login WeChat and pull up Weixin Mini Program, while cached data such as developer tool local login status cannot be synchronized to the test real-world machine.** , if you do not clear the cache before recording the use case, it may result in a playback failure, resulting in elements not found,It is recommended to clear the cache before recording

# Record playback report AssertionError

The user actively adds / MiniTest framework will add "assert"statement

For such errors, the screening steps are as follows

  • It follows the general screening process._Specifically refer to the above screening process.
  • If it is actively adding assertions, check them according to the content of the assertions.
  • If you assert that the content is related to a page element, you can combine screenshot and page wxml to check whether the element really does not exist.Special attention should be paid to Weixin Mini Program code version issues.

For example, there was a script where a screenshot didn't see a problem, but because the page structure changed, the elements found according to the recorded content didn' t meet expectations

  • If an action causes a page to jump, the MiniTest framework also automatically adds assertions to determine if the page jumps correctly.Check to ensure that the page has jumped to **as expected, and if there is no jump, consider that element operation failed .

For example, is not operational / Authorization window is blocked = Page structure changes causing the wrong element to be found, etc.



View cloud testing related questions and answers >

To WeChat Open Community Questions >