CN106874188B - Software interface testing method and device - Google Patents
Software interface testing method and device Download PDFInfo
- Publication number
- CN106874188B CN106874188B CN201611252188.4A CN201611252188A CN106874188B CN 106874188 B CN106874188 B CN 106874188B CN 201611252188 A CN201611252188 A CN 201611252188A CN 106874188 B CN106874188 B CN 106874188B
- Authority
- CN
- China
- Prior art keywords
- interface
- service
- scf service
- scf
- testing
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/362—Debugging of software
- G06F11/3648—Debugging of software using additional hardware
- G06F11/3656—Debugging of software using additional hardware using a specific debug interface
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention provides a software interface testing method and a device, wherein the method comprises the following steps: receiving a name of a service communication framework SCF service input by a user; deploying the SCF service; acquiring an interface of the SCF service through reflection, wherein the interface of the SCF service comprises an interface name, an implementation class of the interface and a parameter type of the interface; and testing the interface of the SCF service through a preset test case. The method realizes the automatic test of the interface of the SCF service, and does not need a tester to check the source code manual identification interface for testing, thereby greatly improving the test efficiency of the software interface.
Description
Technical Field
The present invention relates to computer technologies, and in particular, to a method and an apparatus for testing a software interface.
Background
In the software testing process, the interface needs to be tested. For example, in software testing based on a Service Communication Framework (SCF), the SCF interface needs to be tested.
In the prior art, a tester of software needs to first check a source code corresponding to the software, identify interface information to be tested from the source code, and then test an interface to be tested by using a test case.
However, in the prior art, a tester needs to manually identify the interface by looking up the source code, which results in low testing efficiency.
Disclosure of Invention
The invention provides a software interface testing method and device, which are used for solving the problem of low testing efficiency caused by manual interface identification in the prior art.
The first aspect of the present invention provides a software interface testing method, including:
receiving a name of a service communication framework SCF service input by a user;
deploying the SCF service;
acquiring an interface of the SCF service through reflection, wherein the interface of the SCF service comprises an interface name, an implementation class of the interface and a parameter type of the interface;
and testing the interface of the SCF service through a preset test case.
Further, before executing the preset test case, the method further includes:
initializing the SCF service.
Further, the initializing the SCF service comprises:
detecting a Transmission Control Protocol (TCP) connection state;
restarting the SCF service.
Further, before detecting the TCP connection status, the method further includes:
and detecting whether the SCF service exists in a configuration file, and if not, adding the SCF service in the configuration file.
Further, before the deploying the SCF service, the method further comprises:
and judging whether the SCF service is registered or not, and if not, registering the SCF service.
A second aspect of the present invention provides a software interface testing apparatus, including:
the receiving module is used for receiving the name of the SCF service of the service communication framework input by a user;
a deployment module for deploying the SCF service;
an obtaining module, configured to obtain, through reflection, an interface of the SCF service, where the interface of the SCF service includes an interface name, an implementation class of the interface, and a parameter type of the interface;
and the test module is used for testing the interface of the SCF service through a preset test case.
Further, still include:
an initialization module for initializing the SCF service.
Further, the initialization module includes:
the detection unit is used for detecting the TCP connection state;
a restart unit for restarting the SCF service.
Further, the initialization module further includes:
an adding unit, configured to add the SCF service in a configuration file when it is detected that the SCF service does not exist in the configuration file.
Further, the apparatus further comprises:
and the registration module is used for registering the SCF service when judging that the SCF service is unregistered.
According to the software interface test method and device provided by the invention, the software test platform firstly obtains and deploys the SCF service, further obtains the SCF service interface through reflection, and tests the obtained SCF service interface. Therefore, the automatic test of the interface of the SCF service is realized, and a tester does not need to check the source code manual identification interface for testing, thereby greatly improving the test efficiency of the software interface.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the following briefly introduces the drawings needed to be used in the description of the embodiments or the prior art, and obviously, the drawings in the following description are some embodiments of the present invention, and those skilled in the art can obtain other drawings according to the drawings without inventive labor.
FIG. 1 is a system architecture diagram of a software interface testing method provided by the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a software interface testing method according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a software interface testing method according to the present invention;
FIG. 4 is a flowchart illustrating a third embodiment of a software interface testing method provided by the present invention;
FIG. 5 is a flowchart illustrating a fourth embodiment of a software interface testing method according to the present invention;
FIG. 6 is a block diagram of a first embodiment of a software interface testing apparatus according to the present invention;
FIG. 7 is a block diagram of a second embodiment of a software interface testing apparatus according to the present invention;
FIG. 8 is a block diagram of a third embodiment of a software interface testing apparatus according to the present invention;
FIG. 9 is a block diagram of a fourth exemplary embodiment of a software interface testing apparatus according to the present invention;
fig. 10 is a block diagram of a fifth embodiment of a software interface testing apparatus according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a system architecture diagram of a software interface testing method provided by the present invention, and as shown in fig. 1, a platform related to the method includes: a software code compiling platform, a software compiling platform and a software testing platform. The software test platform tests the executable software package. The scheme of the invention corresponds to a software testing platform, namely the software testing platform executes the scheme of the invention to realize the automatic testing of the software interface.
Fig. 2 is a schematic flowchart of a first embodiment of a software interface testing method provided by the present invention, as shown in fig. 2, the method includes:
s201, receiving the name of the SCF service input by the user.
The software testing platform can provide an operable interface for a user, display a selection list or an input box and the like in the operation interface, and only need to input the name of the SCF service to be tested when the testing is required.
The SCF service in the present invention is the specific software to be tested.
The SCF is a middle-layer service framework which supports cross-platform, has high concurrency, high performance and high reliability and provides asynchronous, multi-protocol and event driving, and software written based on the service framework can be regarded as SCF service, wherein the SCF service comprises a plurality of SCF interfaces. When testing the SCF service, it is necessary to test the interface of the SCF service.
S202, SCF service is deployed.
In the system architecture based on fig. 1, the software compiling platform may be Jenkins, for example. Jenkins can perform software continuous integration according to the setting timing of a user so as to obtain an executable software package. And the executable software package is stored in a fixed directory.
Furthermore, in this step, the software testing platform may obtain an executable software package corresponding to the SCF service from the fixed directory, and deploy the SCF service on the software testing platform, where the executable software package of the SCF service includes a client software package and a server software package.
Optionally, before the SCF service is deployed each time, the SCF service may be constructed by Jenkins, so as to ensure that the client packet and the server packet of the deployed SCF service are all up-to-date.
S203, obtaining the interface of the SCF service through reflection, where the interface of the SCF service includes an interface name, an implementation class of the interface, and a parameter type of the interface.
After the SCF service is deployed, the software testing platform can automatically acquire the interface of the SCF service in a reflection mode, and the acquired information of the interface comprises an interface name, an interface implementation class, an interface parameter type and the like.
The specific method for acquiring the SCF service interface by reflection may refer to the prior art, and is not described herein again.
And S204, testing the interface of the SCF service through a preset test case.
Specifically, the software testing platform may import pre-programmed test cases, and the test cases are specially used for testing the acquired interface.
During testing, one test case can test only one SCF interface or a plurality of SCF interfaces, so that the software test platform can test one SCF interface or a plurality of SCF interfaces as required.
In this embodiment, the software test platform first acquires and deploys the SCF service, further acquires an interface of the SCF service by reflection, and tests the acquired interface of the SCF service. Therefore, the automatic test of the interface of the SCF service is realized, and a tester does not need to check the source code manual identification interface for testing, thereby greatly improving the test efficiency of the software interface.
In another embodiment, before the step S204, the method further includes:
the above-mentioned SCF service is initialized.
Fig. 3 is a schematic flow chart of a second embodiment of the software interface testing method provided by the present invention, and as shown in fig. 3, the process of initializing the SCF service specifically includes:
s301, detecting a Transmission Control Protocol (TCP) connection state.
When the interface test of the SCF service is performed, it is necessary to ensure that the TCP connection is normal, and therefore, in this step, the TCP connection state needs to be detected first, and if the connection state is abnormal, the problem needs to be solved first, and the TCP connection is ensured to be normal.
S302, restarting the SCF service.
In particular, the software testing platform may invoke a script that restarts the SCF service to restart the SCF service.
Fig. 4 is a schematic flowchart of a third embodiment of the software interface testing method provided by the present invention, and as shown in fig. 4, the process of initializing the SCF service includes:
s401, detecting whether the SCF service exists in the configuration file, if not, adding the SCF service in the configuration file.
The configuration file refers to a configuration file in a software testing platform, and the SCF service to be tested needs to be registered in the configuration file. When testing the SCF service, the software testing platform needs to read the information of the SCF service from the configuration file and then perform the test.
In this step, if the SCF service does not exist in the configuration file, the SCF service needs to be added to the configuration file.
S402, detecting the TCP connection state.
The specific process is the same as the process of S301, and reference may be made to S301, which is not described herein again.
And S403, restarting the SCF service.
The specific process is the same as the process of S302, and reference may be made to S302, which is not described herein again.
Fig. 5 is a schematic flowchart of a fourth embodiment of a software interface testing method provided by the present invention, as shown in fig. 5, the method includes:
s501, receiving the name of the SCF service input by the user.
The specific process is the same as the process of S201, and reference may be made to S201, which is not described herein again.
And S502, judging whether the SCF service is registered or not, and if not, performing the SCF service registration.
Specifically, it is determined whether the SCF service is registered, that is, whether the SCF service is registered on the software test platform, and if not, the information of the SCF service needs to be registered on the software test platform.
S503, SCF service deployment
The specific process is the same as the process of S202, and may refer to S202, which is not described herein again.
S504, the interface of the SCF service is obtained through reflection, and the interface of the SCF service comprises an interface name, an implementation class of the interface and a parameter type of the interface.
The specific process is the same as the process of S203, and reference may be made to S203, which is not described herein again.
And S505, testing the interface of the SCF service through a preset test case.
The specific process is the same as the process of S204, and reference may be made to S204, which is not described herein again.
Fig. 6 is a block diagram of a first embodiment of a software interface testing apparatus according to the present invention, as shown in fig. 6, the apparatus includes:
the receiving module 601 is configured to receive a name of the SCF service input by a user.
A deployment module 602, configured to deploy the SCF service.
The obtaining module 603 is configured to obtain, through reflection, an interface of the SCF service, where the interface of the SCF service includes an interface name, an implementation class of the interface, and a parameter type of the interface.
The testing module 604 is configured to test the interface of the SCF service through a preset test case.
The device is used for realizing the method embodiments, the realization principle and the technical effect are similar, and the details are not repeated here.
Fig. 7 is a block diagram of a second embodiment of a software interface testing apparatus provided in the present invention, as shown in fig. 7, further including:
an initialization module 605, configured to initialize the SCF service.
Fig. 8 is a block diagram of a third embodiment of the software interface testing apparatus provided in the present invention, and as shown in fig. 8, the initialization module 605 includes:
a detecting unit 6051 configured to detect a TCP connection state.
A restart unit 6052 for restarting the SCF service described above.
Fig. 9 is a block diagram of a fourth embodiment of the software interface testing apparatus provided in the present invention, and as shown in fig. 9, the initialization module 605 further includes:
an adding unit 6053, configured to add the SCF service to the configuration file when detecting that the SCF service does not exist in the configuration file.
Fig. 10 is a block diagram of a fifth embodiment of a software interface testing apparatus provided in the present invention, and as shown in fig. 10, the apparatus further includes:
the registering module 606 is configured to perform SCF service registration when it is determined that the SCF service is not registered.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (6)
1. A software interface testing method is characterized by comprising the following steps:
receiving a name of a service communication framework SCF service input by a user;
constructing an SCF service through Jenkins, and deploying the SCF service;
acquiring an interface of the SCF service through reflection, wherein the interface of the SCF service comprises an interface name, an implementation class of the interface and a parameter type of the interface;
testing the interface of the SCF service through a preset test case;
before executing the preset test case, the method further comprises the following steps:
initializing the SCF service;
the initializing the SCF service includes:
detecting a Transmission Control Protocol (TCP) connection state;
restarting the SCF service.
2. The method according to claim 1, wherein before detecting the TCP connection status, further comprising:
and detecting whether the SCF service exists in a configuration file, and if not, adding the SCF service in the configuration file.
3. The method of claim 1 or 2, wherein prior to said deploying said SCF service, further comprising:
and judging whether the SCF service is registered or not, and if not, registering the SCF service.
4. A software interface testing apparatus, comprising:
the receiving module is used for receiving the name of the SCF service of the service communication framework input by a user;
the deployment module is used for constructing the SCF service through Jenkins and deploying the SCF service;
an obtaining module, configured to obtain, through reflection, an interface of the SCF service, where the interface of the SCF service includes an interface name, an implementation class of the interface, and a parameter type of the interface;
the test module is used for testing the interface of the SCF service through a preset test case;
further comprising:
an initialization module for initializing the SCF service;
the initialization module comprises:
the detection unit is used for detecting the TCP connection state;
a restart unit for restarting the SCF service.
5. The apparatus of claim 4, wherein the initialization module further comprises:
an adding unit, configured to add the SCF service in a configuration file when it is detected that the SCF service does not exist in the configuration file.
6. The apparatus of claim 4 or 5, further comprising:
and the registration module is used for registering the SCF service when judging that the SCF service is unregistered.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611252188.4A CN106874188B (en) | 2016-12-30 | 2016-12-30 | Software interface testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611252188.4A CN106874188B (en) | 2016-12-30 | 2016-12-30 | Software interface testing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106874188A CN106874188A (en) | 2017-06-20 |
CN106874188B true CN106874188B (en) | 2020-05-12 |
Family
ID=59164150
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611252188.4A Active CN106874188B (en) | 2016-12-30 | 2016-12-30 | Software interface testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106874188B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107766242A (en) * | 2017-10-09 | 2018-03-06 | 广州慧睿思通信息科技有限公司 | A kind of interface test method based on JMETER |
CN108763047A (en) * | 2018-05-31 | 2018-11-06 | 北京五八信息技术有限公司 | Method, apparatus, equipment and the storage medium that SCF is tested for the property |
CN110569194A (en) * | 2019-09-09 | 2019-12-13 | 五八有限公司 | interface testing method and device, electronic equipment and storage medium |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1866221A (en) * | 2006-02-27 | 2006-11-22 | 华为技术有限公司 | Software interface testing method and apparatus |
CN101286131A (en) * | 2007-04-09 | 2008-10-15 | 国际商业机器公司 | Service test method and service test system |
CN102591772A (en) * | 2011-12-15 | 2012-07-18 | 北京航空航天大学 | Service composition regression testing method and service composition regression testing device |
CN102855178A (en) * | 2011-06-30 | 2013-01-02 | 阿里巴巴集团控股有限公司 | Method and device for generating Mock base during unit test |
CN102932205A (en) * | 2012-11-19 | 2013-02-13 | 深圳市亚特尔科技有限公司 | Automatic test method and test platform of network server-side interface |
CN103136095A (en) * | 2011-11-28 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Method, device and system of test application program interface |
US8893087B2 (en) * | 2011-08-08 | 2014-11-18 | Ca, Inc. | Automating functionality test cases |
CN104423983A (en) * | 2013-08-29 | 2015-03-18 | 国际商业机器公司 | Method and device for developing, testing and deploying application |
CN104572463A (en) * | 2014-12-31 | 2015-04-29 | 广州酷狗计算机科技有限公司 | Method and device for testing interface information |
US9122804B2 (en) * | 2013-05-15 | 2015-09-01 | Oracle Internation Corporation | Logic validation and deployment |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9672022B2 (en) * | 2010-06-23 | 2017-06-06 | Microsoft Technology Licensing, Llc | Applications including multiple experience modules |
US9563419B2 (en) * | 2014-02-20 | 2017-02-07 | International Business Machines Corporation | Managing deployment of application pattern based applications on runtime platforms |
CN105335286B (en) * | 2014-08-15 | 2018-02-16 | 阿里巴巴集团控股有限公司 | A kind of static library test method and device |
-
2016
- 2016-12-30 CN CN201611252188.4A patent/CN106874188B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1866221A (en) * | 2006-02-27 | 2006-11-22 | 华为技术有限公司 | Software interface testing method and apparatus |
CN101286131A (en) * | 2007-04-09 | 2008-10-15 | 国际商业机器公司 | Service test method and service test system |
CN102855178A (en) * | 2011-06-30 | 2013-01-02 | 阿里巴巴集团控股有限公司 | Method and device for generating Mock base during unit test |
US8893087B2 (en) * | 2011-08-08 | 2014-11-18 | Ca, Inc. | Automating functionality test cases |
CN103136095A (en) * | 2011-11-28 | 2013-06-05 | 阿里巴巴集团控股有限公司 | Method, device and system of test application program interface |
CN102591772A (en) * | 2011-12-15 | 2012-07-18 | 北京航空航天大学 | Service composition regression testing method and service composition regression testing device |
CN102932205A (en) * | 2012-11-19 | 2013-02-13 | 深圳市亚特尔科技有限公司 | Automatic test method and test platform of network server-side interface |
US9122804B2 (en) * | 2013-05-15 | 2015-09-01 | Oracle Internation Corporation | Logic validation and deployment |
CN104423983A (en) * | 2013-08-29 | 2015-03-18 | 国际商业机器公司 | Method and device for developing, testing and deploying application |
CN104572463A (en) * | 2014-12-31 | 2015-04-29 | 广州酷狗计算机科技有限公司 | Method and device for testing interface information |
Also Published As
Publication number | Publication date |
---|---|
CN106874188A (en) | 2017-06-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110502244A (en) | Dispose the method and device of Kubernetes cluster | |
CN112486629B (en) | Micro-service state detection method, micro-service state detection device, electronic equipment and storage medium | |
CN103377094B (en) | Method for monitoring abnormality and device | |
US20190087307A1 (en) | Method and apparatus for developing unmanned vehicle application | |
CN106874188B (en) | Software interface testing method and device | |
CN103973858B (en) | The Auto-Test System of mobile terminal | |
WO2015192608A1 (en) | Method for updating app in android system, terminal and storage medium | |
CN104850475B (en) | A kind of test method and device of equipment | |
US20130166958A1 (en) | Software burning system and burning control method | |
CN111741291A (en) | Screen test method, electronic device and storage medium | |
CN109408133B (en) | Method and equipment for starting assembly | |
CN116594657A (en) | OTA upgrading method and device, vehicle and storage medium | |
CN109376072B (en) | Application program development method and device based on third-party component library | |
CN109600257B (en) | Tool deployment method, device and storage medium | |
CN112596750B (en) | Application testing method and device, electronic equipment and computer readable storage medium | |
CN109032873A (en) | A kind of server delivery detection method and device | |
CN108920338A (en) | A kind of method and terminal indicating file system state | |
TW201508469A (en) | Test controlling system and method | |
CN110134558B (en) | Method and device for detecting server | |
CN107612786B (en) | Method and system for testing router | |
CN109032643A (en) | The method and apparatus of software upgrading | |
CN109976773A (en) | Deployment method and device for game testing environment | |
CN111147400B (en) | Method and device for command line configuration synchronization and electronic equipment | |
CN105279063B (en) | A kind of test method, device and server | |
CN110618943B (en) | Security service test method and device, electronic equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |