CN116566659A - WeChat applet automatic login method and device based on JMeter and storage medium - Google Patents

WeChat applet automatic login method and device based on JMeter and storage medium Download PDF

Info

Publication number
CN116566659A
CN116566659A CN202310423447.9A CN202310423447A CN116566659A CN 116566659 A CN116566659 A CN 116566659A CN 202310423447 A CN202310423447 A CN 202310423447A CN 116566659 A CN116566659 A CN 116566659A
Authority
CN
China
Prior art keywords
wechat
applet
jmeter
login
wechat applet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310423447.9A
Other languages
Chinese (zh)
Inventor
杨慧娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202310423447.9A priority Critical patent/CN116566659A/en
Publication of CN116566659A publication Critical patent/CN116566659A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0807Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0815Network architectures or network communication protocols for network security for authentication of entities providing single-sign-on or federations

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a WeChat applet automatic login method, device and storage medium based on a Meter, which relate to the technical field of software development, and the method utilizes a Meter tool to acquire a project path of the WeChat applet according to an APP ID provided by WeChat; then starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to a WeChat applet or not; and if the temporary login credential corresponds to the WeChat applet, calling the temporary login credential by using a login interface of the WeChat applet to acquire a token value, setting the token value as a global variable, transmitting the token value into request header information of a subsequent interface of the JMeter tool, and executing the JMeter full-link script at regular time. The method reduces the times of manually acquiring the code before each script is executed manually, and realizes automatic login of the WeChat applet through the JMeter tool.

Description

WeChat applet automatic login method and device based on JMeter and storage medium
Technical Field
The application belongs to the technical field of software development, and particularly relates to a method, a device and a storage medium for realizing automatic authorized login of WeChat applet based on a Meter tool.
Background
JMeter is a testing tool developed using Java and free of open source, and is mainly used for functional testing and performance testing.
In the prior art, the code or the token value must be obtained by a WeChat developer tool when the WeChat applet is developed and debugged, the code is only 5 minutes in time, and the code is manually obtained at fixed time, so that the token is obtained for login, and the software development efficiency is low.
Meanwhile, at present, the automation of the WeChat applet interface cannot automatically acquire the code after the WeChat applet authorizes to log in through the JMeter, because the wx.logic () method called by the content of the logged-in applet changes in real time, the acquired code changes in real time, so that the automation flow is blocked from the initial login of each execution script, and the login-dependent script cannot be executed at fixed time.
Disclosure of Invention
Therefore, the method, the device and the storage medium for automatically logging in the WeChat applet based on the Meter are provided, which are helpful for solving the problem that the WeChat applet is difficult to automatically log in by a Meter tool in the prior art.
In order to achieve the above purpose, the present application adopts the following technical scheme:
in a first aspect, the present application provides a method for automatically logging in a WeChat applet based on a jMeter, including:
acquiring a project path of a WeChat applet by using a Meter tool according to an APP ID provided by WeChat;
starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the WeChat applet or not;
if the temporary login credential corresponds to the WeChat applet, calling the temporary login credential by using a login interface of the WeChat applet to obtain a token value, and setting the token value as a global variable;
and transmitting the token value into request header information of a subsequent interface of the JMeter tool, and executing the JMeter full-link script at fixed time.
Further, the acquiring the item path of the WeChat applet by using the jMeter tool according to the APP ID provided by the WeChat specifically includes:
acquiring an APP ID and an applet absolute path of the WeChat applet through an interface provided by the WeChat, and simultaneously downloading a corresponding applet project package locally;
and acquiring the item path corresponding to the WeChat applet according to the APP ID and the applet absolute path by using a Beanshell sampler in the Meter tool.
Further, the method for starting the WeChat developer tool, calling a wx.logic () method to obtain a temporary login credential, and judging whether the temporary login credential corresponds to the WeChat applet specifically includes:
and calling an automatic.launch () method, starting a WeChat developer tool, then calling a miniprogram.callWxMethod () method to call a wx.Login () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the APP ID of the WeChat applet.
Further, the calling the temporary login credential by using the login interface of the WeChat applet to obtain a token value, and setting the token value as a global variable specifically includes:
the login interface of the WeChat applet calls the temporary login credential to login the WeChat applet, and simultaneously requests a login interface to transmit parameters through a Beanshell sampler in a Meter tool to acquire a token value;
and setting the acquired token value as a global variable for a subsequent interface to call.
In a second aspect, the present application further provides an automatic device for logging in a WeChat applet based on a jMeter, including:
the path acquisition unit is used for acquiring the project path of the WeChat applet by using the JMeter tool according to the APP ID provided by the WeChat;
the credential data acquisition unit is used for starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential and judging whether the temporary login credential corresponds to the WeChat applet or not;
the token data acquisition unit is used for calling the temporary login credential to acquire a token value by using a login interface of the WeChat applet if the temporary login credential corresponds to the WeChat applet, and setting the token value as a global variable;
and the script execution unit is used for transmitting the token value into the request header information of the subsequent interface of the JMeter tool and executing the JMeter full-link script at fixed time.
In a third aspect, the present application provides a storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps in the JMeter-based automatic microletter applet login method provided in the first aspect.
The application adopts the technical scheme, possesses following beneficial effect at least:
according to the method for automatically logging in the WeChat applet based on the Meter, a Meter tool is utilized to acquire a project path of the WeChat applet according to an APP ID provided by the WeChat; starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the WeChat applet or not; if the temporary login credential corresponds to the WeChat applet, calling the temporary login credential by using a login interface of the WeChat applet to obtain a token value, and setting the token value as a global variable; and transmitting the token value into request header information of a subsequent interface of the JMeter tool, and executing the JMeter full-link script at fixed time. The method and the device process the WeChat through a JMeter tool to provide an APP ID to find a path of a corresponding item of the applet, call an automatic/laboratory () method to start a WeChat developer tool, and call a miniProgram/callWxMethod () method to call a wx/Login () method to acquire a temporary login credential. Therefore, the login interface of the applet generates a token value and sets a global variable when the temporary login credential is called, so that the subsequent other interfaces are convenient to request header information to call and execute the JMeter full-link script, the number of times of manually acquiring the code before each script is manually executed is reduced, and the problem that the automatic login of the WeChat applet is difficult to realize through a JMeter tool in the prior art is solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flowchart illustrating a method for automatically logging in a WeChat applet based on a Meter, according to an exemplary embodiment;
FIG. 2 is a flowchart of an implementation of the technique shown in accordance with an exemplary embodiment;
FIG. 3 is a functional architecture diagram of a JMeter-based WeChat applet auto-logon device, according to an exemplary embodiment.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail below.
Referring to fig. 1, fig. 1 is a flowchart of a method for automatically logging in a micro-letter applet based on a JMeter according to an exemplary embodiment, and the method includes:
s1: acquiring a project path of a WeChat applet by using a Meter tool according to an APP ID provided by WeChat;
s2: starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the WeChat applet or not;
s3: if the temporary login credential corresponds to the WeChat applet, calling the temporary login credential by using a login interface of the WeChat applet to obtain a token value, and setting the token value as a global variable;
s4: and transmitting the token value into request header information of a subsequent interface of the JMeter tool, and executing the JMeter full-link script at fixed time.
Currently, testers use a JMeter tool to perform automatic script execution, and need to manually acquire codes after WeChat authorization to obtain a login token (i.e. a token), and manually fill the login token into request header information parameters of an interface so as to execute a full-flow script.
The process is relatively complex, and the request header parameter information needs to be manually modified each time, so that the process is relatively complex. Therefore, the interface provided by the WeChat is utilized to call the WeChat developer tool by using the JMeter, the applet APP ID and the applet absolute path are transmitted, and the applet project path is obtained; the code is obtained by starting a WeChat developer tool by using an automated test tool of miniprogram-Automator in combination with JS and then calling wx.Login () by the miniprogram.callWxMethod (). And enabling the request parameters of the WeChat applet login interface to call the interface provided by the WeChat to generate a code, thereby acquiring a token value, setting the token value as a global variable, and providing the following script request header information for use.
Further, in one embodiment, the acquiring, by using the JMeter tool, the item path of the WeChat applet according to the APP ID provided by the WeChat specifically includes:
acquiring an APP ID and an applet absolute path of the WeChat applet through an interface provided by the WeChat, and simultaneously downloading a corresponding applet project package locally;
and acquiring the item path corresponding to the WeChat applet according to the APP ID and the applet absolute path by using a Beanshell sampler in the Meter tool.
Further, in one embodiment, the initiating a WeChat developer tool, invoking a wx.login () method to obtain a temporary login credential, and determining whether the temporary login credential corresponds to the WeChat applet specifically includes:
and calling an automatic.launch () method, starting a WeChat developer tool, then calling a miniprogram.callWxMethod () method to call a wx.Login () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the APP ID of the WeChat applet.
Further, in one embodiment, the calling the temporary login credential by using the login interface of the WeChat applet to obtain a token value, and setting the token value as a global variable specifically includes:
the login interface of the WeChat applet calls the temporary login credential to login the WeChat applet, and simultaneously requests a login interface to transmit parameters through a Beanshell sampler in a Meter tool to acquire a token value;
and setting the acquired token value as a global variable for a subsequent interface to call.
Referring to fig. 2, the present application uses intelllij IDEA to develop a WeChat providing interface, uses a BeanShell sampler to process WeChat providing APP ID to find a path of an item corresponding to an applet, calls an automatic. Launch () method, starts a WeChat developer tool, and then calls minipage. CallWxMethod () to call wx.Login () to obtain a code. Therefore, the login interface of the applet calls the code to log in, generates the token value and sets the token value as a global variable, so that the token value can be conveniently called by other subsequent interfaces for requesting header information. The specific technical implementation flow of the part is as follows:
1. using a Beanshell preprocessor in the Meter to make a call and acquiring a command of a tool of a WeChat applet login code;
2. config.js in the tool has configured the APP ID of the item and the absolute item path of the applet (here also configurable using CSV files for later maintenance);
3. calling an automatic. Launch () method provided by the WeChat to start a WeChat developer tool;
4. then calling a miniprogram-Autocontroller tool, wherein the miniprogram.callWxMethod () method;
5. calling wx.logic () according to miniprogram.callWxmethod () to obtain code, and judging whether the obtained code is the code of the corresponding applet;
6. according to the obtained code, the JMeter sampler requests the login interface to transmit code parameters, and obtains a token value;
7. the subsequent interface requests the header information to be passed into the token, thereby executing the JMeter full link script.
According to the method, the code is acquired and the token is further acquired by automatically processing WeChat authorized login through a code program, the number of times that the code is manually acquired before each time of script execution is reduced, so that the token is acquired, information head parameters of other interfaces are modified, and the JMeter full-link script is executed.
Referring to fig. 3, the present application further provides an automatic device for logging in a micro-letter applet based on a JMeter, including:
the path acquisition unit is used for acquiring the project path of the WeChat applet by using the JMeter tool according to the APP ID provided by the WeChat;
the credential data acquisition unit is used for starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential and judging whether the temporary login credential corresponds to the WeChat applet or not;
the token data acquisition unit is used for calling the temporary login credential to acquire a token value by using a login interface of the WeChat applet if the temporary login credential corresponds to the WeChat applet, and setting the token value as a global variable;
and the script execution unit is used for transmitting the token value into the request header information of the subsequent interface of the JMeter tool and executing the JMeter full-link script at fixed time.
The method and the device can automatically acquire the code of the WeChat applet in the development and use process of the WeChat applet, log in the successful WeChat applet according to the acquired code, and place the generated token in the request header information of the subsequent interface so as to realize the timing running automation script.
Furthermore, the present application provides a storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps in the JMeter-based automatic microletter applet login method provided in the first aspect.
It is to be understood that the same or similar parts in the above embodiments may be referred to each other, and that in some embodiments, the same or similar parts in other embodiments may be referred to.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. Although embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives, and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (6)

1. The automatic WeChat applet login method based on the Meter is characterized by comprising the following steps of:
acquiring a project path of a WeChat applet by using a Meter tool according to an APP ID provided by WeChat;
starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the WeChat applet or not;
if the temporary login credential corresponds to the WeChat applet, calling the temporary login credential by using a login interface of the WeChat applet to obtain a token value, and setting the token value as a global variable;
and transmitting the token value into request header information of a subsequent interface of the JMeter tool, and executing the JMeter full-link script at fixed time.
2. The automatic registration method of a WeChat applet based on a jMeter according to claim 1, wherein the acquiring the project path of the WeChat applet by using a jMeter tool according to the APPID provided by the WeChat specifically comprises:
acquiring an APP ID and an applet absolute path of the WeChat applet through an interface provided by the WeChat, and simultaneously downloading a corresponding applet project package locally;
and acquiring the item path corresponding to the WeChat applet according to the APP ID and the applet absolute path by using a Beanshell sampler in the Meter tool.
3. The automatic logon method of a WeChat applet based on a jMeter according to claim 1, wherein the initiating a WeChat developer tool, invoking a wx.logic () method to obtain a temporary logon credential, and determining whether the temporary logon credential corresponds to the WeChat applet specifically comprises:
and calling an automatic.launch () method, starting a WeChat developer tool, then calling a miniprogram.callWxMethod () method to call a wx.Login () method to acquire a temporary login credential, and judging whether the temporary login credential corresponds to the APP ID of the WeChat applet.
4. The automatic logging method of the micro-letter applet based on the JMeter according to claim 1, wherein the calling the temporary login credentials by using the logging interface of the micro-letter applet to obtain a token value, and setting the token value as a global variable specifically comprises:
the login interface of the WeChat applet calls the temporary login credential to login the WeChat applet, and simultaneously requests a login interface to transmit parameters through a Beanshell sampler in a Meter tool to acquire a token value;
and setting the acquired token value as a global variable for a subsequent interface to call.
5. The utility model provides a little letter applet automatic login device based on JMeter which characterized in that includes:
the path acquisition unit is used for acquiring the project path of the WeChat applet by using the JMeter tool according to the APP ID provided by the WeChat;
the credential data acquisition unit is used for starting a WeChat developer tool, calling a wx.logic () method to acquire a temporary login credential and judging whether the temporary login credential corresponds to the WeChat applet or not;
the token data acquisition unit is used for calling the temporary login credential to acquire a token value by using a login interface of the WeChat applet if the temporary login credential corresponds to the WeChat applet, and setting the token value as a global variable;
and the script execution unit is used for transmitting the token value into the request header information of the subsequent interface of the JMeter tool and executing the JMeter full-link script at fixed time.
6. A storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps in the JMeter-based applet auto-login method according to any one of claims 1 to 4.
CN202310423447.9A 2023-04-19 2023-04-19 WeChat applet automatic login method and device based on JMeter and storage medium Pending CN116566659A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310423447.9A CN116566659A (en) 2023-04-19 2023-04-19 WeChat applet automatic login method and device based on JMeter and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310423447.9A CN116566659A (en) 2023-04-19 2023-04-19 WeChat applet automatic login method and device based on JMeter and storage medium

Publications (1)

Publication Number Publication Date
CN116566659A true CN116566659A (en) 2023-08-08

Family

ID=87487072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310423447.9A Pending CN116566659A (en) 2023-04-19 2023-04-19 WeChat applet automatic login method and device based on JMeter and storage medium

Country Status (1)

Country Link
CN (1) CN116566659A (en)

Similar Documents

Publication Publication Date Title
US8589881B2 (en) Web-based software debugging apparatus and method for remote debugging
CN111897724B (en) Automatic testing method and device suitable for cloud platform
US20030074423A1 (en) Testing web services as components
CN111459801B (en) RSF remote service interface function test method, module, computer equipment and storage medium
CN112799940B (en) Regression testing method, regression testing device, computer system and computer readable storage medium
EP2427826A2 (en) Low-privilege debug channel
US11196728B1 (en) Caching login sessions to access a software testing environment
CN107026773B (en) Automatic association method for interface automation test
US8595704B2 (en) Extensible and unobtrusive script performance monitoring and measurement
US10423793B2 (en) Install runtime agent for security test
CN113672441A (en) Method and device for testing intelligent equipment
US20230401058A1 (en) Semantic functional wrappers of services
CN114024871B (en) Chip verification method, system, computer equipment and readable storage medium
CN108153667B (en) Automatic test method, device and system
CN106294119B (en) Test scheduling system and method and terminal equipment
CN116627850B (en) Function debugging method and device, storage medium and electronic equipment
US20050203717A1 (en) Automated testing system, method and program product using testing map
CN116566659A (en) WeChat applet automatic login method and device based on JMeter and storage medium
CN112527577A (en) Server energy consumption automatic testing and collecting method, system and medium
WO2023225801A1 (en) Automated testing method and apparatus for application
CN114385258B (en) Automatic test method, device, electronic equipment and storage medium
CN112631694B (en) API (application program interface) encapsulation calling method and system
CN108241573B (en) Integrated test code generation method and device
CN111049795A (en) Method and device for detecting sensitive data unencrypted vulnerability of distributed Web application
CN113760235B (en) BLE development and debugging system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination