CN113051157A - Interface testing method and device, computer equipment and storage medium - Google Patents

Interface testing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113051157A
CN113051157A CN202110284138.9A CN202110284138A CN113051157A CN 113051157 A CN113051157 A CN 113051157A CN 202110284138 A CN202110284138 A CN 202110284138A CN 113051157 A CN113051157 A CN 113051157A
Authority
CN
China
Prior art keywords
user
token
minimum
test
test case
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.)
Granted
Application number
CN202110284138.9A
Other languages
Chinese (zh)
Other versions
CN113051157B (en
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.)
Wuhan United Imaging Healthcare Co Ltd
Original Assignee
Wuhan United Imaging Healthcare 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 Wuhan United Imaging Healthcare Co Ltd filed Critical Wuhan United Imaging Healthcare Co Ltd
Priority to CN202110284138.9A priority Critical patent/CN113051157B/en
Publication of CN113051157A publication Critical patent/CN113051157A/en
Application granted granted Critical
Publication of CN113051157B publication Critical patent/CN113051157B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to an interface testing method, an interface testing device, computer equipment and a storage medium. The method comprises the following steps: obtaining a token type set according to a test case to be processed; carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other; temporarily storing tokens of all token types in the minimum token type set in a local place; and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule. By adopting the method, the test time can be shortened, and the test efficiency can be improved.

Description

Interface testing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of interface testing technologies, and in particular, to an interface testing method and apparatus, a computer device, and a storage medium.
Background
Interface testing is a test that tests an interface between components of a system. The process may include: the test terminal firstly obtains the authentication token from the server and then sends test data and the authentication token to the server through the target interface. If the server does not receive the authentication token, it is determined that the interface test failed. If the server receives the authentication token, but determines that the authentication token is invalid, it is also determined that the interface test failed. It can be seen that obtaining a valid authentication token is critical to interface testing.
At present, when a test terminal uses a large number of test cases to test a target interface, a large amount of time is consumed to obtain an authentication token from a server, so that the test time is long, and the test efficiency is low.
Disclosure of Invention
In view of the above, it is desirable to provide an interface testing method, an interface testing apparatus, a computer device, and a storage medium, which can shorten testing time and improve testing efficiency.
An interface testing method, the method comprising:
obtaining a token type set according to a test case to be processed;
carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
temporarily storing tokens of all token types in the minimum token type set in a local place;
and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule.
In one embodiment, the obtaining a token type set according to the to-be-processed test case includes:
and acquiring the user roles corresponding to the test cases, and acquiring the token type set through the acquired user roles.
In one embodiment, the performing deduplication processing on the same token type in the token type set to obtain a minimum token type set includes:
carrying out duplication elimination processing on user roles corresponding to the test cases to obtain a minimum user role set, and obtaining a minimum token type set according to the minimum user role set; the user roles included in the minimum user role set are different from each other.
In one embodiment, the obtaining of the user role corresponding to each test case includes:
traversing each test case to obtain a user identifier set in each test case;
and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relationship between the pre-established identifications and the roles.
In one embodiment, before obtaining the user role corresponding to each test case according to the user identifier set in each test case and the correspondence between the identifier and the role established in advance, the method includes:
receiving a user identification input by a user, and determining a user role selected by the user;
and establishing a corresponding relation between the identification and the role according to the user identification input by the user and the user role selected by the user.
In one embodiment, the obtaining the token corresponding to each test case from the local according to the preset rule includes:
acquiring a user identifier set in each test case;
and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user identifications set in the test cases.
In one embodiment, the obtaining the token corresponding to each test case from the locally stored token according to the user identifier set in each test case includes:
searching out the corresponding user role in each test case from the minimum token type set according to the user identification set in each test case and the corresponding relation between the identification and the role;
and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user roles corresponding to the test cases.
An interface test apparatus, the apparatus comprising:
the first set acquisition module is used for acquiring a token type set according to a test case to be processed;
the second set acquisition module is used for carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
the token storage module is used for temporarily storing tokens of all token types in the minimum token type set in a local place;
and the token acquisition module is used for locally acquiring tokens corresponding to the test cases according to preset rules in the interface test process.
In one embodiment, the token type includes a user role, and the first set obtaining module is specifically configured to obtain the user role corresponding to each test case, and obtain the token type set through the obtained user role.
In one embodiment, the second set obtaining module is specifically configured to perform deduplication processing on user roles corresponding to the test cases to obtain a minimum user role set, and obtain a minimum token type set according to the minimum user role set; the user roles included in the minimum user role set are different from each other.
In one embodiment, the first set obtaining module is specifically configured to traverse each test case and obtain a user identifier set in each test case; and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relationship between the pre-established identifications and the roles.
In one embodiment, the apparatus comprises:
the receiving module is used for receiving a user identifier input by a user and determining a user role selected by the user;
and the relationship establishing module is used for establishing the corresponding relationship between the identification and the role according to the user identification input by the user and the user role selected by the user.
In one embodiment, the token obtaining module includes:
the identification acquisition submodule is used for acquiring the user identification set in each test case;
and the token acquisition submodule is used for acquiring tokens corresponding to the test cases from the locally stored tokens according to the user identifications set in the test cases.
In one embodiment, the token obtaining sub-module is specifically configured to find out a user role corresponding to each test case from the minimum token type set according to the user identifier set in each test case and a correspondence between the identifier and the role; and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user roles corresponding to the test cases.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
obtaining a token type set according to a test case to be processed;
carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
temporarily storing tokens of all token types in the minimum token type set in a local place;
and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
obtaining a token type set according to a test case to be processed;
carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
temporarily storing tokens of all token types in the minimum token type set in a local place;
and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule.
According to the interface testing method, the interface testing device, the computer equipment and the storage medium, the terminal obtains the token type set according to the test case to be processed; carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; temporarily storing tokens of all token types in the minimum token type set in a local place; and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule. According to the embodiment of the disclosure, the terminal acquires tokens required by each test case from the server according to the minimum token type set, and as the number of the token types in the minimum token type set is smaller than that of the test cases through reprocessing, all the tokens are acquired at one time, and compared with the prior art in which the tokens of each test case are acquired respectively, the total acquisition time of the tokens can be reduced, so that the test time is shortened, and the test efficiency is improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for interface testing in one embodiment;
FIG. 2 is a flow chart illustrating a method for testing an interface according to an embodiment;
FIG. 3 is a flowchart illustrating a step of obtaining a user role corresponding to each test case in one embodiment;
FIG. 4 is a flowchart illustrating an interface testing method according to another embodiment;
FIG. 5 is a block diagram of an interface test apparatus according to an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
First, before specifically describing the technical solution of the embodiment of the present disclosure, a technical background or a technical evolution context on which the embodiment of the present disclosure is based is described. Generally, when a target interface is tested by using a large number of test cases, a terminal needs to obtain a token from a server once for each test case. The obtaining time of each token is similar, for example, the time required for obtaining one token is 2s, 20s is required for 10 test cases to obtain 10 tokens, and 200s is required for 100 test cases to obtain 100 tokens. Therefore, the more test cases, the more time consumed for obtaining the token, and a large amount of time consumed for obtaining the token can cause the problems of long test time, low test efficiency and the like. Based on the above situation, the applicant finds that, under the condition that the number of test cases is increased, the total acquisition time of tokens can be reduced by performing deduplication processing on the tokens to be acquired in advance according to the token types and then acquiring the tokens in batches, so that the test time is shortened and the test efficiency is improved.
The following describes technical solutions related to the embodiments of the present disclosure with reference to a scenario in which the embodiments of the present disclosure are applied.
The interface testing method provided by the embodiment of the disclosure can be applied to the application environment shown in fig. 1. The application environment comprises a terminal 102 and a server 104, wherein the terminal 102 communicates with the server 104 through a network, and a token of a test case is obtained from the server 104 according to the token type. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster composed of a plurality of servers.
In an embodiment, as shown in fig. 2, an interface testing method is provided, which is described by taking the method as an example applied to the terminal in fig. 1, and includes the following steps:
step 201, obtaining a token type set according to a test case to be processed.
Before interface testing, the terminal determines the token type corresponding to each test case to be processed, and then summarizes the token types to obtain a token type set.
For example, there are 100 test cases in total, the terminal determines that the token type corresponding to test case A1 is B1, the token type corresponding to test case a2 is B3, and the token type corresponding to test case A3 is B2 … …, and the type corresponding to test case a100 is B2. Then, the terminal counts the token types to obtain a token type set; and the number of the token types in the token type set corresponds to the number of the test cases one by one. The token type corresponding to the test case may be determined in various manners, which is not limited in the embodiment of the disclosure.
Step 202, performing deduplication processing on the same token type in the token type set to obtain a minimum token type set.
Wherein the token types in the minimum token type set are different from each other.
The same token type exists in the token type set, and in this case, the same token type may be subjected to deduplication processing, that is, only one token type is reserved in the token type set for a plurality of the same token types. After the deduplication processing is performed, the token types in the token type set are different from each other, so that a minimum token type set with the minimum token types is obtained.
It is understood that after the deduplication process, the number of token types in the minimum token type set is smaller than the number of token types in the token type set. Because the number of the token types in the token type set corresponds to the number of the test cases one by one, the number of the token types in the minimum token type set is smaller than the number of the test cases.
And step 203, temporarily storing the tokens of all the token types in the minimum token type set in a local place.
And after the terminal obtains the minimum token type set, obtaining tokens corresponding to each token type in the minimum token type set from the server at one time, and temporarily storing all the obtained tokens in the local.
For example, if there are 11 token types in the minimum token type set, the terminal obtains the corresponding token C1 from the server according to the token type B1, obtains the corresponding token C2 from the server according to the token type B2, and so on, the terminal obtains the token corresponding to each token type from the server at one time, and temporarily stores the obtained tokens in the local. The terminal acquires a plurality of tokens from the server at one time, and the token acquisition time is about 20 s.
And 204, in the interface testing process, obtaining tokens corresponding to the test cases from the local according to preset rules.
The terminal temporarily stores all the tokens required by the test cases to the local in advance. In the interface testing process, for each test case, the terminal acquires a token corresponding to the test case from the local according to a preset rule.
For example, for the test case A1, the terminal locally obtains the token C1 corresponding to the test case A1 according to a preset rule; for the test case A2, the terminal locally obtains the token C3 corresponding to the test case A2 according to the preset rule. By analogy, the terminal can obtain the token corresponding to each test case.
In the interface test method, the terminal obtains a token type set according to a test case to be processed; carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; temporarily storing tokens of all token types in the minimum token type set in a local place; and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule. According to the embodiment of the disclosure, the terminal acquires tokens required by each test case from the server according to the minimum token type set, and as the number of the token types in the minimum token type set is smaller than that of the test cases through reprocessing, all the tokens are acquired at one time, and compared with the prior art in which the tokens of each test case are acquired respectively, the total acquisition time of the tokens can be reduced, so that the test time is shortened, and the test efficiency is improved.
In an embodiment, the token type includes a user role, and the obtaining a token type set according to the test case to be processed may include: and acquiring the user roles corresponding to the test cases, and acquiring the token type set through the acquired user roles.
In practical applications, the tokens generally correspond to user roles one to one, and therefore, the user roles can be used as token types of the tokens. In this way, in the process of obtaining the token type set, the terminal obtains the user roles corresponding to the test cases, and then summarizes the obtained user roles, so as to obtain the token type set.
Correspondingly, the step of performing deduplication processing on the same token type in the token type set to obtain the minimum token type set may include: carrying out duplication elimination processing on user roles corresponding to the test cases to obtain a minimum user role set, and obtaining a minimum token type set according to the minimum user role set; wherein, the user roles contained in the minimum user role set are different from each other.
The token type set comprises a plurality of token types, namely a plurality of user roles, and the user roles have the same condition. Therefore, for the same user role in the token type set, the terminal only reserves one user role, and the minimum user role set is formed by the remaining different user roles, namely the minimum token type set is obtained.
In the embodiment, the token type includes a user role, the terminal acquires the user role corresponding to each test case, and acquires the token type set through the acquired user role; and then the terminal performs deduplication processing on the user roles corresponding to the test cases to obtain a minimum token type set. By the embodiment of the disclosure, the terminal can subsequently acquire tokens required by each test case from the server according to the minimum user role set, and because the number of the user roles in the minimum user role set is smaller than that of the test cases after reprocessing, all tokens are acquired from the server at one time according to the minimum user role set, so that the total acquisition time of the tokens can be reduced, the test time is shortened, and the test efficiency is improved.
In an embodiment, as shown in fig. 3, the step of obtaining the user role corresponding to each test case may include:
step 301, traversing each test case, and acquiring a user identifier set in each test case.
And presetting a user identifier in each test case, traversing each test case when obtaining a user role corresponding to the test case, and obtaining the set user identifier from the test case.
For example, traversing the test case A1 and the test case a2 … … to obtain that the user identifier set in the test case A1 is D1, and the user identifier set in the test case a2 is D2 … … and the user identifier set in the test case a100 is D13.
Step 302, obtaining the user role corresponding to each test case according to the user identifier set in each test case and the corresponding relationship between the pre-established identifier and the role.
And after the user identification of each test case is obtained, the terminal searches the user role corresponding to the user identification according to the corresponding relation to obtain the user role corresponding to each test case.
For example, there is a correspondence between user identity D1 and user role B1, a correspondence between user identity D2 and user role B3 … … there is a correspondence between user identity D13 and user role B2. The user identifier set by the test case A1 is D1, and according to the corresponding relation, the terminal can determine that the user role corresponding to the test case A1 is B1; the user identifier set by the test case A2 is D2, and according to the corresponding relation, the terminal can determine that the user role corresponding to the test case is B3. And by analogy, the user role corresponding to each test case is obtained.
In one embodiment, the step of establishing a correspondence between the identifier and the role in advance may include: receiving a user identification input by a user, and determining a user role selected by the user; and establishing a corresponding relation between the identification and the role according to the user identification input by the user and the user role selected by the user.
For example, the terminal receives the user identifier D1 input by the user and the user role B1 selected by the user, and then the terminal establishes a corresponding relationship between the user identifier D1 and the user role B1. The corresponding relationship between the identifier and the role may also be established in other manners, which is not limited in this common embodiment.
It is to be understood that different user identities may have a correspondence to the same user role. For example, user id D1 and user id D5 each correspond to user role B1, and user id D11, user id D12, and user id D13 each correspond to user role B2.
In one embodiment, the user identifiers set by the multiple test cases are also the same, so that after the user identifiers set in the test cases are obtained, the user identifiers can be subjected to duplicate removal processing for one time to obtain a minimum user identifier set; wherein, the user identifications in the minimum user identification set are different from each other. Therefore, after the minimum user identifier set is obtained, the user roles are obtained according to the user identifiers in the minimum user identifier set and the corresponding relation, and a plurality of user roles are obtained.
As can be understood, the number of the user identifiers can be reduced by performing deduplication processing on the user identifiers, so that the number of times of obtaining the user roles according to the corresponding relationship is reduced, and the time of obtaining all the user roles is shortened.
In the embodiment, each test case is traversed to obtain the user identification set in each test case; and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relationship between the pre-established identifications and the roles. By the embodiment of the disclosure, the user roles corresponding to the test cases can be obtained according to the corresponding relations, and then the tokens corresponding to the test cases can be obtained according to the user roles, so that the purpose of interface testing is achieved.
In an embodiment, as shown in fig. 4, an interface testing method is provided, which may include the following steps based on the above embodiments:
step 401, receiving a user identifier input by a user, and determining a user role selected by the user.
Step 402, establishing a corresponding relationship between the identifier and the role according to the user identifier input by the user and the user role selected by the user.
It can be understood that the corresponding relationship between the identifier and the role is established in advance, which is convenient for obtaining the user role corresponding to the user identifier according to the corresponding relationship in the following.
And step 403, traversing each test case to obtain the user identifier set in each test case.
And 404, obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relations between the pre-established identifications and the roles.
And 405, performing deduplication processing on the user roles corresponding to the test cases to obtain a minimum user role set, and obtaining a minimum token type set according to the minimum user role set.
It can be understood that the user role is subjected to deduplication processing, so that all tokens can be acquired at one time, and the testing time is shortened.
Step 406, in the interface testing process, obtaining the user identifier set in each test case.
Step 407, obtaining tokens corresponding to the test cases from the locally stored tokens according to the user identifiers set in the test cases.
In the above process, the correspondence between the identifier and the role is established, and the user roles correspond to the tokens one to one. In the interface testing process, after the user identification of each test case is obtained, the terminal searches out the corresponding user role in each test case from the minimum token type set according to the user identification set in each test case and the corresponding relation between the identification and the role; and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user roles corresponding to the test cases.
For example, user identity D1 corresponds to user role B1, user role B1 corresponds to token C1; user identity D2 corresponds to user role B3 and user role B3 corresponds to token C3. In the interface testing process, after acquiring the user identifier D1 of the test case A1, the terminal searches out the user role B1 corresponding to the user identifier D1 from the minimum token type set, and then locally acquires the token C1; after the user identity D2 of the test case a2 is obtained, the user role B3 corresponding to the user identity is found from the minimum token type set, and then the token C3 is obtained locally. And by analogy, the token corresponding to each test case can be obtained.
In the embodiment, the terminal establishes a corresponding relationship between the identifier and the role in advance, obtains the user role corresponding to each test case according to the corresponding relationship, and performs deduplication processing on the user role to obtain a minimum token type set; and then, the terminal acquires all standby tokens from the server at one time according to the minimum token type set and temporarily stores the acquired tokens locally. And then, the terminal can locally acquire tokens required by each test case in the interface test process. By the embodiment of the disclosure, token acquisition time can be reduced, test time is shortened, and test efficiency is improved.
It should be understood that, although the steps in the flowcharts of fig. 2 to 4 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 to 4 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the other steps or stages.
In one embodiment, as shown in fig. 5, there is provided an interface test apparatus including:
a first set obtaining module 501, configured to obtain a token type set according to a test case to be processed;
a second set obtaining module 502, configured to perform deduplication processing on the same token type in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
a token storage module 503, configured to temporarily store tokens of all token types in the minimum token type set locally;
the token obtaining module 504 is configured to obtain tokens corresponding to the test cases from the local according to a preset rule in the interface testing process.
In one embodiment, the token type includes a user role, and the first set obtaining module 501 is specifically configured to obtain the user role corresponding to each test case, and obtain the token type set according to the obtained user role.
In one embodiment, the second set obtaining module 502 is specifically configured to perform deduplication processing on user roles corresponding to each test case to obtain a minimum user role set, and obtain a minimum token type set according to the minimum user role set; the user roles included in the minimum user role set are different from each other.
In one embodiment, the first set obtaining module 502 is specifically configured to traverse each test case, and obtain a user identifier set in each test case; and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relationship between the pre-established identifications and the roles.
In one embodiment, the apparatus comprises:
the receiving module is used for receiving a user identifier input by a user and determining a user role selected by the user;
and the relationship establishing module is used for establishing the corresponding relationship between the identification and the role according to the user identification input by the user and the user role selected by the user.
In one embodiment, the token obtaining module 501 includes:
the identification acquisition submodule is used for acquiring the user identification set in each test case;
and the token acquisition submodule is used for acquiring tokens corresponding to the test cases from the locally stored tokens according to the user identifications set in the test cases.
In one embodiment, the token obtaining sub-module is specifically configured to find out a user role corresponding to each test case from the minimum token type set according to the user identifier set in each test case and a correspondence between the identifier and the role; and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user roles corresponding to the test cases.
For the specific definition of the interface testing device, reference may be made to the definition of the interface testing method above, and details are not described here. The modules in the interface testing device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement an interface testing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
obtaining a token type set according to a test case to be processed;
carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
temporarily storing tokens of all token types in the minimum token type set in a local place;
and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule.
In one embodiment, the token type includes a user role, and the processor when executing the computer program further performs the steps of:
and acquiring the user roles corresponding to the test cases, and acquiring the token type set through the acquired user roles.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
carrying out duplication elimination processing on user roles corresponding to the test cases to obtain a minimum user role set, and obtaining a minimum token type set according to the minimum user role set; the user roles included in the minimum user role set are different from each other.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
traversing each test case to obtain a user identifier set in each test case;
and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relationship between the pre-established identifications and the roles.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
receiving a user identification input by a user, and determining a user role selected by the user;
and establishing a corresponding relation between the identification and the role according to the user identification input by the user and the user role selected by the user.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a user identifier set in each test case;
and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user identifications set in the test cases.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
searching out the corresponding user role in each test case from the minimum token type set according to the user identification set in each test case and the corresponding relation between the identification and the role;
and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user roles corresponding to the test cases.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
obtaining a token type set according to a test case to be processed;
carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
temporarily storing tokens of all token types in the minimum token type set in a local place;
and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule.
In an embodiment, the token type comprises a user role, the computer program when executed by the processor further performing the steps of:
and acquiring the user roles corresponding to the test cases, and acquiring the token type set through the acquired user roles.
In one embodiment, the computer program when executed by the processor further performs the steps of:
carrying out duplication elimination processing on user roles corresponding to the test cases to obtain a minimum user role set, and obtaining a minimum token type set according to the minimum user role set; the user roles included in the minimum user role set are different from each other.
In one embodiment, the computer program when executed by the processor further performs the steps of:
traversing each test case to obtain a user identifier set in each test case;
and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relationship between the pre-established identifications and the roles.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving a user identification input by a user, and determining a user role selected by the user;
and establishing a corresponding relation between the identification and the role according to the user identification input by the user and the user role selected by the user.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a user identifier set in each test case;
and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user identifications set in the test cases.
In one embodiment, the computer program when executed by the processor further performs the steps of:
searching out the corresponding user role in each test case from the minimum token type set according to the user identification set in each test case and the corresponding relation between the identification and the role;
and obtaining tokens corresponding to the test cases from the tokens stored locally according to the user roles corresponding to the test cases.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An interface testing method, the method comprising:
obtaining a token type set according to a test case to be processed;
carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
temporarily storing tokens of all token types in the minimum token type set in a local place;
and in the interface testing process, obtaining tokens corresponding to the test cases from the local according to a preset rule.
2. The method of claim 1, wherein the token type comprises a user role, and wherein obtaining a set of token types according to the test cases to be processed comprises:
and acquiring a user role corresponding to each test case, and acquiring the token type set through the acquired user role.
3. The method of claim 2, wherein the performing de-duplication processing on the same token type in the set of token types to obtain a minimum set of token types comprises:
carrying out duplication elimination processing on the user roles corresponding to the test cases to obtain a minimum user role set, and obtaining a minimum token type set according to the minimum user role set; the user roles included in the minimum user role set are different from each other.
4. The method of claim 2, wherein the obtaining of the user role corresponding to each test case comprises:
traversing each test case to obtain a user identifier set in each test case;
and obtaining the user roles corresponding to the test cases according to the user identifications set in the test cases and the corresponding relations between the pre-established identifications and the roles.
5. The method according to claim 4, wherein before obtaining the user role corresponding to each of the test cases according to the user identifier set in each of the test cases and the correspondence between the identifier and the role established in advance, the method comprises:
receiving a user identification input by a user, and determining a user role selected by the user;
and establishing a corresponding relation between the identification and the role according to the user identification input by the user and the user role selected by the user.
6. The method according to claim 4, wherein the locally obtaining the token corresponding to each test case according to a preset rule comprises:
acquiring a user identifier set in each test case;
and obtaining tokens corresponding to the test cases from tokens stored locally according to the user identifications set in the test cases.
7. The method according to claim 6, wherein the obtaining the token corresponding to each test case from the locally stored token according to the user identifier set in each test case comprises:
searching out a user role corresponding to each test case from the minimum token type set according to a user identifier set in each test case and a corresponding relation between the identifier and the role;
and obtaining tokens corresponding to the test cases from tokens stored locally according to the user roles corresponding to the test cases.
8. An interface testing apparatus, the apparatus comprising:
the first set acquisition module is used for acquiring a token type set according to a test case to be processed;
the second set acquisition module is used for carrying out duplicate removal processing on the same token types in the token type set to obtain a minimum token type set; the token types in the minimum token type set are different from each other;
the token storage module is used for temporarily storing tokens of all token types in the minimum token type set in a local place;
and the token acquisition module is used for locally acquiring tokens corresponding to the test cases according to preset rules in the interface test process.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110284138.9A 2021-03-17 2021-03-17 Interface testing method and device, computer equipment and storage medium Active CN113051157B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110284138.9A CN113051157B (en) 2021-03-17 2021-03-17 Interface testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110284138.9A CN113051157B (en) 2021-03-17 2021-03-17 Interface testing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113051157A true CN113051157A (en) 2021-06-29
CN113051157B CN113051157B (en) 2023-02-28

Family

ID=76512902

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110284138.9A Active CN113051157B (en) 2021-03-17 2021-03-17 Interface testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113051157B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140075242A1 (en) * 2012-09-07 2014-03-13 Elena Dolinina Testing rest api applications
US20150033315A1 (en) * 2013-07-23 2015-01-29 Salesforce.Com, Inc. Authentication and diagnostic functions for a database system
CN107273528A (en) * 2017-06-28 2017-10-20 努比亚技术有限公司 A kind of front and back end separation method, mobile terminal and computer-readable recording medium
CN107957957A (en) * 2017-12-28 2018-04-24 网易(杭州)网络有限公司 The acquisition methods and device of test case
CN110198301A (en) * 2019-03-26 2019-09-03 腾讯科技(深圳)有限公司 A kind of service data acquisition methods, device and equipment
CN110209569A (en) * 2018-05-10 2019-09-06 腾讯科技(深圳)有限公司 Interface test method, interface test device and storage medium
CN110928771A (en) * 2019-10-30 2020-03-27 苏州浪潮智能科技有限公司 Method and system for timed automatic batch test of Rest interfaces
US20200250074A1 (en) * 2019-02-04 2020-08-06 Oracle International Corporation Test Orchestration Platform
CN111782527A (en) * 2020-06-30 2020-10-16 中国平安人寿保险股份有限公司 Interface testing method and device, computer equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140075242A1 (en) * 2012-09-07 2014-03-13 Elena Dolinina Testing rest api applications
US20150033315A1 (en) * 2013-07-23 2015-01-29 Salesforce.Com, Inc. Authentication and diagnostic functions for a database system
CN107273528A (en) * 2017-06-28 2017-10-20 努比亚技术有限公司 A kind of front and back end separation method, mobile terminal and computer-readable recording medium
CN107957957A (en) * 2017-12-28 2018-04-24 网易(杭州)网络有限公司 The acquisition methods and device of test case
CN110209569A (en) * 2018-05-10 2019-09-06 腾讯科技(深圳)有限公司 Interface test method, interface test device and storage medium
US20200250074A1 (en) * 2019-02-04 2020-08-06 Oracle International Corporation Test Orchestration Platform
CN110198301A (en) * 2019-03-26 2019-09-03 腾讯科技(深圳)有限公司 A kind of service data acquisition methods, device and equipment
CN110928771A (en) * 2019-10-30 2020-03-27 苏州浪潮智能科技有限公司 Method and system for timed automatic batch test of Rest interfaces
CN111782527A (en) * 2020-06-30 2020-10-16 中国平安人寿保险股份有限公司 Interface testing method and device, computer equipment and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
WEIXIN_34378767: "接口认证:Bearer Token(Token 令牌)", 《HTTPS://BLOG.CSDN.NET/WEIXIN_34378767/ARTICLE/DETAILS/93516128》, 15 May 2019 (2019-05-15), pages 1 - 2 *
朝天椒的夏天: "解决接口测试中token失效问题", 《HTTPS://BLOG.CSDN.NET/QQ_15158911/ARTICLE/DETAILS/80472954》, 28 May 2018 (2018-05-28), pages 1 - 4 *
李永新: "《Python3自动化软件发布系统》", 31 January 2020, 北京航空航天大学出版社, pages: 584 - 589 *
梦千诺: "POSTMAN接口测试", 《HTTPS://WWW.JIANSHU.COM/P/A4D09B305A1E》, 16 December 2020 (2020-12-16), pages 1 - 12 *

Also Published As

Publication number Publication date
CN113051157B (en) 2023-02-28

Similar Documents

Publication Publication Date Title
CN110008118B (en) Page data testing method and device, computer equipment and storage medium
CN112115167B (en) Cache system hot spot data access method, device, equipment and storage medium
CN109542962B (en) Data processing method, data processing device, computer equipment and storage medium
CN115310402A (en) Adaptive parasitic capacitance lookup table generation method, device and system
CN111626895A (en) Power equipment monitoring information recording method, system, device and computer equipment
CN112783866B (en) Data reading method, device, computer equipment and storage medium
CN111914101B (en) File association relationship abnormality identification method and device and computer equipment
CN112463783A (en) Index data monitoring method and device, computer equipment and storage medium
CN113268328A (en) Batch processing method and device, computer equipment and storage medium
CN113051157B (en) Interface testing method and device, computer equipment and storage medium
CN110049535B (en) Network searching method, device, equipment and storage medium
CN114567557B (en) Message processing method, device, computer equipment and storage medium
CN112149951B (en) Risk control method, apparatus, computer device and storage medium
CN114722426A (en) Data desensitization method and device, electronic equipment and storage medium
CN111124932B (en) Scheme verification method, system, device, computer equipment and storage medium
CN110677353B (en) Data access method and system
CN112416410A (en) Data management method and device for small program, computer equipment and storage medium
CN112765190A (en) IP data updating method, device, equipment and medium
CN112800123A (en) Data processing method, data processing device, computer equipment and storage medium
CN112217585A (en) Signal path determination method and device, computer equipment and storage medium
CN112165406B (en) Interface message testing method and device, computer equipment and storage medium
CN113408845B (en) Processing method and device of production flow, computer equipment and storage medium
CN112306551B (en) Historical configuration information acquisition method, system and device
CN110784479B (en) Data verification method and device, electronic equipment and storage medium
CN114866440A (en) Interface testing method and device, computer equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant