CN115098390A - Automatic testing method and device, storage medium and electronic equipment - Google Patents

Automatic testing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115098390A
CN115098390A CN202210781644.3A CN202210781644A CN115098390A CN 115098390 A CN115098390 A CN 115098390A CN 202210781644 A CN202210781644 A CN 202210781644A CN 115098390 A CN115098390 A CN 115098390A
Authority
CN
China
Prior art keywords
parameter
target
test
preset
data
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
CN202210781644.3A
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.)
Lianlian Hangzhou Information Technology Co ltd
Original Assignee
Lianlian Hangzhou Information 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 Lianlian Hangzhou Information Technology Co ltd filed Critical Lianlian Hangzhou Information Technology Co ltd
Priority to CN202210781644.3A priority Critical patent/CN115098390A/en
Publication of CN115098390A publication Critical patent/CN115098390A/en
Pending legal-status Critical Current

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
    • 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/3688Test management for test execution, e.g. scheduling of test suites
    • 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/3696Methods or tools to render software testable

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 disclosure relates to an automated testing method, an automated testing device, a storage medium and an electronic device. The automatic testing method comprises the steps of obtaining parameter information based on a testing data file, wherein the testing data file is a file which is generated based on an interface document of a target testing interface and contains parameter information, and the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value; generating a target test file based on the parameter information and at least one preset parameter check list, wherein the target test file comprises data required by a target test interface test; and carrying out automatic test on the target test interface based on the preset automatic test script and the target test file. According to the method and the device, manual parameter calibration rules do not need to be learned, test data are manually compiled, data required by automatic testing can be automatically generated, and the efficiency and the accuracy of the automatic testing are improved.

Description

Automatic testing method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of automated testing, and in particular, to an automated testing method and apparatus, a storage medium, and an electronic device.
Background
When an automatic test Framework (RF) is used for the automatic test of a project interface, a test case is tested in a test data driving mode. Dozens of different parameters exist in one test interface, various different parameter check rules exist in a single parameter, testers need to manually compile test data of the parameters one by one, check rules of all parameter types need to be known in the face of different parameter types of the interface, certain learning cost exists, and accordingly testing efficiency is low. Moreover, manual entry cannot cover all test scenes, and manual entry is prone to errors, so that the problem of inaccurate automatic test is caused.
Disclosure of Invention
In order to solve at least one technical problem mentioned above, the present disclosure proposes an automated testing method, apparatus, storage medium, and electronic device.
According to an aspect of the present disclosure, there is provided an automated testing method, including:
acquiring parameter information based on a test data file, wherein the test data file is generated based on an interface document of a target test interface and contains parameter information, and the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value;
generating a target test file based on the parameter information and at least one preset parameter check list, wherein the target test file comprises data required by the target test interface test;
and carrying out automatic test on the target test interface based on a preset automatic test script and the target test file.
In some possible embodiments, the method further comprises:
acquiring incoming parameters of a preset automatic test data generation script, wherein the incoming parameters comprise addresses of the test data files and names of the test data files;
and acquiring the test data file based on the preset automatic test data generation script, the address and the name.
In some possible embodiments, the method further comprises:
calling the preset automatic test data to generate a script based on a preset keyword;
and executing the step of acquiring parameter information based on the test data file and the step of generating a target test file based on the parameter information and a preset parameter verification list based on the preset automatic test data generation script.
In some possible embodiments, the generating a target test file based on the parameter information and at least one preset parameter check list includes:
determining a first target parameter based on the parameter type, wherein the first target parameter is a parameter of an enumeration type;
generating first target data corresponding to the first target parameter based on a first default value and a preset first parameter check list, where the first default value is a parameter default value corresponding to the first target parameter, the preset first parameter check list is a preset parameter check list corresponding to the first target parameter, and the preset first parameter check list is generated based on the first default value.
In some possible embodiments, the incoming parameters further include a writing start position, and the generating a target test file based on the parameter information and at least one preset parameter check list further includes:
determining a second target parameter in the test data file, wherein the second target parameter is any one parameter except the first target parameter;
generating default value data corresponding to an initial parameter based on a second default value, wherein the initial parameter is used for representing other parameters except the first target parameter and the second target parameter, and the second default value is a parameter default value corresponding to the initial parameter;
generating second target data corresponding to the second target parameter based on a preset second parameter check list, wherein the number of data in the second target data corresponds to the number of check rules in the preset second parameter check list, and the preset second parameter check list is a preset parameter check list corresponding to the second target parameter;
and obtaining the target test file based on the parameter name of the first target parameter, the first target data, the write initial position, the parameter name of the second target parameter, the second target data, the parameter name of the initial parameter and default value data corresponding to the initial parameter.
In some possible embodiments, the obtaining the target test file based on the parameter name of the first target parameter, the first target data, the write initial location, the parameter name of the second target parameter, the second target data, the parameter name of the initial parameter, and default value data corresponding to the initial parameter includes:
determining a third target parameter in the initial parameters;
generating third target data corresponding to the third target parameter based on a preset third parameter check list, wherein the number of data in the third target data corresponds to the number of check rules in the preset third parameter check list, and the preset third parameter check list is a preset parameter check list corresponding to the third target parameter;
and obtaining the target test file based on the parameter name of the first target parameter, the first target data, the write initial position, the parameter name of the second target parameter, the second target data, the parameter name of the third target parameter, the third target data, the parameter name of the initial parameter and default value data corresponding to the initial parameter.
In some possible embodiments, the method further comprises:
and generating the preset parameter checking list based on the parameter type and the parameter boundary value, wherein the preset parameter checking list comprises data contents corresponding to the parameter name.
According to a second aspect of the present disclosure, there is provided an automated testing apparatus, the apparatus comprising:
the device comprises a parameter information acquisition module, a parameter information acquisition module and a parameter information processing module, wherein the parameter information acquisition module is used for acquiring parameter information based on a test data file, the test data file is generated based on an interface document of a target test interface and contains parameter information, and the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value;
the target test file generation module is used for generating a target test file based on the parameter information and at least one preset parameter check list, wherein the target test file comprises data required by the target test interface test;
and the automatic test module is used for carrying out automatic test on the target test interface based on a preset automatic test script and the target test file.
According to a third aspect of the present disclosure, there is provided an electronic device comprising at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the automated testing method of any one of the first aspects by executing the instructions stored by the memory.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium having at least one instruction or at least one program stored therein, the at least one instruction or at least one program being loaded and executed by a processor to implement the automated testing method according to any one of the first aspect.
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 disclosure.
According to the method and the device, the parameter verification rule does not need to be learned manually, the test data do not need to be compiled manually one by one, the data required by the automatic test can be generated automatically, the test case of the executable parameter verification scene can be generated rapidly according to the parameter information of the target test interface, and the efficiency and the accuracy of the automatic test are improved.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions and advantages of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present specification, and other drawings can be obtained by those skilled in the art without inventive efforts.
FIG. 1 illustrates a flow diagram of an automated testing method according to an embodiment of the present disclosure;
FIG. 2 illustrates a schematic structural diagram of a test data file according to an embodiment of the present disclosure;
FIG. 3 shows a schematic flow diagram of a test data file acquisition method according to an embodiment of the present disclosure;
FIG. 4 illustrates a flow diagram for invoking a preset automated test data generation script, according to an embodiment of the present disclosure;
FIG. 5 shows a flow diagram of an enumeration-type parameter process according to an embodiment of the present disclosure;
FIG. 6 shows a flow diagram of a second target parameter process according to an embodiment of the present disclosure;
FIG. 7 shows a flow diagram of a third target parameter process according to an embodiment of the present disclosure;
FIG. 8 shows a schematic structural diagram of an automated testing apparatus according to an embodiment of the present disclosure;
FIG. 9 shows a block diagram of an electronic device in accordance with an embodiment of the disclosure;
FIG. 10 shows a block diagram of another electronic device in accordance with an embodiment of the disclosure.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments in the present description, belong to the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
An implementation environment of the present disclosure includes an automated test Framework (RF) version, which may be the 3.0.4 version.
Fig. 1 shows a schematic flow diagram of an automated testing method according to an embodiment of the present disclosure, as shown in fig. 1, the method includes:
s101, parameter information is obtained based on a test data file, the test data file is a file which is generated based on an interface document of a target test interface and contains parameter information, and the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value;
as shown in fig. 2, the test data file includes a parameter title, i.e., a parameter name, a parameter type, and a parameter default value, wherein a parameter type column further includes a parameter boundary value, the parameter type is divided by a comma, a first value of the comma division represents the parameter type, i.e., the parameter type, and a second value represents the parameter boundary value. The test data file is determined based on an interface document of the target test interface, the interface document is an instructive file of the target test interface, the interface document is used for indicating information such as types, length limitations and the like of parameters which need to be tested by a user about the target test interface, but the format of the interface document is not universal, so the test data file is established based on the interface document, and the format of the test data file comprises an electronic spreadsheet Excel format.
And acquiring parameter information of the target test interface through the test data file, wherein the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value. For example, the parameter name is a signature key value "key" of a merchant, the name "mchtName" of an access party merchant, an identity number of an enterprise legal person or an identity number "IdNo" of a personal responsible person, and the like, the corresponding parameter boundary values are "1", "60", and "18", and the like, the corresponding parameter default values include "miicdwibdanbgq", "test merchant name", and "342426198409283635", and the like, the parameter default values conform to parameter values required by a target test interface, and when different rules are checked for a specific parameter, other parameters are given corresponding parameter default values.
S102, generating a target test file based on the parameter information and at least one preset parameter check list, wherein the target test file comprises data required by a target test interface test;
and generating data, namely test data, required by a target test interface according to the parameter name, the parameter type, the parameter default value and the parameter boundary value read by the test data file and by combining a preset parameter check list of each parameter, and writing the test data into the test data file to obtain the target test file.
S103, carrying out automatic testing on the target testing interface based on the preset automatic testing script and the target testing file.
And obtaining a target test file containing test data, calling a preset automatic test script, and carrying out related test on a target test interface based on the test data.
According to the method and the device, the parameter verification rules do not need to be learned manually, the test data do not need to be compiled manually one by one, the data required by the automatic test can be generated automatically, the test cases of the executable parameter verification scene can be generated quickly according to the parameter information of the target test interface, and the efficiency and the accuracy of the automatic test are improved.
Referring to fig. 3, in one embodiment, the method further includes:
s201, acquiring incoming parameters of a preset automatic test data generation script, wherein the incoming parameters comprise addresses of test data files and names of the test data files;
s202, generating a script, an address and a name based on preset automatic test data to obtain a test data file.
The address of the test data file and the name of the test data file are incoming parameters of a preset automatic test data generation script, and when the preset automatic test data generation script is called and executed, the test data file is positioned according to the address and the name of the incoming parameter test data file. For example, the preset automatic test data generation script is "create _ test _ data (self, file _ name, sheet _ name, case)", where file _ name is an address of the test data file, and sheet _ name is a name of the test data file.
Test data required by the target test interface is automatically generated by calling the script for generating the test data, manual writing is not needed, and the test efficiency is improved.
Referring to fig. 4, in one embodiment, the method further includes:
s301, calling a preset automatic test data to generate a script based on a preset keyword;
s302, executing a step of acquiring parameter information based on the test data file and a step of generating a target test file based on the parameter information and a preset parameter check list based on a preset automatic test data generation script.
The method includes the steps that keywords are packaged in advance, the preset keywords include names of preset automatic test data generation scripts, for example, the preset automatic test data generation scripts are 'create _ test _ data (self, file _ name, sheet _ name, case)', when a target test interface is tested, the preset automatic test generation scripts are called according to the keywords 'create _ test _ data', and addresses and names of test data files are transmitted into the preset automatic test generation scripts so as to generate test data required by the target test interface. The method for generating data through the preset automatic test generation script comprises the following steps: acquiring parameter information based on the test data file; and generating a target test file based on the parameter information and a preset parameter check list.
The packaged keywords for generating the test data are introduced, one-click type and foolproof calling is achieved through the keywords, the checking rule of each parameter type does not need to be known, the test data required by each test case does not need to be prepared in a row, and the test efficiency and the test accuracy are improved.
Referring to fig. 5, in an embodiment, generating a target test file based on parameter information and at least one preset parameter check list includes:
s401, determining a first target parameter based on the parameter type, wherein the first target parameter is a parameter of an enumeration type;
s402, generating first target data corresponding to a first target parameter based on a first default value and a preset first parameter check list, wherein the first default value is a parameter default value corresponding to the first target parameter, the preset first parameter check list is a preset parameter check list corresponding to the first target parameter, and the preset first parameter check list is generated based on the first default value.
Determining a parameter of an enumeration type in the test data file according to a parameter type in the parameter information, taking the parameter as a first target parameter, obtaining a parameter default value corresponding to the first target parameter, taking the parameter default value as a first default value, segmenting elements in the first default value through preset symbols, and determining a target element, wherein the target element is any one of the segmented elements in the first default value. For example, the parameter of the enumeration type, that is, the parameter name of the first target parameter, is the account type "accountType", and the corresponding parameter default value is the first default value "01", where "0" represents a public user and "1" represents a private user, and at this time, the element in the first default value "01" is divided by a preset symbol "| @ |" to obtain "0 | @ | 1". The first element of the first default value is taken as the target element, i.e. "0" is the target element. And taking the target element as a default value corresponding to the first target parameter.
Establishing a first parameter checking list corresponding to the first target parameter according to the first default value, that is, all elements in the first default value are elements in the preset first parameter checking list, for example, if the first default value is "01", the elements in the preset first parameter checking list include "0" and "1".
When the first target parameter of the enumeration type is not checked, the first target data corresponding to the first target parameter are target elements, and when the first target parameter is checked, data corresponding to elements in a preset first parameter check list are respectively generated. For example, the first default value of the first target parameter is "01", the target element is "0", and the preset first parameter check list is "01", so that the first target data corresponding to the first target parameter includes "0" and "1".
And all elements of the parameter default values of the enumeration type are comprehensively tested, so that the test is more accurate and comprehensive.
Referring to fig. 6, in an embodiment, the incoming parameters further include a write start position, and the generating of the target test file based on the parameter information and at least one preset parameter check list further includes:
s501, determining a second target parameter in the test data file, wherein the second target parameter is any one of parameters except the first target parameter;
s502, generating default value data corresponding to initial parameters based on second default values, wherein the initial parameters are used for representing other parameters except for the first target parameters and the second target parameters, and the second default values are parameter default values corresponding to the initial parameters;
s503, generating second target data corresponding to a second target parameter based on a preset second parameter check list, wherein the number of data in the second target data corresponds to the number of check rules in the preset second parameter check list, and the preset second parameter check list is a preset parameter check list corresponding to the second target parameter;
s504, obtaining a target test file based on the parameter name of the first target parameter, the first target data, the write-in initial position, the parameter name of the second target parameter, the second target data, the parameter name of the initial parameter and default value data corresponding to the initial parameter.
And determining another parameter except the first target parameter in the test data file as a second target parameter, and verifying the second target parameter. The first target parameter is a parameter of an enumeration type as a special process, and therefore, the parameter of the enumeration type is excluded, and the second target parameter is determined. When the second target parameter is checked, the default value data corresponding to the initial parameter, which is the other parameters except the first target parameter and the second target parameter in the test data file, needs to be assigned by using the corresponding parameter default value. For example, the parameter name is a merchant signature key value "key", the access party merchant name "mchtName" and an enterprise legal person identity number or a personal responsible person identity number "IdNo", etc., the corresponding parameter default values include "miicdwibdanbgq", "testing merchant name" and "342426198409283635", etc., when the parameter name is the signature key value "key" is verified, the signature key value "key" is a second target parameter, the initial parameter includes the access party merchant name "mchtName" and the enterprise legal person identity number or the personal responsible person identity number "IdNo", and the second default value includes the testing merchant name "and" 342426198409283635 ", therefore, the default value data corresponding to the access party merchant name" mchtName "is the" testing merchant name ", and the enterprise legal person identity number or the personal responsible person identity number" IdNo "is" 342426198409283635 ".
And generating second target data corresponding to the second target parameter based on a preset second parameter verification list, wherein the preset second parameter verification list needs to be generated by calling a parameter verification list generation script, the preset second parameter verification list comprises test data to be tested by the target test interface, and the preset second parameter verification list is used for correcting the second target data corresponding to the second target parameter. And the number of data in the second target data is the same as the number of the check rules in the preset second parameter check list, for example, the preset second parameter check list includes a check rule "get _ cfg _ key _ notMatchi", and thus, the second target data includes a piece of "get _ cfg _ key _ notMatchi" data.
The test data can be automatically generated by calling the preset automatic test data generation script without knowing the check rule of each parameter type and preparing the test data required by each test case, so that the test efficiency is improved.
Referring to fig. 7, in an embodiment, obtaining a target test file based on a parameter name of a first target parameter, first target data, a write initial position, a parameter name of a second target parameter, second target data, a parameter name of an initial parameter, and default value data corresponding to the initial parameter includes:
s505, determining a third target parameter in the initial parameters;
s506, generating third target data corresponding to a third target parameter based on a preset third parameter check list, wherein the number of data in the third target data corresponds to the number of check rules in the preset third parameter check list, and the preset third parameter check list is a preset parameter check list corresponding to the third target parameter;
s507, obtaining a target test file based on the parameter name of the first target parameter, the first target data, the write-in initial position, the parameter name of the second target parameter, the second target data, the parameter name of the third target parameter, the third target data, the parameter name of the initial parameter and default value data corresponding to the initial parameter.
And continuously determining a third target parameter from the initial parameters in the test data file, wherein the data of the third target parameter is corresponding default value data, and correcting the default value data of the third target parameter according to a preset third parameter check list to obtain third target data. For example, the initial parameters include the parameter name of the initial parameter, which includes the access party merchant name "mchtName" and the enterprise legal person identity number or the personal responsible person identity number "IdNo", the access party merchant name "mchtName" is determined to be the second target parameter, the preset third parameter check list is "tester a, tester b, 123, testname", and the third target data corresponding to the third target parameter includes "tester a, tester b, 123, testname".
And continuously checking the remaining initial parameters according to the requirements of the target test interface until all the parameters required by the target test interface are checked, wherein the data corresponding to the unverified parameters are still default value data. After the enumerated type parameters and other types of parameters are verified as required, parameter names corresponding to all the parameters and data corresponding to the parameters are written into the positions corresponding to the test data files according to another transmitted parameter 'write-in initial position', and therefore the target test files are obtained.
The method and the device do not need to manually learn parameter calibration rules and manually compile test data, can automatically generate data required by the automatic test, and improve the efficiency and the accuracy of the automatic test
In one embodiment, the method further comprises:
and generating a preset parameter check list based on the parameter type and the parameter boundary value, wherein the preset parameter check list comprises data contents corresponding to the parameter name.
When parameter verification is carried out on a single parameter of the interface, other parameters of the interface are assigned with normal default values, a default value list of all the parameters is read in the first step, the target test interface has a preset number of parameters, and the length of the default value list is equal to the preset number. The method comprises the following steps that the enumeration type parameters have particularity, the default values of the enumeration type parameters are all transmitted at one time, the default value parameters are divided by | @ | and the divided first value is taken as the default value data of the parameters. And calling a parameter verification list generation script, and generating a preset parameter verification list based on the parameter type and the parameter boundary value. According to the verification rules which are defined in advance according to different parameter types, a parameter verification list required by a single parameter is obtained by combining with a length rule, and the parameter verification list of the enumeration type is obtained according to the corresponding element of the parameter default value. The preset parameter check list includes data content corresponding to the parameter name, for example, the parameter name is mailbox "Email", the preset parameter check list corresponding to the mailbox "Email" is "qq, 123,001@,00dd1@.e3, Email163.com, Email @163 com", and the data content of the corresponding mailbox "Email" is set according to the preset parameter check list, so that the data content of the mailbox "Email" includes "qq, 123,001@,00dd1@.e3, Email163.com, and Email @163 com".
The method has the advantages that the keywords of the automatic test data generation script packaged with the parameter verification list are introduced, after the keywords of the method are executed, the test data of the target test interface can be automatically generated according to the verification rule, the related tests are executed, and the test case of the executable parameter verification scene is quickly generated, so that the efficiency of functional test is greatly improved, and one-click and foolproof compiling of the test data is realized.
Referring to fig. 8, according to a second aspect of the present disclosure, an automatic testing apparatus is provided, the apparatus comprising:
a parameter information obtaining module 10, configured to obtain parameter information based on a test data file, where the test data file is a file that is generated based on an interface document of a target test interface and contains parameter information, and the parameter information includes a parameter name, a parameter type, a parameter default value, and a parameter boundary value;
a target test file generating module 20, configured to generate a target test file based on the parameter information and at least one preset parameter check list, where the target test file includes data required by a target test interface test;
and the automatic test module 30 is configured to perform an automatic test on the target test interface based on a preset automatic test script and a target test file.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
The embodiment of the present disclosure also provides a computer-readable storage medium, where at least one instruction or at least one program is stored in the computer-readable storage medium, and the at least one instruction or the at least one program is loaded by a processor and executed to implement the method. The computer readable storage medium may be a non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured as the method.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 9 shows a block diagram of an electronic device in accordance with an embodiment of the disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
Referring to fig. 9, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user as described above. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of the touch or slide action but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the above-mentioned communication component 816 further comprises a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
FIG. 10 shows a block diagram of another electronic device in accordance with an embodiment of the disclosure. For example, the electronic device 1900 may be provided as a server. Referring to fig. 10, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, that are executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may further include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer-readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as punch cards or in-groove raised structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device over a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the disclosure are implemented by personalizing an electronic circuit, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA), with state information of computer-readable program instructions, which can execute the computer-readable program instructions.
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1. An automated testing method, the method comprising:
acquiring parameter information based on a test data file, wherein the test data file is generated based on an interface document of a target test interface and contains parameter information, and the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value;
generating a target test file based on the parameter information and at least one preset parameter check list, wherein the target test file comprises data required by the target test interface test;
and carrying out automatic test on the target test interface based on a preset automatic test script and the target test file.
2. The method of claim 1, further comprising:
acquiring incoming parameters of a preset automatic test data generation script, wherein the incoming parameters comprise addresses of the test data files and names of the test data files;
and acquiring the test data file based on the preset automatic test data generation script, the address and the name.
3. The method of claim 2, further comprising:
calling the preset automatic test data to generate a script based on a preset keyword;
and executing the step of acquiring parameter information based on the test data file and the step of generating a target test file based on the parameter information and a preset parameter verification list based on the preset automatic test data generation script.
4. The method of claim 2, wherein generating a target test file based on the parameter information and at least one preset parameter check list comprises:
determining a first target parameter based on the parameter type, wherein the first target parameter is a parameter of an enumeration type;
generating first target data corresponding to the first target parameter based on a first default value and a preset first parameter check list, where the first default value is a parameter default value corresponding to the first target parameter, the preset first parameter check list is a preset parameter check list corresponding to the first target parameter, and the preset first parameter check list is generated based on the first default value.
5. The method of claim 4, wherein the incoming parameters further include a write start location, wherein generating a target test file based on the parameter information and at least one preset parameter check list further comprises:
determining a second target parameter in the test data file, wherein the second target parameter is any one parameter except the first target parameter;
generating default value data corresponding to initial parameters based on second default values, wherein the initial parameters are used for representing other parameters except the first target parameters and the second target parameters, and the second default values are parameter default values corresponding to the initial parameters;
generating second target data corresponding to the second target parameter based on a preset second parameter check list, wherein the quantity of data in the second target data corresponds to the quantity of check rules in the preset second parameter check list, and the preset second parameter check list is a preset parameter check list corresponding to the second target parameter;
and obtaining the target test file based on the parameter name of the first target parameter, the first target data, the write-in initial position, the parameter name of the second target parameter, the second target data, the parameter name of the initial parameter and default value data corresponding to the initial parameter.
6. The method of claim 5, wherein obtaining the target test file based on the parameter name of the first target parameter, the first target data, the write initial location, the parameter name of the second target parameter, the second target data, the parameter name of the initial parameter, and default value data corresponding to the initial parameter comprises:
determining a third target parameter in the initial parameters;
generating third target data corresponding to the third target parameter based on a preset third parameter check list, wherein the number of data in the third target data corresponds to the number of check rules in the preset third parameter check list, and the preset third parameter check list is a preset parameter check list corresponding to the third target parameter;
and obtaining the target test file based on the parameter name of the first target parameter, the first target data, the write initial position, the parameter name of the second target parameter, the second target data, the parameter name of the third target parameter, the third target data, the parameter name of the initial parameter and default value data corresponding to the initial parameter.
7. The method of claim 1, further comprising:
and generating the preset parameter checking list based on the parameter type and the parameter boundary value, wherein the preset parameter checking list comprises data contents corresponding to the parameter name.
8. An automated testing apparatus, the apparatus comprising:
the system comprises a parameter information acquisition module, a parameter information acquisition module and a parameter information processing module, wherein the parameter information acquisition module is used for acquiring parameter information based on a test data file, the test data file is generated based on an interface document of a target test interface and contains parameter information, and the parameter information comprises a parameter name, a parameter type, a parameter default value and a parameter boundary value;
the target test file generation module is used for generating a target test file based on the parameter information and at least one preset parameter check list, wherein the target test file comprises data required by the target test interface test;
and the automatic test module is used for carrying out automatic test on the target test interface based on a preset automatic test script and the target test file.
9. A computer-readable storage medium, wherein at least one instruction or at least one program is stored in the computer-readable storage medium, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the automated testing method according to any one of claims 1 to 7.
10. An electronic device comprising at least one processor, and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the at least one processor implementing the automated testing method of any of claims 1-7 by executing the instructions stored by the memory.
CN202210781644.3A 2022-07-04 2022-07-04 Automatic testing method and device, storage medium and electronic equipment Pending CN115098390A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210781644.3A CN115098390A (en) 2022-07-04 2022-07-04 Automatic testing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210781644.3A CN115098390A (en) 2022-07-04 2022-07-04 Automatic testing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115098390A true CN115098390A (en) 2022-09-23

Family

ID=83297002

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210781644.3A Pending CN115098390A (en) 2022-07-04 2022-07-04 Automatic testing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115098390A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055350A (en) * 2023-01-03 2023-05-02 重庆长安汽车股份有限公司 Json-based data communication quality detection method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116055350A (en) * 2023-01-03 2023-05-02 重庆长安汽车股份有限公司 Json-based data communication quality detection method
CN116055350B (en) * 2023-01-03 2024-05-14 重庆长安汽车股份有限公司 Json-based data communication quality detection method

Similar Documents

Publication Publication Date Title
CN110647834B (en) Human face and human hand correlation detection method and device, electronic equipment and storage medium
CN110941942B (en) Circuit schematic diagram inspection method, device and system
CN114240882A (en) Defect detection method and device, electronic equipment and storage medium
CN106919629B (en) Method and device for realizing information screening in group chat
CN111554382A (en) Medical image processing method and device, electronic equipment and storage medium
CN111898676A (en) Target detection method and device, electronic equipment and storage medium
CN114741292A (en) Test script management method and device, electronic equipment and storage medium
CN115098390A (en) Automatic testing method and device, storage medium and electronic equipment
CN116069612A (en) Abnormality positioning method and device and electronic equipment
CN106790683B (en) Network data display method and device based on mobile terminal
CN110221813B (en) Application data connection establishment method and device, storage medium and electronic equipment
CN109992503B (en) Automatic testing method and device
CN116069575B (en) Adapter testing method and device, electronic equipment and storage medium
CN110333903B (en) Method and device for determining page loading duration
CN110659625A (en) Training method and device of object recognition network, electronic equipment and storage medium
CN112383661B (en) Mobile terminal automatic test method and device, electronic equipment and storage medium
CN113378893B (en) Data management method and device, electronic equipment and storage medium
CN106354595B (en) Mobile terminal, hardware component state detection method and device
CN113810240B (en) Communication protocol analysis method, device and computer readable storage medium
CN110765111B (en) Storage and reading method and device, electronic equipment and storage medium
CN107145441B (en) Page display method and device
CN110196747B (en) Information processing method and device
CN113869295A (en) Object detection method and device, electronic equipment and storage medium
WO2020164261A1 (en) Quality control method and apparatus for liquid quality detection result
CN112381223A (en) Neural network training and image processing method and device

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