# Submit a test task

# Brief description

  • Submit a test task Make sure you bind the Weixin Mini Program AppID to the project in item management / product management before submitting

# Request URL

  • https://minitest.weixin.qq.com/thirdapi/plan

# How to request

  • POST

# parameter

Parameter Name Required type Introductions
token yes string From the top right corner of the page avatar pull down menu "my information," jump to my information page, view "my Token"
group_en_id yes string Project ID in English, available on item management / product management page
test_type yes int Type of test,1:monkey2:minium3:Recording Playback4: Fast Monkey (Vendor program only)5: Startup Performance Analysis
wx_version yes int Weixin Mini Program version,1: Online version2: Experience version [[ TAG-2-START]] 3`: Development version (If you need to test the experience version or development version of the task, please confirm that the Mini Program has uploaded the experience version or development version)
platforms yes string Operating platform, optional platform: android, ios, multiple platforms can be separated by English comma, such asandroid, ios
selected_android_num no int Only available forMonkeyandStartup Performance AnalysisTask Doing Compatibility Test Can specify the number of Android machines running Monkey or Startup Performance Analysis, up to 10
selected_ios_num no int Only available forMonkeyandStartup Performance AnalysisTask Doing Compatibility Test Specify the number of iOS machines running Monkey or Startup Performance Analysis, up to 10
wx_id no string Weixin Mini Program AppID, generally do not need to fill in, default running test project binding Mini Program (can go to cloud test plug-in item management / product management view),AppID (multiple AppID separated by commas) can be passed in bulk if and only if the Fast Monkey type is being tested by the provider. Currently, no more than 50 AppID can be passed in a single batch.
test_plan_id no int The test plan ID is only entered when you test a custom Monkey task, a minium task, recording playback task, or a custom fast Monkey task. The ID can be viewed on the test case management / test plan page
task_run_time no int Customize the maximum test time in seconds.The default value and range of the maximum test duration are different for different tasks (see Custom Test Duration Instructions for details)
desc no string Descriptions of test tasks, notes, etc.
minium_config no dict/object Some optional special configurations when running a minium task:{"assert_capture": true, "auto_relaunch": true, "auto_authorize": false, "compile_mode": "pages/getOpenId/index?p=1&m=2", "audits": false, "teardown_snapshot": false, "enable_tap_capture": false},Where assert_capture indicates whether to take a screenshot when asserting, and auto_relaunch indicates whether to relaunch to the launch page when starting,Auto_authorize indicates whether Weixin Mini Program auto-authorization is enabled, and compile_mode indicates a compilation mode in the form of passing the startup page and startup parameters in the WeChat developer tool custom compilation conditions through '?'Experience scoring is enabled or not, and teardown_snapshot is at the end of the use case,Whether or not to record the wxml information for the current page, enable_tap_capture indicates whether or not a screenshot is taken during the click operation

Note that when this parameter is required, the request header should contain*Content-type: application / json *
dev_account_no no int The account number used when running the development version of the test, for example, using 'ci robot 1', then pass in 1
dev_account no string When running the development version, if you specify a real account preview, fill in the real account nickname. Note: Choose either this parameter or dev_account_no
virtual_accounts no string Specify either a virtual account or a real account to test. If you specify more than one, split it in English commas.A virtual account needs to fill in the WeChat number of the virtual account, for examplevaccount7, vaccount8, get WeChat ID reference virtual account use .The real account fill in the account nickname.
run_mode no int Test mode, default to 1 (1: functionality test, 2: compatibility test). Only works for Record Playback and Minium tasks
ai_monkey no int The default is 0. AIMonkey test runs if and only if test_tpye is 1 and ai_monkey fills in 1.
special_cloud no string Ability to pay, such as filling infast_test when using the fast test
device_ids no string Pay capacity, specify the model ID test, if you specify more than one, divided by English comma.For example755,1783, the model ID can be obtained from the custom model selection page on the submit test task page.

# Return an example

{
	"data": {
		"plan_id": 2210
	},
	"msg": "添加成功,等待后台创建任务。",
	"rtn": 0,
	"timestamp": 1649313364.4696019
}

# Query tasks

# 1. Query Task List

# Brief description
  • Query submitted test tasks
# Request URL
  • https://minitest.weixin.qq.com/thirdapi/plan_list
# How to request
  • GET
# parameter
Parameter Name Required type
Introductions
token yes string You can get it from "My Token" in the drop-down menu to the right of the avatar in the upper right corner of the page
group_en_id yes string Project ID in English, available on item management / product management page
page_index yes int Page n, starting with 1
page_size no int Number of returns per page, default 10
test_type no int Task type,1Monkey;2Minium;3recording playback;4Fast Monkey;5Initiate the aptitude test
test_plan_id no int The id of the test plan, the id can be viewed in the test case management / test plan page, or obtained by querying the test plan interface
keyword_in_desc no string keywords in the task description. You can add keywords to the description when creating a task. Incomings here can be quickly filtered
create_by_me no int Whether to view only the tasks created by myself, the default view of all the tasks created by the project, if only to see myself created, passed1
platform no string Task-run platform, support byiosorandroid
create_start_day no string Start date of task creation date filter in the format'% Y-% m-% d', e.g. 2023-1-1
create_end_day no string Deadline for task creation date filter in the format'% Y-% m-% d', e.g. 2023-12-31
# Return an example
{
  "data": {
    "plan_list": [{
      "android_num": 1,
      "appid": "wxbb9a805eb4f9533c",
      "case_plan_name": "智能化Monkey",
      "create_time": "2022-03-30 17:53:11",
      "desc": "",
      "end_time": "2022-03-30 18:35:25",
      "id": 31768,
      "ios_num": 0,
      "platforms": "android",
      "start_time": "2022-03-30 18:29:27",
      "status": 12,
      "status_info": "测试结束",
      "success_rate": 1.0,
      "test_type_info": "Monkey",
      "user_name": "user1",
      "wx_version_info": "线上版本"
    }],    // 当前返回的提测任务列表
    "total_num": 10,  // 项目总共提测任务数量
  },
  "msg": "OK",
  "rtn": 0,
  "timestamp": 1614861228.1035924
}

# 2. Query Task Status & Get Task Results

# Brief description

  • Query the status of submitted automated test tasks (results)

# Request URL

  • https://minitest.weixin.qq.com/thirdapi/plan

# How to request

  • GET

# parameter

Parameter Name Required type Introductions
token yes string You can obtain it from "My Information" in the drop-down menu on the right-hand side of your profile in the upper right corner of the page
group_en_id yes string Project ID in English, available on item management / product management page
plan_id yes int Test task id, the plan_id value returned by the new task interface, or see the Table ID column in the Custom Task Management / Test Tasks page
full_info no int Yes (1) No (0, default) Require test results details

# Return an example

{
	"data": {
		"status": 2,
		"status_text": "测试中"
	},
	"msg": "OK",
	"rtn": 0,
	"timestamp": 1614861228.1035924,
	"trace_id": "bb97c56f0b85da64"

}

# Extracting AI-generated code from the return value

For AI testing tasks , support is available for retrieving AI-generated code from third-party interfaces.Examples are as follows:

import requests

def get_ai_code():
    data = {
        'token': 'your minitest token',  # 需要换成你的token
        'group_en_id': 'group en id',   # 需要换成你的项目英文ID
        'full_info': 1,  # 注意full_info必须为1
        'plan_id': xxx,  # 这里换成你自己查询的任务ID
    }
    resp = requests.get('https://minitest.weixin.qq.com/thirdapi/plan', params=data)
    resp = resp.json()
    results = resp['data'].get('results')
    for each_result in results:
        minium_code = each_result.get('minium_ai_code')
        if minium_code:
          # minium_ai_example.py 可以换成你要下载的文件
            with open('minium_ai_example.py', 'w', encoding='utf8') as f:
                for line in minium_code:
                    f.write(line)
    return

# Remarks

The task part status code is as follows:

Tips: When the status code is greater than 10, the task is completed .If the number is greater than 10 and not 12, there are generally exceptions that can be considered unsuccessful.

  • 1: In the line
  • 2: In the test
  • 11: Case not found
  • 12: The test ends
  • 15: Task Overtime

# Brief description

  • Get a link to the task sharing report, please note that it is valid for 30 days

# Request URL

  • https://minitest.weixin.qq.com/thirdapi/share_url

# How to request

  • GET

# parameter

Parameter Name Required type Introductions
token yes string You can obtain it from "My Information" in the drop-down menu on the right-hand side of your profile in the upper right corner of the page
group_en_id yes string Project ID in English, available on item management / product management page
plan_id yes int Test task id, the plan_id value returned by the new task interface, or see the Table ID column in the Custom Task Management / Test Tasks page

# Return an example

{
  "data":{
    "expired_time":"2022-07-06 17:21:49",
    "share_url":"xxx"
  },
  "msg":"ok",
  "rtn":0,
  "timestamp":1654507309.8952177,
  "trace_id":"5f7884d3953a2e18"
}

# Get the test results resource

# Brief description

  • Get the test result resources, such as screenshots, logs, etc., and the interface returns the download link of the packaged zip file, which is classified by use case name + device id after decompression. Note: The response time of this interface is affected by the space occupied by the result of the task. The response time can be several seconds. Please increase the request timeout appropriately.

# Request URL

  • https://minitest.weixin.qq.com/thirdapi/report/static_resource

# How to request

  • GET

# parameter

Parameter Name Required type Introductions
token yes string You can obtain it from "My Information" in the drop-down menu on the right-hand side of your profile in the upper right corner of the page
group_en_id yes string Project ID in English, available on item management / product management page
plan_id yes int Test task id, the plan_id value returned by the new task interface, or see the Table ID column in the Custom Task Management / Test Tasks page
need_image no int Would you like to download the picture? 1: Need to download. 0: No need to download. The default is 1 (download required)
need_log no int Do you want to download logs? 1: Need to download. 0: No need to download. Default 0 (no download required)

# Return an example

{
  "data":{
	  "download_url": "https://minitest.weixin.qq.com/thirdapi/resource/xxxxxxxxxxxxxxxxxxxxxx.zip"
  },
  "msg": null,
  "rtn": 0,
  "timestamp": 1669293003.1537051,
  "trace_id": "b3052d8c5008588f"
}

# Cancel the test task

# Brief description

  • Cancel tasks that are being tested with the following limitations:
    • Submit the creation task for a minute before attempting to cancel
    • Only tasks in "Create," "Queue," and "Test" support cancellation
    • In order to avoid waste of equipment resources, canceling tasks after five minutes of creation is not supported ( purchasing a private cloud project is not supported)

# Request URL

  • https://minitest.weixin.qq.com/thirdapi/plan/cancel

# How to request

  • POST

# parameter

Parameter Name Required type Introductions
token yes string You can obtain it from "My Information" in the drop-down menu on the right-hand side of your profile in the upper right corner of the page
group_en_id yes string Project ID in English, available on item management / product management page
plan_id yes int Test task id, the plan_id value returned by the new task interface, or see the custom task management / test task page

# Return an example

{
  "data": null,
  "msg": "",
  "rtn": 0,
  "timestamp": 1669293003.1537051,
  "trace_id": "b3052d8c5008588f"
}

# Remarks

Please pay attention tortnreturn value is 0 ,If and only if the cancellation is successful** 0** , otherwise please pay attention tomsgfield content.

# Delete the test task

# Brief description

When deleting a test task, can only delete tasks that have run

The task being executed cannot be deleted. If you need to end the task, refer to the task cancellation interface above

# Request URL

  • https://minitest.weixin.qq.com/thirdapi/plan/delete

# How to request

  • POST

# parameter

Parameter Name Required type Introductions
token yes string You can obtain it from "My Information" in the drop-down menu on the right-hand side of your profile in the upper right corner of the page
group_en_id yes string Project ID in English, available on item management / product management page
plan_id yes int Test task id, the plan_id value returned by the new task interface, or see the custom task management / test task page

# Return value

Pay attention to whether thertnreturn value is 0 ,If and only if the deletion is successful** 0** , otherwise please pay attention tomsgfield content.