CN116302932A - Layering test method, layering test device, electronic equipment and storage medium - Google Patents

Layering test method, layering test device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116302932A
CN116302932A CN202211682659.0A CN202211682659A CN116302932A CN 116302932 A CN116302932 A CN 116302932A CN 202211682659 A CN202211682659 A CN 202211682659A CN 116302932 A CN116302932 A CN 116302932A
Authority
CN
China
Prior art keywords
interface
layer
test
data processing
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.)
Pending
Application number
CN202211682659.0A
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.)
China Resources Digital Technology Co Ltd
Original Assignee
China Resources Digital 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 China Resources Digital Technology Co Ltd filed Critical China Resources Digital Technology Co Ltd
Priority to CN202211682659.0A priority Critical patent/CN116302932A/en
Publication of CN116302932A publication Critical patent/CN116302932A/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
    • 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)
  • 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 embodiment of the application provides a layering test method, a layering test device, electronic equipment and a storage medium, which belong to the technical field of automatic test, wherein the layering test method comprises the steps of obtaining source codes of a tested system, obtaining source code data, carrying out architecture extraction on the source code data, obtaining a code layering architecture, wherein the code layering architecture comprises an interface test layer and an interface test layer, carrying out layering processing on the interface test layer, obtaining an interface rendering layer and an interface data processing layer, wherein the interface rendering layer is used for carrying out interface test on a user interface of the tested system, the interface data processing layer comprises at least two first interfaces, obtaining logic change information and interface call relations of the interface data processing layer according to the interface data processing layer and the interface test layer, testing the first interfaces according to the logic change information and the interface call relations, and positioning defects in the tested system through testing, so that the quality of the tested system is improved.

Description

Layering test method, layering test device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of automated testing technologies, and in particular, to a layered testing method, a layered testing apparatus, an electronic device, and a storage medium.
Background
The conventional hierarchical test model is divided into a User Interface (UI) layer for performing an Interface automation test, a Service (Service) layer for performing an Interface automation test, and a Unit (Unit) layer for performing a Unit test. Because the interface automation test is easy to be externally dependent and has high maintenance cost, the interface automation test is generally difficult to be carried out, but the quality of a tested system can not be ensured by only performing unit test and interface test. Therefore, how to perform testing to ensure the quality of the tested system is a urgent problem to be solved.
Disclosure of Invention
The embodiment of the application mainly aims to provide a layering test method, a layering test device, electronic equipment and a storage medium, and aims to improve the quality of a tested system by testing and positioning defects in the tested system.
To achieve the above object, a first aspect of an embodiment of the present application proposes a layered test method, including:
acquiring source codes of a tested system to obtain source code data;
performing architecture extraction on the source code data to obtain a code layering architecture; the code layering architecture comprises an interface test layer and an interface test layer;
Layering the interface test layer to obtain an interface rendering layer and an interface data processing layer; the interface rendering layer is used for performing interface test on a user interface of the tested system, the interface data processing layer comprises at least two first interfaces, and the interface testing layer comprises at least two second interfaces;
acquiring logic change information and interface calling relation of the interface data processing layer according to the interface data processing layer and the interface testing layer; the interface data processing layer is obtained by packaging the interface test layer, the logic change information is used for representing the modification state of logic data of the interface data processing layer, and the interface calling relationship is used for representing the calling relationship of the first interface to the second interface;
and testing the first interface according to the logic change information and the interface calling relation.
In some embodiments, the testing the first interface according to the logic change information and the interface call relationship includes:
if the interface calling relation is a first calling relation and the logic change information indicates that the logic data of the interface data processing layer is not modified, acquiring test case coverage information of the interface test layer, and testing the first interface according to the test case coverage information; the first calling relation is that one first interface exists to call one second interface.
In some embodiments, the testing the first interface according to the logic change information and the interface call relationship further includes:
if the interface calling relation is the first calling relation, the logic change information indicates that the logic data of the interface data processing layer is modified, and the interface type of the data processing layer is a file data type, interface test is carried out on the first interface;
in some embodiments, the testing the first interface according to the logic change information and the interface call relationship further includes:
and if the interface calling relation is a first calling relation, the logic change information indicates that the logic data of the interface data processing layer is modified, and the interface rendering layer calls the interface data processing layer, testing the first interface according to the service processing type of the interface data processing layer.
In some embodiments, the testing the first interface according to the service processing type of the interface data processing layer includes:
if the service processing type is a service type, performing interface test on the first interface;
And if the service processing type is a non-service type, performing interface test on the first interface.
In some embodiments, the testing the first interface according to the logic change information and the interface call relationship includes:
if the interface calling relation is a second calling relation, testing the first interface according to the logic change information; and the second calling relation calls the same second interface for a plurality of first interfaces.
In some embodiments, the testing the first interface according to the logic change information includes:
if the logic change information indicates that the logic data of the interface data processing layer is not modified, acquiring test case coverage information of the interface test layer again, and testing the first interface according to the test case coverage information;
and if the logic change information indicates that the logic data of the interface data processing layer is modified, testing the first interface according to the interface type or the service processing type of the interface data processing layer.
To achieve the above object, a second aspect of the embodiments of the present application proposes a layered testing apparatus, including:
The first acquisition module is used for acquiring source codes of the tested system to obtain source code data;
the architecture extraction module is used for carrying out architecture extraction on the source code data to obtain a code layering architecture; the code layering architecture comprises an interface test layer and an interface test layer, wherein the interface data processing layer comprises at least two first interfaces, and the interface test layer comprises at least two second interfaces;
the layering module is used for layering the interface test layer to obtain an interface rendering layer and an interface data processing layer; the interface rendering layer is used for performing interface test on a user interface of the tested system;
the second acquisition module is used for acquiring logic change information and interface calling relation of the interface data processing layer according to the interface data processing layer and the interface test layer; the interface data processing layer is obtained by packaging the interface test layer, the logic change information is used for representing the modification state of logic data of the interface data processing layer, and the interface calling relationship is used for representing the calling relationship of the first interface to the second interface;
and the testing module is used for testing the first interface according to the logic change information and the interface calling relation.
To achieve the above object, a third aspect of the embodiments of the present application proposes an electronic device, which includes a memory and a processor, the memory storing a computer program, the processor implementing the method according to the first aspect when executing the computer program.
To achieve the above object, a fourth aspect of the embodiments of the present application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method of the first aspect.
According to the layering test method, the layering test device, the electronic equipment and the computer readable storage medium, the code layering architecture is obtained by carrying out architecture extraction on source code data, the code layering architecture comprises an interface test layer and an interface test layer, layering processing is carried out on the interface test layer to obtain an interface rendering layer and an interface data processing layer, the interface rendering layer is used for carrying out interface test on a user interface of a tested system, the interface data processing layer comprises at least two first interfaces, the interface test layer is divided into the interface rendering layer and the interface data processing layer through finer granularity division, and under the condition that interface automation test is not easy to develop, the automatic test of the interface data processing layer can be inserted in advance, so that test work is moved leftwards, and defects of the tested system are exposed in advance. Further, the logic change information and the interface call relation of the interface data processing layer are obtained according to the interface data processing layer and the interface test layer, and the first interface is tested according to the logic change information and the interface call relation, so that the user interface corresponding to the interface with correct test functions is normal, defects such as interfaces and interfaces in a tested system can be effectively detected, and the quality of the tested system is improved.
Drawings
FIG. 1 is a flow chart of a layered test method provided by an embodiment of the present application;
fig. 2 is a flowchart of step S150 in fig. 1;
fig. 3 is a flowchart of step S230 in fig. 2;
fig. 4 is a flowchart of step S240 in fig. 2;
FIG. 5 is a schematic structural diagram of a layered testing apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that although functional block division is performed in a device diagram and a logic sequence is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the block division in the device, or in the flowchart. The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
First, several nouns referred to in this application are parsed:
automated testing: the method is characterized in that a machine is utilized to automatically execute a test flow, and the difference between the actual test result and the expected test result is compared, so that the test efficiency and the test accuracy can be improved compared with a manual test mode.
Interface test: the UI test is also called testing the user interface of the software, for example, testing whether the layout of the functional modules of the user interface is reasonable, whether the overall style is consistent, whether the placement positions of the controls are consistent with the use habit of the client, the operation convenience of the interface, the simplicity and the comprehensiveness of navigation, the availability of page elements, the correctness of characters in the interface, the unification of the naming, the beautiful appearance of the page, the perfection of the combination of the characters and the pictures, and the like.
Interface test: the interface between the system components is tested for detecting interaction points between the external system and the tested system and between all subsystems in the tested system.
Unit test: the method is to check and verify the minimum testable unit in the software, wherein the specific meaning of the unit needs to be determined according to the actual situation, for example, the unit in the C language refers to a function, the unit in the Java language refers to a class, and the graphical software can refer to a window or a menu.
The scale of the software system tends to be larger and more complicated, and the quality of the software system is also more important. In the related art, by converting a test behavior driven by a person into a machine to automatically execute a test flow by means of a tool or a frame, an automatic test is adopted to ensure the quality of software, so that the cost of manual test is reduced, the repeated work is reduced, and the test is performed more quickly and efficiently.
The test pyramid divides the test into a User Interface (UI) layer for performing an Interface automation test, a Service (Service) layer for performing an Interface automation test, and a Unit (Unit) layer for performing a Unit test. The interface automation test is closest to the real scene, is easy to rely on the outside, has high maintenance cost and low benefit, is generally not easy to develop, but can not guarantee the quality of a tested system only by unit test and interface test. Therefore, how to perform testing to ensure the quality of the tested system is a urgent problem to be solved.
Based on this, the embodiment of the application provides a layering test method, a layering test device, electronic equipment and a computer readable storage medium, which aim to test a tested system and improve the quality of the tested system.
The layering test method, the layering test device, the electronic equipment and the computer readable storage medium provided in the embodiments of the present application are specifically described through the following embodiments, and the layering test method in the embodiments of the present application is first described.
The embodiment of the application provides a layering test method, and relates to the technical field of automatic test. The layering test method provided by the embodiment of the application can be applied to the terminal, the server side and software running in the terminal or the server side. In some embodiments, the terminal may be a smart phone, tablet, notebook, desktop, etc.; the server side can be configured as an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms and the like; the software may be an application or the like that implements a layered test method, but is not limited to the above form.
The subject application is operational with numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
Fig. 1 is an optional flowchart of a layered testing method provided in an embodiment of the present application, where the method in fig. 1 may include, but is not limited to, steps S110 to S150.
Step S110, acquiring a source code of a tested system to obtain source code data;
step S120, carrying out architecture extraction on source code data to obtain a code layering architecture; the code layering architecture comprises an interface test layer and an interface test layer;
step S130, layering processing is carried out on the interface test layer, and an interface rendering layer and an interface data processing layer are obtained; the interface rendering layer is used for performing interface test on a user interface of the tested system, the interface data processing layer comprises at least two first interfaces, and the interface testing layer comprises at least two second interfaces;
step S140, obtaining logic change information and interface calling relation of the interface data processing layer according to the interface data processing layer and the interface test layer; the interface data processing layer is obtained by packaging the interface test layer, the logic change information is used for representing the modification state of logic data of the interface data processing layer, and the interface calling relationship is used for representing the calling relationship of the first interface to the second interface;
and step S150, testing the first interface according to the logic change information and the interface call relation.
In the steps S110 to S150 illustrated in the embodiments of the present application, the interface rendering layer and the interface data processing layer are obtained by performing layering processing on the interface testing layer, the interface rendering layer is used for performing interface testing on a user interface of a tested system, and the interface testing layer is divided into the interface rendering layer and the interface data processing layer by finer granularity division, so that under the condition that an interface automation test is not easy to develop, the automation test of the interface data processing layer can be inserted in advance, the testing work is moved to the left, defects of the tested system are exposed in advance, and the interface development is less in finishing modification, compared with the interface automation test, the cost is lower. Further, the logic change information and the interface call relation of the interface data processing layer are obtained according to the interface data processing layer and the interface test layer, and the first interface is tested according to the logic change information and the interface call relation, so that the user interface corresponding to the first interface with correct test functions is normal, defects such as interfaces and interfaces in a tested system can be effectively detected, and the quality of the tested system is improved.
In step S110 of some embodiments, the software system to be tested is taken as a tested system, source code data is obtained by obtaining source code of the tested system, and a test procedure is executed by an automated test framework to test the tested system, so as to locate defects of the tested system, for example, the interface automated test framework may be java+testng/junit+ RestAssured, python +unit/pytest+requests, and the UI automated test framework may be java+selenium/selenium+ TestNG, python +unitest/pytest+selenium.
In step S120 of some embodiments, architecture extraction is performed on source code data by an architecture extraction tool to obtain a code layered architecture, where the code layered architecture includes an interface test layer, an interface test layer and a unit test layer, the interface test layer is used for performing interface test on a user interface of a tested system, the interface test layer is used for performing interface test on a RestAPI interface between components of the tested system, and the unit test layer is used for performing interface test on a bottom layer or an internal interface of the tested system. It should be noted that, when the interface test is performed, the interface to be tested and the dependency relationship data of the interface to be tested need to be determined, and the input parameter value of the interface to be tested is obtained according to the dependency relationship data, where the dependency relationship data is used to represent the dependency relationship between the interface to be tested and other interfaces. For example, the interface to be tested is a B interface, the B interface needs to rely on the m field in the return data of the a interface, and at this time, the m field needs to be dynamically obtained from the return data of the a interface through jsonPath or other modes, and the m field is transferred into the input parameters of the B interface. It should be further noted that, when the interface of the interface data processing layer is tested, login session information (cookie information) is dynamically acquired from the login interface return data, and the login session information is transferred into the request header. It should be noted that, the acquisition mode of the login session information needs to be dynamically determined according to the test framework, for example, if the test framework is a RestAssured tool, the getCookie information is directly called to acquire the login session information from the login interface return data.
In step S130 of some embodiments, layering processing is performed on the interface test layer to obtain an interface rendering layer and an interface data processing layer, where the interface rendering layer is used to perform interface test on a user interface of the tested system, and the interface of the interface data processing layer is called by the JavaScript and implemented by the element definition HTML, the basic style CSS and the JavaScript, so as to implement front-end page rendering, and complete page part function display and service data logic interaction. The interface data processing layer is developed by front-end personnel, is obtained by packaging an interface of the interface testing layer and is used for testing the interface of the tested system.
In step S140 of some embodiments, the interface data processing layer is compared with the interface test layer, and logic modification information and an interface call relationship of the interface data processing layer are obtained according to the interface data processing layer and the interface test layer, where the logic modification information is used to characterize that an interface of the interface data processing layer is compared with an interface of the interface test layer, and whether the logic data of the interface is modified or not, and the interface call relationship is used to characterize that whether an interface of the interface data processing layer calls the interface test layer is a one-to-one call relationship or not.
It should be noted that, modifying includes at least one of data filtering, data converting, or reassembling the interface return data of the interface test layer, the one-to-one call relationship refers to one interface of the interface data processing layer calling one interface of the interface test layer, and the non-one call relationship refers to multiple interfaces of one interface of the interface data processing layer calling the same interface of the interface test layer.
It should be further noted that, the interface return data of the interface test layer is data in a fixed format, such as json format, returned according to the request data, and is not required to be displayed at the front end, so that modification operations such as data filtering, data reassembling and the like need to be performed on the interface return data, so as to be beneficial to analysis of the front end code and rendering of the front end page. For example, a time format field is added on the basis of the interface return data, so that the front end can display time according to the time format corresponding to the time format field.
The page defects of the user interface can be found in advance by automatically testing the interface, so that the investment of manual testing is reduced, and the test case is improved. Meanwhile, the automatic layering test enables the test case to be easy to maintain and expand.
Referring to fig. 2, in some embodiments, step S150 may include, but is not limited to, including step S210, step S220, step S230, or step S240:
step S210, if the interface calling relationship is a first calling relationship and the logic change information indicates that the logic data of the interface data processing layer is not modified, acquiring test case coverage information of the interface test layer, and testing the first interface according to the test case coverage information; the first calling relation is that a first interface exists to call a second interface;
Step S220, if the interface calling relationship is a first calling relationship, the logic change information indicates that the logic data of the interface data processing layer is modified, and the interface type of the data processing layer is a file data type, then the interface test is carried out on the first interface;
step S230, if the interface calling relationship is the first calling relationship, the logic change information indicates that the logic data of the interface data processing layer is modified, and the interface rendering layer calls the interface data processing layer, the first interface is tested according to the service processing type of the interface data processing layer;
step S240, if the interface calling relationship is the second calling relationship, testing the first interface according to the logic change information; the second call relationship is that a plurality of first interfaces call the same second interface.
In step S210 of some embodiments, the interface of the interface data processing layer and the interface of the interface test layer are tested in the same interface automation test engineering. If the interface calling relation is a first calling relation, that is, one interface (a first interface) of the interface data processing layer calls one RestAPI interface (a second interface) of the interface testing layer, and the first interface is compared with the second interface, if the logic data of the first interface is not modified, test case coverage information of the second interface is obtained, the first interface is tested according to the test case coverage information, and the test case coverage information is used for indicating whether the test case covers the interface. If the test case coverage information indicates that the test case has covered the second interface, the first interface is not required to be covered, i.e. the first interface is not tested. If the test case coverage information indicates that the test case does not cover the second interface, the first interface needs to be covered, i.e. the first interface is tested. Whether the first interface is tested or not is determined through the test case coverage information, so that the interface logic of the first interface and the second interface can be ensured to be normal.
It should be noted that, in the actual development process of the software system, the development time of the interface data processing layer is later, and the test intervention time is also later than the interfaces of the interface test layer and the unit test layer, so that the coverage of the second interface RestAPI interface can be directly performed.
In step S220 of some embodiments, the data processing layer interface of the file data type is a file transfer class related to the file service, and may be used for uploading and downloading a file stream, where the file stream is usually binary file stream data, and the data processing layer interface of the file data type is used for uploading and downloading the file stream, and coverage of the data processing layer interface of the file data type is single, so that the interface test is performed on the first interface. Specifically, if a first interface calls a second interface, the logic change information indicates that the logic data of the first interface is modified, and the interface type of the first interface is the file data type, then the interface test is performed on the first interface.
In step S230 of some embodiments, if there is modification in the logic data of the first interface, the running scenario case tests the first interface according to the assertion granularity of the scenario-driven enhanced scenario case to ensure the comprehensiveness of the automated test. If the data returned by the first interface test case is correct, the interface corresponding to the first interface can be ensured to function normally, and the investment of manual test is reduced.
If a first interface calls a second interface, the logic change information indicates that the logic data of the first interface is modified, and the interface of the interface rendering layer directly calls the first interface, the first interface is tested according to the service processing type of the first interface. Specifically, if the service processing type of the first interface is a service type, performing an interface test on the first interface, and if the service processing type of the first interface is a non-service type, performing an interface test on the first interface.
In step S240 of some embodiments, if the interface calling relationship is a second calling relationship, that is, the plurality of first interfaces call the same second interface, each first interface is tested according to the logic change information and only tested once.
In some embodiments, if the interface call relationship is a third call relationship, that is, one first interface calls a plurality of second interfaces, then an interface test is performed on each second interface.
Step S210 to step S240 are described above, different test coverage strategies are selected according to the logic change information and the interface calling relationship, and the interfaces of the tested system are tested according to the test coverage strategies, so that the different interfaces can be subjected to targeted scene driving test, the interface functions corresponding to the tested interfaces can be ensured to be normal, the accuracy of defect positioning of the tested system is improved, and the software quality of the tested system is ensured.
Referring to fig. 3, in some embodiments, step S230 may include, but is not limited to, including step S310 or step S320:
step S310, if the service processing type is the service type, performing interface test on the first interface;
step S320, if the service processing type is a non-service type, the interface test is performed on the first interface.
In step S310 of some embodiments, if the interface data processing layer interface relates to specific service logic, the service type of the interface data processing layer interface is a service type, and the input parameter value is obtained from the user interface and is used as an input parameter of the interface data processing layer interface, so as to perform an interface test on the first interface.
In step S320 of some embodiments, if the interface data processing layer interface does not relate to specific service logic, the service processing type of the interface data processing layer interface is a non-service type, and then the interface test is implemented by performing full coverage on the first interface.
In the steps S310 to S320, the interfaces are tested differently according to the service processing types of the interfaces, instead of testing each interface, so that the testing efficiency of the interfaces can be improved.
Referring to fig. 4, in some embodiments, step S240 may include, but is not limited to, including step S410 or step S420:
step S410, if the logic change information indicates that the logic data of the interface data processing layer is not modified, acquiring test case coverage information of the interface test layer again, and testing the first interface according to the test case coverage information;
step S420, if the logic change information indicates that the logic data of the interface data processing layer is modified, the first interface is tested according to the interface type or the service processing type of the interface data processing layer.
In step S410 of some embodiments, logic modification information of a current first interface is obtained, if the logic modification information indicates that logic data of the current first interface is not modified, test case coverage information of an interface test layer is obtained again, if the test case coverage information indicates that the test case does not cover a second interface, the current first interface is tested, if the test case coverage information indicates that the test case covers the second interface, the current first interface is not tested, logic modification information of a next first interface is obtained until all first interfaces calling the same second interface are tested, and the first interfaces are tested according to the test case coverage information, so that test logic between an interface data processing layer and an interface test layer can be ensured to be normal, and repeated tests are avoided.
In step S420 of some embodiments, if the logic change information indicates that there is a modification in the logic data of the current first interface, the current first interface is tested according to the interface type or the service processing type of the interface data processing layer, and the testing method for testing the current first interface is shown in step 220 and step S230, which are not described herein again.
In the steps S410 to S420, when the interfaces of the interface data processing layer call the same interface of the interface testing layer, the current first interface is tested according to the logic change information of the current first interface, so that different tests can be performed on the interfaces, and the comprehensiveness of the test is improved.
Referring to fig. 5, an embodiment of the present application further provides a layered testing apparatus, which may implement the layered testing method, where the apparatus includes:
a first obtaining module 510, configured to obtain source code of a system under test, to obtain source code data;
the architecture extraction module 520 is configured to perform architecture extraction on the source code data to obtain a code hierarchical architecture; the code layering architecture comprises an interface test layer and an interface test layer;
the layering module 530 is configured to perform layering processing on the interface test layer to obtain an interface rendering layer and an interface data processing layer; the interface rendering layer is used for carrying out interface test on a user interface of the tested system, the interface data processing layer comprises at least two first interfaces, and the interface testing layer comprises at least two second interfaces;
A second obtaining module 540, configured to obtain, according to the interface data processing layer and the interface test layer, logic modification information and an interface calling relationship of the interface data processing layer; the interface data processing layer is obtained by packaging the interface test layer, the logic change information is used for representing the modification state of logic data of the interface data processing layer, and the interface calling relationship is used for representing the calling relationship of the first interface to the second interface;
and the test module 550 is configured to test the first interface according to the logic change information and the interface call relationship.
The specific implementation of the layered testing apparatus is substantially the same as the specific embodiment of the layered testing method described above, and will not be described herein.
Referring to fig. 6, fig. 6 illustrates a hardware structure of an electronic device according to another embodiment, the electronic device includes:
the processor 610 may be implemented by a general-purpose CPU (central processing unit), a microprocessor, an application-specific integrated circuit (ApplicationSpecificIntegratedCircuit, ASIC), or one or more integrated circuits, etc. for executing related programs to implement the technical solutions provided by the embodiments of the present application;
the memory 620 may be implemented in the form of read-only memory (ReadOnlyMemory, ROM), static storage, dynamic storage, or random access memory (RandomAccessMemory, RAM). Memory 620 may store an operating system and other application programs, and when the technical solutions provided in the embodiments of the present disclosure are implemented by software or firmware, relevant program codes are stored in memory 620, and the processor 610 invokes a hierarchical testing method for performing the embodiments of the present disclosure;
An input/output interface 630 for implementing information input and output;
the communication interface 640 is configured to implement communication interaction between the device and other devices, and may implement communication in a wired manner (e.g. USB, network cable, etc.), or may implement communication in a wireless manner (e.g. mobile network, WIFI, bluetooth, etc.);
bus 650 transmits information between the various components of the device (e.g., processor 610, memory 620, input/output interface 630, and communication interface 640);
wherein processor 610, memory 620, input/output interface 630, and communication interface 640 enable communication connections among each other within the device via bus 650.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the layering test method when being executed by a processor.
The memory, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
According to the layering test method, the layering test device, the electronic equipment and the computer readable storage medium, the layering process is carried out on the interface test layer to obtain the interface rendering layer and the interface data processing layer, the interface rendering layer is used for carrying out interface test on a user interface of a tested system, the interface test layer is divided into the interface rendering layer and the interface data processing layer through finer granularity division, the interface data processing layer comprises at least two first interfaces, under the condition that interface automation test is not easy to develop, the automation test of the interface data processing layer can be inserted in advance, the test work is moved leftwards, and defects of the tested system are exposed in advance. Further, the logic change information and the interface call relation of the interface data processing layer are obtained according to the interface data processing layer and the interface test layer, and the first interface is tested according to the logic change information and the interface call relation, so that the user interface corresponding to the first interface with correct test functions is normal, defects such as interfaces and interfaces in a tested system can be effectively detected, and the quality of the tested system is improved.
The embodiments described in the embodiments of the present application are for more clearly describing the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application, and as those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
It will be appreciated by those skilled in the art that the technical solutions shown in the figures do not constitute limitations of the embodiments of the present application, and may include more or fewer steps than shown, or may combine certain steps, or different steps.
The above described apparatus embodiments are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Those of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
The terms "first," "second," "third," "fourth," and the like in the description of the present application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise 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 apparatus 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.
It should be understood that in this application, "at least one" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the above-described division of units is merely a logical function division, and there may be another division manner in actual implementation, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including multiple instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing a program.
Preferred embodiments of the present application are described above with reference to the accompanying drawings, and thus do not limit the scope of the claims of the embodiments of the present application. Any modifications, equivalent substitutions and improvements made by those skilled in the art without departing from the scope and spirit of the embodiments of the present application shall fall within the scope of the claims of the embodiments of the present application.

Claims (10)

1. The layering test method is characterized by comprising the following steps of:
acquiring source codes of a tested system to obtain source code data;
performing architecture extraction on the source code data to obtain a code layering architecture; the code layering architecture comprises an interface test layer and an interface test layer;
layering the interface test layer to obtain an interface rendering layer and an interface data processing layer; the interface rendering layer is used for performing interface test on a user interface of the tested system, the interface data processing layer comprises at least two first interfaces, and the interface testing layer comprises at least two second interfaces;
acquiring logic change information and interface calling relation of the interface data processing layer according to the interface data processing layer and the interface testing layer; the interface data processing layer is obtained by packaging the interface test layer, the logic change information is used for representing the modification state of logic data of the interface data processing layer, and the interface calling relationship is used for representing the calling relationship of the first interface to the second interface;
And testing the first interface according to the logic change information and the interface calling relation.
2. The hierarchical testing method according to claim 1, wherein said testing said first interface according to said logic change information and said interface call relation comprises:
if the interface calling relation is a first calling relation and the logic change information indicates that the logic data of the interface data processing layer is not modified, acquiring test case coverage information of the interface test layer, and testing the first interface according to the test case coverage information; the first calling relation is that one first interface exists to call one second interface.
3. The layered testing method according to claim 2, wherein the testing the first interface according to the logic change information and the interface call relationship further comprises:
and if the interface calling relation is the first calling relation, the logic change information indicates that the logic data of the interface data processing layer is modified, and the interface type of the data processing layer is a file data type, performing interface test on the first interface.
4. The layered testing method according to claim 2, wherein the testing the first interface according to the logic change information and the interface call relationship further comprises:
and if the interface calling relation is the first calling relation, the logic change information indicates that the logic data of the interface data processing layer is modified, and the interface rendering layer calls the interface data processing layer, testing the first interface according to the service processing type of the interface data processing layer.
5. The layered testing method according to claim 4, wherein the testing the first interface according to the service processing type of the interface data processing layer includes:
if the service processing type is a service type, performing interface test on the first interface;
and if the service processing type is a non-service type, performing interface test on the first interface.
6. The hierarchical testing method according to any one of claims 1 to 5, wherein said testing said first interface according to said logic change information and said interface call relation comprises:
If the interface calling relation is a second calling relation, testing the first interface according to the logic change information; and the second calling relation is that a plurality of first interfaces call the same second interface.
7. The layered testing method of claim 6, wherein the testing the first interface according to the logic change information comprises:
if the logic change information indicates that the logic data of the interface data processing layer is not modified, acquiring test case coverage information of the interface test layer again, and testing the first interface according to the test case coverage information;
and if the logic change information indicates that the logic data of the interface data processing layer is modified, testing the first interface according to the interface type or the service processing type of the interface data processing layer.
8. Layering testing arrangement, its characterized in that, layering testing arrangement includes:
the first acquisition module is used for acquiring source codes of the tested system to obtain source code data;
the architecture extraction module is used for carrying out architecture extraction on the source code data to obtain a code layering architecture; the code layering architecture comprises an interface test layer and an interface test layer;
The layering module is used for layering the interface test layer to obtain an interface rendering layer and an interface data processing layer; the interface rendering layer is used for performing interface test on a user interface of the tested system, the interface data processing layer comprises at least two first interfaces, and the interface testing layer comprises at least two second interfaces;
the second acquisition module is used for acquiring logic change information and interface calling relation of the interface data processing layer according to the interface data processing layer and the interface test layer; the interface data processing layer is obtained by packaging the interface test layer, the logic change information is used for representing the modification state of logic data of the interface data processing layer, and the interface calling relationship is used for representing the calling relationship of the first interface to the second interface;
and the testing module is used for testing the first interface according to the logic change information and the interface calling relation.
9. An electronic device, characterized in that it comprises a memory storing a computer program and a processor implementing the layered testing method of any of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the layered testing method of any one of claims 1 to 7.
CN202211682659.0A 2022-12-27 2022-12-27 Layering test method, layering test device, electronic equipment and storage medium Pending CN116302932A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211682659.0A CN116302932A (en) 2022-12-27 2022-12-27 Layering test method, layering test device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211682659.0A CN116302932A (en) 2022-12-27 2022-12-27 Layering test method, layering test device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116302932A true CN116302932A (en) 2023-06-23

Family

ID=86831200

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211682659.0A Pending CN116302932A (en) 2022-12-27 2022-12-27 Layering test method, layering test device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116302932A (en)

Similar Documents

Publication Publication Date Title
CN108958736B (en) Page generation method and device, electronic equipment and computer readable medium
CN108984388B (en) Method and terminal equipment for generating automatic test case
CN108459850B (en) Method, device and system for generating test script
CN109684008A (en) Card rendering method, device, terminal and computer readable storage medium
CN107748715B (en) Unity-based texture map configuration information detection method and system
CN114564374A (en) Operator performance evaluation method and device, electronic equipment and storage medium
CN108023905B (en) Internet of things application system and method
CN108809896A (en) A kind of information calibration method, device and electronic equipment
CN108170592B (en) Remote testing method and terminal for virtual reality software performance
CN114253798A (en) Index data acquisition method and device, electronic equipment and storage medium
CN108062401B (en) Application recommendation method and device and storage medium
CN114237594A (en) Form interface generation method, device and system and readable storage medium
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN116302932A (en) Layering test method, layering test device, electronic equipment and storage medium
CN113672225B (en) User interface processing method, device, equipment and storage medium
CN115562993A (en) Test script recording method and device, electronic equipment and storage medium
CN115269331A (en) Service topology monitoring method facing micro service group and related equipment
CN108153655A (en) The detection method and storage medium of the draw call quantity of virtual reality software
CN109683994B (en) Method and device for determining view construction time, storage medium and electronic equipment
CN108108369B (en) Method and device for processing calling error of common interface library
CN117370203B (en) Automatic test method, system, electronic equipment and storage medium
CN115562670B (en) Page configuration method, device, electronic equipment and medium
CN112150431B (en) UI vision walking method and device, storage medium and electronic device
CN111163138B (en) Method, device and server for reducing network load during game
CN117370203A (en) Automatic test method, system, electronic equipment and storage medium

Legal Events

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