CN114064486B - Automatic interface testing method - Google Patents

Automatic interface testing method Download PDF

Info

Publication number
CN114064486B
CN114064486B CN202111368168.4A CN202111368168A CN114064486B CN 114064486 B CN114064486 B CN 114064486B CN 202111368168 A CN202111368168 A CN 202111368168A CN 114064486 B CN114064486 B CN 114064486B
Authority
CN
China
Prior art keywords
interface protocol
test
determining
field
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.)
Active
Application number
CN202111368168.4A
Other languages
Chinese (zh)
Other versions
CN114064486A (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.)
Beijing Jinghang Computing Communication Research Institute
Original Assignee
Beijing Jinghang Computing Communication Research Institute
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 Beijing Jinghang Computing Communication Research Institute filed Critical Beijing Jinghang Computing Communication Research Institute
Priority to CN202111368168.4A priority Critical patent/CN114064486B/en
Publication of CN114064486A publication Critical patent/CN114064486A/en
Application granted granted Critical
Publication of CN114064486B publication Critical patent/CN114064486B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Maintenance And Management Of Digital Transmission (AREA)

Abstract

The invention discloses an automatic interface testing method, which belongs to the technical field of embedded software testing, and can automatically generate expected results corresponding to interface protocol fields so as to realize the automatic interface testing method. The method comprises the following steps: determining a precompiled file corresponding to the interface protocol field; the precompiled file is compiled by a precompiled language and comprises a mapping relation between the interface protocol field and an expected result of the test case; and calling the precompiled file, outputting the expected result through the precompiled file, determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case, and determining whether an interface test passes according to whether the test case passes the test.

Description

Automatic interface testing method
Technical Field
The invention relates to the technical field of embedded software testing, in particular to an automatic interface testing method.
Background
Interface testing refers to testing conducted to evaluate whether a system or component is able to communicate data and control information correctly with each other. The interface test is performed by testing all external interfaces and checking the format and content of interface information. Testing for normal and abnormal conditions is required for each external input/output interface, for example, testing whether the interface provided by hardware is convenient to use, and testing the influence of system characteristics (such as data characteristics, error characteristics and speed characteristics) on software functions and performance characteristics.
The existing embedded system interface test method is based on various models and frameworks, test cases are automatically generated, test programs are automatically executed to obtain test results, and some automatic test methods can also generate simple test reports to indicate whether the test cases pass or not. The existing simple expected result can be automatically generated, however, the expected result with complex logic cannot be automatically generated, or manual input is needed, and automatic test cannot be realized.
Disclosure of Invention
In view of the above analysis, the embodiment of the present invention aims to provide an interface automation test method, which can automatically generate an expected result corresponding to an interface protocol field, thereby implementing the interface automation test method.
The invention discloses an automatic interface testing method, which comprises the following steps:
determining a precompiled file corresponding to the interface protocol field; the precompiled file is compiled by a precompiled language and comprises a mapping relation between the interface protocol field and an expected result of the test case;
and calling the precompiled file, outputting the expected result through the precompiled file, determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case, and determining whether an interface test passes according to whether the test case passes the test.
Further, the determining whether the test case passes the test according to the expected result and the comparison result of the test case, including:
inputting the expected result and the test result to a feature discrimination model established based on multi-source feature fusion; the feature discrimination model is established after the multisource features are extracted from a sample problem report in advance and are associated and fused, and can automatically generate a model of the problem report corresponding to the fused associated feature value;
and determining whether the test case passes the test according to the output result of the characteristic discrimination model.
Further, after the step of determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case, the interface automation test method further includes:
if the test fails, determining target characteristics which influence the failure of the test, and determining target associated characteristics according to the target characteristics;
and determining a fused target association characteristic value according to the target association characteristic, and generating a target problem report corresponding to the target association characteristic value.
Further, the process of pre-establishing the feature discrimination model comprises the following steps:
extracting features from the sample problem report, and carrying out feature association on the features to obtain associated features;
and fusing the association characteristic values of the association characteristics to obtain fused association characteristic values, and establishing a mapping relation between the problem report sheets corresponding to the fused association characteristic values.
Further, before the step of determining the pre-translated document corresponding to the interface protocol field, the interface automation test method further includes:
selecting an interface protocol to be selected from a problem report database, determining the similarity degree of the interface protocol to be selected and the current test interface protocol, and determining an associated interface protocol corresponding to the current test interface protocol according to the similarity degree;
and determining an associated problem report form in which the associated interface protocol is located, selecting a failed test case from the associated problem report form, and taking the failed test case as the test case.
Further, the determining the similarity degree between the candidate interface protocol and the current test interface protocol includes:
and determining the similarity according to the constraint conditions of field information and each field information in the interface protocol field of the interface protocol to be selected and the interface protocol of the current test interface protocol.
Further, the determining the similarity according to the constraint condition of comparing the field information and the field information in the interface protocol field of the candidate interface protocol and the current test interface protocol includes:
if the interface protocol to be selected is the same as the field information in the interface protocol field of the current test interface protocol, continuing to compare constraint conditions of the field information;
if the constraint conditions are the same, determining that the similarity degree is the same;
if the constraint conditions are not the same, determining the similarity according to the data threshold values of the different constraint conditions;
if the field information in the interface protocol field of the interface protocol to be selected is not the same as that in the interface protocol field of the current test interface protocol, directly determining that the similarity degree is different.
Further, the determining the similarity according to the data threshold of the different constraint conditions includes:
if the data threshold is an upper threshold and the value of the interface protocol field to be selected is larger than the value of the current test interface protocol field, determining that the similarity degree is dissimilar;
if the data threshold is an upper threshold and the value of the interface protocol field to be selected is smaller than or equal to the value of the current test interface protocol field, determining that the similarity degree is similar;
if the data threshold is a lower threshold and the value of the interface protocol field to be selected is smaller than the value of the current test interface protocol field, determining that the similarity degree is dissimilar;
and if the data threshold is a lower threshold and the value of the interface protocol field to be selected is greater than or equal to the value of the current test interface protocol field, determining that the similarity degree is similar.
Further, the determining, according to the similarity degree, an associated interface protocol corresponding to the current test interface protocol includes:
and determining the candidate interface protocols with the same or similar degrees of similarity as the associated interface protocol.
Further, before the step of determining the pre-translated document corresponding to the interface protocol field, the interface automation test method further includes:
and selecting the test case with at least two interface protocol fields being abnormal values at the same time as the test case.
Compared with the prior art, the invention has at least one of the following beneficial effects:
the interface automation test method provided by the embodiment of the invention determines the precompiled file corresponding to the interface protocol field; and calling the precompiled file, outputting an expected result through the precompiled file, and determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case. The method can automatically generate the expected result corresponding to the interface protocol field, thereby realizing the automatic test method of the interface.
The coverage rate of the test cases and the key test cases are increased, and the test efficiency and the problem detection rate are improved.
The expected result can be automatically generated, manual input is less, and the test efficiency is improved.
And automatically judging the test result, automatically generating a problem report, and further improving the test efficiency.
In the invention, the technical schemes can be mutually combined to realize more preferable combination schemes. Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, like reference numerals being used to refer to like parts throughout the several views.
FIG. 1 is a flow chart of an automated interface testing method in an embodiment of the present invention;
FIG. 2 is a diagram illustrating the interface protocol fields in an embodiment of the present invention;
FIG. 3 (a) is a schematic diagram illustrating a test case according to an embodiment of the present invention;
FIG. 3 (b) is a schematic diagram illustrating the expected results in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a feature discrimination model establishment process in an embodiment of the invention;
FIG. 5 is a flow chart of test case generation in an embodiment of the invention.
Detailed Description
Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form a part hereof, and together with the description serve to explain the principles of the invention, and are not intended to limit the scope of the invention.
The invention discloses an automatic interface testing method, which is shown in fig. 1 in a flow chart and comprises the following steps:
step S1: determining a precompiled file corresponding to the interface protocol field; the precompiled file is compiled using a precompiled language and includes a mapping between the interface protocol fields and expected results of the test case.
Step S2: and calling the precompiled file, outputting the expected result through the precompiled file, determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case, and determining whether an interface test passes according to whether the test case passes the test.
The method of the embodiment of the invention can be executed in a test system, and further, the interface automation test method can be executed based on the embedded system.
In step S1, as shown in fig. 2, the interface protocol field includes custom fields such as a frame header, a start flag, and a current. Constraint conditions include a fixed value, a value range, a value type and the like, for example, a frame header is a fixed value of 0xFFEE; the value range of the current is a floating point type number of 0-3A, and the length is 4 bytes; the time range is an integer from 0000 to 2459, and the length is 2 bytes.
Script files of precompiled language compilation models such as Visual Studio, eclipse or matlab can be used to process test cases and generate expected results. For example, the test case is set as A, matlab software is used for processing the test case, and the processing flow of the test case in the tested system is written into an'm' file by using C language. The processing flow of the test case in the tested system can be compiled into the'm' files, and each'm' file corresponds to the interface protocol field one by one, so that the expected result with complex logic can be automatically generated.
According to the number of the interface protocol fields, writing a corresponding number of m files, wherein each interface protocol field corresponds to one type of test case and one m file. For example, if the decompressed data in the interface protocol is correct, the mapping relation between the compressed data in the test cases and the decompressed data in the expected result needs to be written into a "decompression.m" file by matlab, and all test cases of the compressed data field in the test interface protocol use the "decompression.m" file to generate the expected result.
In step S2, the method calls the ". M" file, and inputs the test case A into the ". M" file to obtain the expected resultAs shown in fig. 3 (a), for example, when compressed data needs to be tested, the corresponding field of the test case is EA 78E 3B 78 c01 2d29, the test case a is 0xFFEE FFEA 0A0B EA78 E3B7 8C01 2D29 04CE FFEE, the corresponding ". M" file is called, and the ". M" file realizes that the compressed data is decompressed, as shown in fig. 3 (B), the expected result is 0xFFEE FFEA 00B6 012F 5171CA56 F017 8734 8A4F 0R5CDE72 04D1 FFEE.
It will be appreciated that the test cases are changed according to the test requirements, the interface protocol is fixed, and the data in the interface protocol field is changed according to the test requirements.
Referring to fig. 3 (a) and 3 (b), the number of interface protocol fields is 7, and the number of corresponding ". M" files is 7, for example, current corresponds to m file 1, voltage corresponds to m file 2, and compressed and decompressed data corresponds to m file 3. The frame head, the frame tail, the start mark and the like are fixed and do not need to be tested, but the corresponding m files can be precompiled and can be used as redundancy guarantee, and if the frame head, the frame tail, the start mark and the like need to be tested in the test, the m files can be called to generate expected results.
If the expected result and the comparison result of the test result are the same, determining that the test case passes the test; if the expected result and the comparison result of the test result are different, the test case is determined to be failed. The expected result and the test result can be compared through the technologies of feature recognition and the like to obtain a comparison result, and whether the test case passes the test is further determined.
The interface test is realized by testing a plurality of test cases, the test cases are covered as comprehensively as possible and all pass the test, and then the interface test passes.
If the test case fails the full pass, and/or if not as full coverage test is required, the interface test fails.
Further, the determining whether the test case passes the test according to the expected result and the comparison result of the test case, including:
inputting the expected result and the test result to a feature discrimination model established based on multi-source feature fusion; the feature discrimination model is a model which is established after multi-source features are extracted from a sample problem report in advance and are associated and fused, and can automatically generate a problem report corresponding to the fused associated feature value; as shown in fig. 4, the sample problem report corresponds to the problem report in fig. 4, and the problem report is a problem report obtained by classifying and summarizing test cases that have not passed the test after the test cases have been tested. The sample problem report is used as a training sample in the process of training the feature discrimination model.
The sample problem report comprises a large number of multi-source features, the multi-source features are closely related to each other, the multi-source features which are closely related to each other need to be extracted to obtain related features, the related features are fused to obtain feature values of the fused related features, mapping relations between the feature values and the corresponding problem report are established, and feature discrimination models, namely decision discrimination problem types in the corresponding figure 4, are established according to the mapping relations.
And determining whether the test case passes the test according to the output result of the characteristic discrimination model. The feature discrimination model can realize feature recognition on the expected result and the test result, and output a feature recognition result, namely if the feature recognition result is that all the features are completely matched, determining that the test case passes the test; if the feature recognition result is that the features are not completely matched, determining that the test case fails the test.
Further, after the step of determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case, the interface automation test method further includes:
if the test fails, determining target characteristics which influence the failure of the test, and determining target associated characteristics according to the target characteristics; if the target feature which is not passed by the influence test in the problem report is the error type (B), the target associated feature which is associated with the error type (B) is provided with a model (A), a problem name (C) and a problem grade (D), and the method for determining the feature association can be selected as the existing conventional method such as a similarity method.
If the number of sample problem report forms is three, the characteristic value of each sample problem report form is (a) 1 b 1 c 1 d 1 )、(a 2 b 2 c 2 d 2 )、(a 3 b 3 c 3 d 3 ). After fusion (a) 1 b 1 c 1 d 1 )、(a 1 b 1 c 1 d 2 )、(a 1 b 1 c 1 d 3 )、(a 1 b 1 c 2 d 1 )、(a 1 b 1 c 3 d 1 )、(a 1 b 2 c 1 d 1 )、(a 1 b 3 c 1 d 1 )……(a 3 b 3 c 3 d 3 ) 81 (3X 3) categories total, respectively corresponding to 81 groups of associated characteristic values, the 81 sets of associated feature values correspond to 81 problem reports.
And determining a fused target association characteristic value according to the target association characteristic, and generating a target problem report corresponding to the target association characteristic value. If the target association characteristic value is (a) 1 b 1 c 1 d 2 ) Then determine (a) 1 b 1 c 1 d 2 ) The corresponding target problem report is a problem report 2; if the target association characteristic value is (a) 1 b 1 c 2 d 1 ) Then determine (a) 1 b 1 c 2 d 1 ) The corresponding target issue report is issue report 4.
Further, the process of pre-establishing the feature discrimination model comprises the following steps:
extracting features from the sample problem report, and carrying out feature association on the features to obtain associated features; the sample problem report should cover the comprehensive features as much as possible, namely the multi-source features, the number of the sample problem reports can be set independently, and can be three, and the associated features in the three sample problem reports comprise, for example, 4 types of model (A), error type (B), problem name (C) and problem grade (D).
And fusing the association characteristic values of the association characteristics to obtain fused association characteristic values, and establishing a mapping relation between the fused association characteristic values and the problem report corresponding to the fused association characteristic values. The associated feature value of each sample problem report is (a) 1 b 1 c 1 d 1 )、(a 2 b 2 c 2 d 2 )、(a 3 b 3 c 3 d 3 ). After fusion (a) 1 b 1 c 1 d 1 )、(a 1 b 1 c 1 d 2 )、(a 1 b 1 c 1 d 3 )、(a 1 b 1 c 2 d 1 )、(a 1 b 1 c 3 d 1 )、(a 1 b 2 c 1 d 1 )、(a 1 b 3 c 1 d 1 )……(a 3 b 3 c 3 d 3 ) 81 (3X 3) categories total, corresponding to 81 groups of associated characteristic values, 81 groups of problem report forms, when the test result is compared with the expected result, if the test result and the expected result are consistent, the test is considered to pass, and no problem exists; if not, the test is considered to be failed, and a problem report needs to be generated.
At the moment, the fused association characteristic values are determined according to the error types, the problem names, the problem types and the models of the test, which are generated by comparison, so that the corresponding target problem report is determined, and finally, the problem report of the test case is generated according to the target problem report.
Compared with the prior art, the interface automation test method provided by the embodiment of the invention determines the precompiled file corresponding to the interface protocol field; and calling the precompiled file, outputting an expected result through the precompiled file, and determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case. The method can automatically generate the expected result corresponding to the interface protocol field, thereby realizing the automatic test method of the interface.
Further, before the step of determining the pre-translated document corresponding to the interface protocol field, the interface automation test method further includes:
selecting an interface protocol to be selected from a problem report database, determining the similarity degree of the interface protocol to be selected and the current test interface protocol, and determining an associated interface protocol corresponding to the current test interface protocol according to the similarity degree; the degree of similarity may include the same, similar, dissimilar, and dissimilar in order.
Further, the determining, according to the similarity degree, an associated interface protocol corresponding to the current test interface protocol includes:
and determining the candidate interface protocols with the same or similar degrees of similarity as the associated interface protocol. The candidate interface protocols that are dissimilar or not identical in degree of similarity are discarded.
Further, the determining the similarity degree between the candidate interface protocol and the current test interface protocol includes:
and determining the similarity according to the constraint conditions of field information and each field information in the interface protocol field of the interface protocol to be selected and the interface protocol of the current test interface protocol.
The field information and the constraint condition of each field information may refer to fig. 2 and the above description, and will not be repeated.
Further, the determining the similarity according to the constraint condition of comparing the field information and the field information in the interface protocol field of the candidate interface protocol and the current test interface protocol includes:
if the interface protocol to be selected is the same as the field information in the interface protocol field of the current test interface protocol, continuing to compare constraint conditions of the field information;
if the constraint conditions are the same, determining that the similarity degree is the same;
if the constraint conditions are not the same, determining the similarity according to the data threshold values of the different constraint conditions; the data threshold may include an upper threshold and a lower threshold, and referring to fig. 2, taking a current as an example, if the current has a value range (0,3A), the upper threshold is 3A and the lower threshold is 0.
If the field information in the interface protocol field of the interface protocol to be selected is not the same as that in the interface protocol field of the current test interface protocol, directly determining that the similarity degree is different.
Further, the determining the similarity according to the data threshold and the data type of the different constraint conditions includes:
determining the similarity degree of the data threshold value and the similarity degree of the data type, and determining the similarity degree of the constraint condition to be similar when the similarity degree of the data threshold value and the similarity degree of the data type are similar, otherwise, determining the similarity degree of the constraint condition to be dissimilar;
determining the degree of similarity of the data thresholds includes:
if the data threshold is an upper threshold and the value of the interface protocol field to be selected is larger than the value of the current test interface protocol field, determining that the similarity degree is dissimilar; referring to the above example, for 3A, if the value of the interface protocol field to be selected is 2.5A, and the value of the current test interface protocol field is 2A, because the value of the current test interface protocol field is the upper threshold, 2.5A is closer to 3A than 2A, so the constraint condition of the current test interface protocol field is more severe than that of the interface protocol field to be selected, and therefore, the similarity degree is determined to be dissimilar, that is, the test case in the problem report including the interface protocol field to be selected does not need to be tested any more, that is, if none of the more severe current test interface protocol field passes, the test is not necessary to be performed any more, and the computing resource can be saved.
If the data threshold is an upper threshold and the value of the interface protocol field to be selected is smaller than or equal to the value of the current test interface protocol field, determining that the similarity degree is similar; referring to the above example, for 3A, if the value of the interface protocol field to be selected is 2A, and the value of the current test interface protocol field is 2.5A, because the value is the upper threshold, 2.5A is closer to 3A than 2A, the constraint condition of the interface protocol field to be selected is more severe than that of the current test interface protocol field, and therefore, the similarity degree is determined to be similar, that is, the test cases in the problem report including the interface protocol field to be selected need to be tested again, that is, if the current test interface protocol field which is not severe enough does not pass the test, the more severe interface protocol field to be selected cannot be determined to pass the test, and therefore, the test needs to be performed again.
If the data threshold is a lower threshold and the value of the interface protocol field to be selected is smaller than the value of the current test interface protocol field, determining that the similarity degree is dissimilar; referring to the above example, for 0A, if the value of the interface protocol field to be selected is 0.5A, and the value of the current test interface protocol field is 1A, because it is the lower threshold, 0.5A is closer to 0A than 1A, so the constraint condition of the current test interface protocol field is more severe than that of the interface protocol field to be selected, and therefore, the similarity degree is determined to be dissimilar, that is, the test case in the problem report including the interface protocol field to be selected does not need to be tested any more, that is, if none of the more severe current test interface protocol fields pass, the test is not necessary to be performed again, and the computing resource can be saved.
If the data threshold is a lower threshold and the value of the interface protocol field to be selected is greater than or equal to the value of the current test interface protocol field, determining that the similarity degree is similar; referring to the above example, for 0A, if the value of the interface protocol field to be selected is 1A, and the value of the current test interface protocol field is 0.5A, because it is the lower threshold, 0.5A is closer to 0A than 1A, so the constraint condition of the interface protocol field to be selected is more severe than that of the current test interface protocol field, and therefore, the similarity degree is determined to be similar, that is, the test case in the problem report including the interface protocol field to be selected needs to be tested again, that is, if the current test interface protocol field which is not severe enough does not pass the test, the more severe interface protocol field to be selected cannot be determined to pass the test, and therefore, the test needs to be performed again.
Determining the degree of similarity of the data types includes:
the similarity degree is determined according to the data types of different constraint conditions, and the method specifically comprises the following steps: if the data type is represented by data precision and the data precision of the interface protocol field to be selected is greater than the data precision of the current test interface protocol field, determining that the similarity degree is similar; with reference to the above example, the constraint condition of the floating point type number is more severe than the constraint condition of the integer, if the interface protocol field to be selected is the floating point type number, the constraint condition of the interface protocol field to be selected is more severe than the constraint condition of the interface protocol field to be tested, so that the similarity degree is determined to be similar, that is, the test case in the problem report including the interface protocol field to be selected needs to be tested again, that is, if the current interface protocol field to be tested which is not severe enough does not pass the test, the interface protocol field to be selected which is more severe cannot be determined to not pass the test, so that the test needs to be performed again.
And if the data type is represented by the data precision and the data precision of the interface protocol field to be selected is smaller than or equal to the data precision of the current test interface protocol field, determining that the similarity degree is dissimilar. If the current test interface protocol field is a floating point type number, the interface protocol field to be selected is an integer, and the constraint condition of the current test interface protocol field is more severe than the constraint condition of the interface protocol field to be selected, therefore, the similarity degree is determined to be dissimilar, namely, test cases in a problem report sheet comprising the interface protocol field to be selected are not required to be tested, namely, if none of the more severe current test interface protocol field passes, the interface protocol field to be selected is not required to be tested again, the test is not required to pass, and the computing resource can be saved.
And determining an associated problem report form in which the associated interface protocol is located, selecting a failed test case from the associated problem report form, and taking the failed test case as the test case.
Further, before the step of determining the pre-translated document corresponding to the interface protocol field, the interface automation test method further includes:
and selecting the test case with at least two interface protocol fields being abnormal values at the same time as the test case. Referring to fig. 3 (a), if the expected result of the current value is 1.5A and the test result of the current value is 1A, it is indicated that an abnormal value exists in the current field; when the test case is tested in the current interface protocol field, the test case with at least two interface protocol fields simultaneously being abnormal values needs to be tested.
Specifically, as shown in fig. 5, after configuring each field of the interface protocol, definition and value constraint conditions of each field are set, script parameters are configured, then a script is run, and a normal test case and an abnormal test case are generated, wherein the abnormal test case comprises a combined abnormal test case. The normal test case refers to the fact that the value of each field of the interface protocol accords with the constraint condition, the abnormal test case refers to the test case that one field of the interface protocol takes an abnormal value, and the combined abnormal test case refers to the test case that at least two fields are selected from the interface protocol fields and are simultaneously the abnormal value. And extracting a problem report of the same or similar interface protocol test in the past in the problem report database, and selecting the test case which fails in the problem report as the test case of the test.
Those skilled in the art will appreciate that all or part of the flow of the methods of the embodiments described above may be accomplished by way of a computer program to instruct associated hardware, where the program may be stored on a computer readable storage medium. Wherein the computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory, etc.
The present invention is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present invention are intended to be included in the scope of the present invention.

Claims (7)

1. An automated interface testing method, comprising:
determining a precompiled file corresponding to the interface protocol field; the precompiled file is compiled by a precompiled language and comprises a mapping relation between the interface protocol field and an expected result of the test case;
invoking the precompiled file, outputting the expected result through the precompiled file, determining whether the test case passes the test according to the comparison result of the expected result and the test result of the test case, and determining whether an interface test passes according to whether the test case passes the test;
if the test fails, determining target characteristics which influence the failure of the test, and determining target associated characteristics according to the target characteristics;
determining a fused target association characteristic value according to the target association characteristic, and generating a target problem report corresponding to the target association characteristic value;
before the step of determining the pre-translated document corresponding to the interface protocol field, the interface automated test method further comprises:
selecting an interface protocol to be selected from a problem report database, determining the similarity degree of the interface protocol to be selected and the current test interface protocol, and determining an associated interface protocol corresponding to the current test interface protocol according to the similarity degree;
determining an associated problem report form in which the associated interface protocol is located, selecting a failed test case from the associated problem report form, and taking the failed test case as the test case;
and determining whether the test case passes the test according to the expected result and the comparison result of the test case, including:
inputting the expected result and the test result to a feature discrimination model established based on multi-source feature fusion; the feature discrimination model is established after the multisource features are extracted from a sample problem report in advance and are associated and fused, and can automatically generate a model of the problem report corresponding to the fused associated feature value;
and determining whether the test case passes the test according to the output result of the characteristic discrimination model.
2. The automated interface testing method of claim 1, wherein the feature discrimination model pre-building process comprises:
extracting features from the sample problem report, and carrying out feature association on the features to obtain associated features;
and fusing the association characteristic values of the association characteristics to obtain fused association characteristic values, and establishing a mapping relation between the problem report sheets corresponding to the fused association characteristic values.
3. The method of claim 1, wherein determining the similarity of the candidate interface protocol to the current test interface protocol comprises:
and determining the similarity according to the constraint conditions of field information and each field information in the interface protocol field of the interface protocol to be selected and the interface protocol of the current test interface protocol.
4. The method according to claim 3, wherein determining the similarity according to the constraint condition comparing field information in interface protocol fields of the candidate interface protocol and the current test interface protocol and each field information comprises:
if the interface protocol to be selected is the same as the field information in the interface protocol field of the current test interface protocol, continuing to compare constraint conditions of the field information;
if the constraint conditions are the same, determining that the similarity degree is the same;
if the constraint conditions are not the same, determining the similarity according to the data threshold and the data type of the different constraint conditions;
if the field information in the interface protocol field of the interface protocol to be selected is not the same as that in the interface protocol field of the current test interface protocol, directly determining that the similarity degree is different.
5. The method according to claim 4, wherein determining the degree of similarity according to the data threshold and the data type of the different constraint conditions comprises:
determining the similarity degree of the data threshold value and the similarity degree of the data type, and determining the similarity degree of the constraint condition to be similar when the similarity degree of the data threshold value and the similarity degree of the data type are similar, otherwise, determining the similarity degree of the constraint condition to be dissimilar;
determining the degree of similarity of the data thresholds includes:
if the data threshold is an upper threshold and the value of the interface protocol field to be selected is larger than the value of the current test interface protocol field, determining that the similarity degree of the data threshold is dissimilar;
if the data threshold is an upper limit threshold and the value of the interface protocol field to be selected is smaller than or equal to the value of the current test interface protocol field, determining that the similarity degree of the data threshold is similar;
if the data threshold is a lower threshold and the value of the interface protocol field to be selected is smaller than the value of the current test interface protocol field, determining that the similarity degree of the data threshold is dissimilar;
if the data threshold is a lower threshold and the value of the interface protocol field to be selected is greater than or equal to the value of the current test interface protocol field, determining that the similarity degree of the data threshold is similar;
determining the degree of similarity of the data types includes:
if the data type is represented by data precision and the data precision of the interface protocol field to be selected is greater than the data precision of the current test interface protocol field, determining that the similarity degree of the data types is similar;
and if the data type is represented by the data precision and the data precision of the interface protocol field to be selected is smaller than or equal to the data precision of the current test interface protocol field, determining that the similarity degree of the data types is dissimilar.
6. The method according to claim 5, wherein determining an associated interface protocol corresponding to a current test interface protocol according to the similarity degree comprises:
and determining the candidate interface protocols with the same or similar degrees of similarity as the associated interface protocol.
7. The interface automation test method of any one of claims 1 to 2, further comprising, prior to the step of determining the pre-translated document corresponding to the interface protocol field:
and selecting the test case with at least two interface protocol fields being abnormal values at the same time as the test case.
CN202111368168.4A 2021-11-18 2021-11-18 Automatic interface testing method Active CN114064486B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111368168.4A CN114064486B (en) 2021-11-18 2021-11-18 Automatic interface testing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111368168.4A CN114064486B (en) 2021-11-18 2021-11-18 Automatic interface testing method

Publications (2)

Publication Number Publication Date
CN114064486A CN114064486A (en) 2022-02-18
CN114064486B true CN114064486B (en) 2023-07-18

Family

ID=80279212

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111368168.4A Active CN114064486B (en) 2021-11-18 2021-11-18 Automatic interface testing method

Country Status (1)

Country Link
CN (1) CN114064486B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117891674A (en) * 2024-03-12 2024-04-16 成都国信安信息产业基地有限公司 Embedded equipment interface protocol testing tool and system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485915A (en) * 2021-06-16 2021-10-08 中国工程物理研究院计算机应用研究所 Automatic interface test data generation method and device based on protocol modeling and constraint coverage

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102650966B (en) * 2011-02-24 2016-01-27 王轶辰 A kind of embedded software test method of Reuse-Oriented and test macro thereof
US9419884B1 (en) * 2012-12-28 2016-08-16 Emc Corporation Intelligent automated testing method for restful web services
CN103279415B (en) * 2013-05-27 2016-08-10 哈尔滨工业大学 embedded software test method based on combined test
CN109885488B (en) * 2019-01-30 2022-03-18 上海卫星工程研究所 Automatic test method and system for satellite orbit calculation software driven by case table
CN111176991B (en) * 2019-12-23 2023-07-14 北京轩宇信息技术有限公司 Automatic generation method for embedded software interface use cases
CN112597033B (en) * 2020-12-26 2024-08-06 中国农业银行股份有限公司 Automatic interface testing method and device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485915A (en) * 2021-06-16 2021-10-08 中国工程物理研究院计算机应用研究所 Automatic interface test data generation method and device based on protocol modeling and constraint coverage

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于数据挖掘和决策树的测试用例重用技术研究;刘伟 等;导航定位与授时;第6卷(第5期);第129-132页 *
软件工程专业教学思考与实践;应时 等;软件导刊;第19卷(第1期);第15-17页 *

Also Published As

Publication number Publication date
CN114064486A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
US10650231B2 (en) Method, device and server for recognizing characters of claim document, and storage medium
CN110852065A (en) Document auditing method, device, system, equipment and storage medium
CN109697160B (en) Automatic testing system and method for Ethernet interface software
CN109726136A (en) Test method, device, equipment and the storage medium of database
CN113271237B (en) Industrial control protocol analysis method and device, storage medium and processor
CN107862327B (en) Security defect identification system and method based on multiple features
CN109616101B (en) Acoustic model training method and device, computer equipment and readable storage medium
CN109118420B (en) Watermark identification model establishing and identifying method, device, medium and electronic equipment
CN110674876A (en) Character detection method and device, electronic equipment and computer readable medium
CN109947651B (en) Artificial intelligence engine optimization method and device
CN114064486B (en) Automatic interface testing method
CN112447167A (en) Voice recognition model verification method and device, computer equipment and storage medium
CN111325031B (en) Resume analysis method and device
CN113722719A (en) Information generation method and artificial intelligence system for security interception big data analysis
CN117707922A (en) Method and device for generating test case, terminal equipment and readable storage medium
CN112860587B (en) UI automatic test method and device
CN109766274B (en) Test script automatic fusion method and storage medium
CN113765909A (en) Big data detection method and system for coping with intelligent education data wind control
CN118192949A (en) Vulnerability code tool generation method, system and medium based on large language model
CN111738290B (en) Image detection method, model construction and training method, device, equipment and medium
CN117520148A (en) Test case generation system based on large language model
CN111949537A (en) Interface test method, device, equipment and medium
US20230178065A1 (en) Evaluating screen content for accessibility
CN113704123B (en) Interface testing method, device, equipment and storage medium
CN111221728B (en) Self-adaptive test script system and method for rail transit automatic control software

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