CN112835779A - Test case determination method and device and computer equipment - Google Patents

Test case determination method and device and computer equipment Download PDF

Info

Publication number
CN112835779A
CN112835779A CN201911166218.3A CN201911166218A CN112835779A CN 112835779 A CN112835779 A CN 112835779A CN 201911166218 A CN201911166218 A CN 201911166218A CN 112835779 A CN112835779 A CN 112835779A
Authority
CN
China
Prior art keywords
test case
service
test
executed
database
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
CN201911166218.3A
Other languages
Chinese (zh)
Inventor
陈文辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili 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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN201911166218.3A priority Critical patent/CN112835779A/en
Publication of CN112835779A publication Critical patent/CN112835779A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

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 invention discloses a method and a device for determining a test case, computer equipment and a readable storage medium, and belongs to the technical field of software testing. The test case determining method comprises the following steps: after each test case is executed, acquiring tracking information corresponding to each test case from a service link tracking system; determining the service associated with each test case according to the tracking information; and storing each test case and the service related to each test case in a database. The invention can improve the accuracy of regression test case determination.

Description

Test case determination method and device and computer equipment
Technical Field
The invention relates to the technical field of software testing, in particular to a method, a device and computer equipment for determining a test case.
Background
With continuous iteration of services, the system is more and more complex, services are split along with the system, the number of the services is increased, and particularly with continuous micro-servitization process, the dependency relationship among the services is more and more complex. When a service is changed, such as version update and bug repair, a plurality of services of a plurality of service lines depending on the service will be spread. Therefore, regression testing needs to be performed on each business party that depends on the service to ensure that the changes do not destroy the original functions.
Currently, when performing regression testing on each business party depending on the service, a regression test case of the own party is generally determined manually based on risk identification, and then a dependent business line is notified to perform regression testing using the determined regression test case. However, a developer modifying the service may not be familiar with the service itself and the code on one hand, and is also difficult to be familiar with all other dependent service lines on the other hand, so that the developer is blind in determining the regression test case, and there is a great risk of missing the regression test case.
Disclosure of Invention
In view of this, a method, an apparatus, a computer device, and a computer readable storage medium for determining a test case are provided to solve the problem that determining a regression test case by using the existing method is inaccurate.
The invention provides a test case determining method, which comprises the following steps:
after each test case is executed, acquiring tracking information corresponding to each test case from a service link tracking system;
determining the service associated with each test case according to the tracking information;
and storing each test case and the service related to each test case in a database.
Optionally, after each test case is executed, the obtaining the trace information corresponding to each test case from the service link trace system includes:
after each test case is executed, response data returned after the test case is executed is obtained;
judging whether a tracking mark exists in the response data or not;
and if the response data has the tracking mark, acquiring the tracking information corresponding to the test case from the service link tracking system according to the tracking mark.
Optionally, after each test case is executed, the obtaining the trace information corresponding to the test case from the service link trace system further includes:
and if the tracking mark does not exist in the response data, sending notification information to a preset user.
Optionally, the determining the test case further includes:
when the change of the first service is monitored to the change of the first service, a test case set associated with the first service is obtained from the database, and each obtained test case in the test case set is used as a retest test case of the first service.
Optionally, the obtaining, from the database, the set of test cases associated with the first service includes:
searching all services related to the test cases from the database according to the name of the first service;
and when the first service exists in the service related to the test case, using the searched test case as one test case in the test case set, wherein all the searched test cases form the test case set.
Optionally, after the obtaining the set of test cases associated with the first service from the database, the method further includes:
sending a reminder message when the set of test cases associated with the first service is not retrieved from the database.
Optionally, the change includes a deletion, an addition, or a modification.
The invention also provides a test case determining device, which comprises:
the acquisition module is used for acquiring the tracking information corresponding to each test case from the service link tracking system after each test case is executed;
the determining module is used for determining the service associated with each test case according to the tracking information;
and the storage module is used for storing each test case and the service related to each test case in a database.
The invention also provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the above method when executing the computer program.
The invention also provides a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method.
The beneficial effects of the above technical scheme are that:
according to the embodiment of the invention, the service called in the execution process of each test case, the calling sequence, the calling hierarchical relationship, the time stamp and other information are recorded by the service link tracking system, so that the tracking information corresponding to the test case can be obtained from the service link tracking system after each test case is executed. The test case determining method in the embodiment of the invention can effectively avoid the problem that the regression test case is easy to miss when the regression test case of each service is determined only according to manual experience, thereby improving the accuracy of determining the regression test case.
Drawings
FIG. 1 is a block diagram of one embodiment of a system block diagram for test case determination according to the present invention;
FIG. 2 is a flowchart of an embodiment of a test case determination method according to the present invention;
FIG. 3 is a flowchart illustrating a detailed procedure for obtaining trace information corresponding to each test case from the service link trace system after each test case is executed according to the present invention;
FIG. 4 is a schematic diagram of the association relationship between service and test cases according to the present invention;
FIG. 5 is a flowchart of another embodiment of a test case determination method according to the present invention;
FIG. 6 is a flowchart detailing the steps of obtaining a set of test cases associated with the first service from the database in accordance with the present invention;
FIG. 7 is a block diagram of an embodiment of a test case determination apparatus according to the present invention;
fig. 8 is a schematic diagram of a hardware structure of a computer device for executing the test case determination method according to the embodiment of the present invention.
Detailed Description
The advantages of the invention are further illustrated in the following description of specific embodiments in conjunction with the accompanying drawings.
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present disclosure. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the description of the present invention, it should be understood that the numerical references before the steps do not identify the order of performing the steps, but merely serve to facilitate the description of the present invention and to distinguish each step, and thus should not be construed as limiting the present invention.
Fig. 1 schematically shows an application environment diagram of a test case determination method according to an embodiment of the present application. In an exemplary embodiment, the system of the application environment may include a user terminal 10, a background server 20. The user terminal 10 and the background server 20 form a wireless or wired connection, and the user terminal 10 has a corresponding application client or a corresponding web client, the user terminal 10 receives a test request input by a user through the application client or the web client, and sends the test request to the background server 20, so that the background server 20 can be triggered to execute a test case determining method, and obtain a test case to be regression tested, the user terminal 10 obtains the test case to be regression tested from the background server 20 through the application client or the web client, and performs regression testing on the test case to be regression tested. The user terminal 10 may be a PC, a mobile phone, an iPAD, a tablet computer, a notebook computer, a personal digital assistant, a wearable mobile electronic terminal such as a smart watch, glasses, and the like.
The invention provides a test case determining method for solving the problem that the regression test case determining method in the prior art is inaccurate. Fig. 2 is a flowchart illustrating a test case determination method according to an embodiment of the present invention. It is to be understood that the flow charts in the embodiments of the present method are not intended to limit the order in which the steps are performed. As can be seen from the figure, the test case determining method provided in this embodiment includes:
and step S20, after each test case is executed, acquiring the tracking information corresponding to each test case from the service link tracking system.
Specifically, the service link tracking system is a system that can track a user's request, and by this system, it can record which services are called by the backend in response to the request, and information such as the sequence of calling each service, the hierarchical relationship of each service, and a timestamp. The service link tracking system is designed in the prior art, such as Zipkin, pinpoint, skywalk and the like, wherein Zipkin is a service link tracking system sourced by a Twitter team, Zipkin is a distributed tracking system, the tracking system can collect data to solve potential problems in a microservice architecture, and the system can also manage and search the collected data; pinpoint is a service link tracking system sourced by a korean naver team, which can monitor a large-scale distributed system by using a link, help to analyze the overall structure of the system and how internal components are called, and provide a good solution for distributed application; skywalk is a service link tracking system sourced by sandisk in korea in 2015, which can be directed to an application performance monitoring system of a distributed system, particularly to a microservice, closed native, and containerization (house, kubernets, facilities) architecture, the core of which is a distributed tracking system.
When software development is completed, a user (such as a tester) needs to perform regression testing on each system function of the software through a designed test case; or when the software modifies the system function bug, the user also needs to adopt the corresponding test case to perform regression testing on the modified system function. In an embodiment, when performing a retest test, a service tester may manually identify a range requiring the retest and screen a required test case set on a test platform, and then manually trigger a test request based on the test case, so that the system executes the test case based on the test request after receiving the test request, and returns response data based on the test request after the test case is executed. In another embodiment, after a certain service change event is monitored, a test case set associated with the service can be obtained according to the association relationship, then each test case in the test case set is automatically executed, and response data is returned after the test case is executed.
The test case is a description of a test task performed on a specific software product, and embodies a test scheme, a method, a technology and a strategy, and the content of the test case comprises a test target, a test environment, input data, test steps, an expected result, a test script and the like, and finally forms a document. Simply considered, a test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose to verify whether a particular software requirement is met.
The tracking information is also called Trace information, is a professional term in an open source project Dapper of Google, is used for tracking a request, the request can be processed by a plurality of services in the background, each service is processed by a Span, the spans have dependency relationship, and the Trace information is a Span set with a tree structure.
Where the processing trace of each service is a Span, it can be understood as a basic working unit, and contains some description information, such as traceId (unique identifier of each request, and related spans all have the same traceId), id (Span id), parentId (the parentId is an optional id, which is a parent Span id of the current Span, and ensures the dependency relationship between spans through parentId, if there is no parentId, it indicates that the current Span is a root Span), name (name of Span, generally name of interface method), timestamp (timestamp when Span is created), duration (duration, and unit used is microsecond), and indications (note recording events, for defining the start and end of a request, including event name, service name, id, IP, port, etc.), binary notes RPCs (additional information about notes recording), etc.
In this embodiment, after each test case is executed, trace information corresponding to the test case is obtained from the service link trace system, for example, if there are three test cases, namely, TC1, TC2, and TC3, after the test case TC1 is executed, trace information corresponding to the test case TC1 is obtained from the service link trace system; after the test case TC2 is executed, acquiring tracking information corresponding to the test case TC2 from a service link tracking system; after the test case TC3 is executed, trace information corresponding to the test case TC3 is obtained from the service link trace system.
In an embodiment, referring to fig. 3, the acquiring, after each test case is executed, trace information corresponding to each test case from the service link trace system includes:
step S30, after each test case is executed, obtaining response data returned after the test case is executed.
Specifically, the execution of each test case is triggered based on one test request, the system can automatically execute the test case based on the test request, and after the test case is executed, response data is returned based on the test request.
Step S31, determine whether there is a trace flag in the response data.
Specifically, the trace mark is also called traceId, and is a unique identifier of each test request, and response data returned based on the test request has the same traceId as the test request. Different test requests have different traceids, and accordingly, response data returned based on different test requests also have different traceids.
In one embodiment, the presence or absence of the trace flag in the response data may be determined by determining whether or not a traceId is present in the response header of the response data.
Step S32, if a trace marker exists in the response data, obtaining trace information corresponding to the test case from the service link tracing system according to the trace marker.
Specifically, when it is determined that a trace flag exists in the response data, that is, a traceId exists, the trace information corresponding to the traceId may be acquired from the serving link trace system according to the traceId. In this embodiment, each test case corresponds to one trace marker, so that trace information of the test case can be obtained according to the trace marker.
In this embodiment, after response data returned after the test case is executed is acquired, the response data is determined, so that when it is determined that the trace mark exists in the response data, trace information corresponding to the test case can be conveniently acquired from the service link trace system according to the trace mark.
Step S33, if the tracking flag does not exist in the response data, sending a notification message to a predetermined user.
Specifically, when it is determined that the tracking flag does not exist in the response data, that is, the traceId does not exist, indicating that the service does not access the service link tracking system, a notification message may be sent to the predetermined user, so that the predetermined user may know the condition that the service accesses the service link tracking system in time, and may access the service to the service link tracking system in a supplementary manner. The preset user may be a developer of the service, a manager of the service, or the like. In this embodiment, the content of the notification information is not limited, and may be "access XX service to service link tracking system", for example.
In this embodiment, when it is determined that the tracking flag does not exist in the response data, the notification information is sent, so that the user can access the service to the service link tracking system in time.
And step S21, determining the service associated with each test case according to the tracking information.
Specifically, the service associated with each test case is a service called when each test case is executed. The Trace information (i.e., the Trace information) includes a Span set with a tree structure, and the annotations information included in each Span (work unit) can be obtained through each Span, and then the service name, the service id, and the like processed by the work unit can be further obtained from the annotations information. After the processed service name is acquired in each Span in the Span set, all the acquired services can be used as services called when the test case is executed. Examples are as follows:
supposing that the Span set comprises Span 1, Span 2 and Span 3, wherein the annotations information in Span 1 comprises service 1; the annotations information in Span 2 includes service 2; if the annotations information in Span 3 includes service 3, service 1, service 2, and service 3 are used as services called when the test case is executed.
And step S22, storing each test case and the service related to each test case in a database.
Specifically, after determining the call relationship between each test case and each service, the test case and the service called by the test case may be associated, and then the association relationship is stored in the database.
For example, referring to fig. 4, for the test case TC4, it is determined that 2 services called by executing the test case TC4 are respectively service 3 and service n, then the service 3 and the service n may be associated with the test case TC4, that is, a mapping relationship between the test case TC4 and the service 3 and the service n is established, and then the mapping relationship may be stored in the database.
In the embodiment of the invention, after all the test cases are executed, the mapping relation between all the test cases and each service can be obtained.
According to the embodiment of the invention, the service called in the execution process of each test case, the calling sequence, the calling hierarchical relationship, the time stamp and other information are recorded by the service link tracking system, so that the tracking information corresponding to the test case can be obtained from the service link tracking system after each test case is executed. The test case determining method in the embodiment of the invention can effectively avoid the problem that the regression test case is easy to miss when the regression test case of each service is determined only according to manual experience, thereby improving the accuracy of determining the regression test case.
Further, referring to fig. 5, which is a schematic flow chart of a test case determining method according to another embodiment of the present invention, it can be seen from the diagram that the test case determining method provided in this embodiment includes:
step S50, after each test case is executed, obtaining the trace information corresponding to the test case from the service link trace system.
And step S51, determining the service called when the test case is executed according to the tracking information.
And step S52, storing the determined service and the test case in a database in a related manner.
Specifically, the steps S50-S52 are the same as the steps S20-S22 in the above embodiment, and are not repeated in this embodiment.
Step S53, when it is monitored that the first service is changed, acquiring a test case set associated with the first service from the database, and taking each test case in the acquired test case set as a retest test case of the first service.
Specifically, the first service is a changed service. The service change refers to an operation that the software needs to update and modify code for a certain service due to version update, bug repair and the like, and then redeployes the release. The change may be an addition, a modification, or a deletion. The adding refers to the operation of newly adding the service in the system, the modifying refers to the operation of modifying the original service, and the deleting refers to the operation of deleting the service.
And monitoring the change event of each service in real time or at regular time, and when a certain service is monitored to be changed, acquiring a test case set associated with the service from the database because the mapping relation between each test case and the corresponding service is stored in the database. The test case set may include all interface test cases that depend on the service, and the test case set may include one or more test cases.
After the test case set is obtained, each test case in the test case set can be used as a regression test case of the first service, so that regression testing can be performed on the service by using the regression test case.
According to the embodiment of the invention, when the service is changed, the test case set corresponding to the service can be automatically obtained without manual determination, so that the speed of determining the regression test case can be improved, the problem of selection omission of the regression test case caused by manual selection of the regression test case can be avoided, and the effectiveness of the regression test can be improved.
In an embodiment, referring to fig. 6, the obtaining the set of test cases associated with the first service from the database includes:
step S60, searching all services associated with the test case from the database according to the name of the first service.
Specifically, the services associated with each test case may be sequentially compared and searched by the name of the first service until all the services associated with the test cases are compared and searched. For example, when the services associated with each test case are compared and searched, the name of the first service may be sequentially matched with the names of the services associated with the test case to be compared, and if the name of the first service is matched with the name of one of the services associated with the test case to be compared, it is indicated that the test case to be compared is the test case of the first service. After the comparison and search of the services related to one test case are completed, the comparison and search of the services related to the next test case are continuously carried out until the comparison and search of the services related to all the test cases are completed.
Step S61, when the first service exists in the service related to the test case, the found test case is used as one test case in the test case set, wherein all the found test cases form the test case set.
Specifically, after the comparison and search of all test cases are completed, all the searched test cases may be combined into the test case set associated with the first service.
For example, referring to fig. 4, when a change of service 2 is detected, the set of test cases { TC6, TC1, TC3, TC5} associated with the first service may be found according to the name of the service 2.
In this embodiment, all services associated with the test case are searched from the database according to the name of the first service, so that the test case set associated with the first service can be quickly searched.
In another embodiment, after the obtaining the set of test cases associated with the first service from the database, the method further includes:
sending a reminder message when the set of test cases associated with the first service is not retrieved from the database.
Specifically, when the set of test cases associated with the first service is not obtained from the database, that is, no test case is associated with the first service, in order to implement the regression test on the first service, a prompt message may be sent to prompt a user (for example, a service tester) to design a new test case or manually screen a test case that needs to be regressed. After the new test case or the manually screened test case is determined, the above steps S20-S22 are performed.
For example, referring to fig. 4, when it is monitored that the service 1 is changed, a test case set associated with the service 1 is not obtained from the database, and then a prompt message needs to be sent to prompt a user to design a new test case or manually filter a test case that needs to be regressed.
In this embodiment, when the test case set associated with the first service is not acquired, a prompt message is sent out, so as to prompt a user to design a new test case or manually screen a test case that needs regression to execute regression testing.
Referring to FIG. 7, a block diagram of a test case determining apparatus 700 according to an embodiment of the invention is shown.
In this embodiment, the test case determination apparatus 700 includes a series of computer program instructions stored in a memory, and when the computer program instructions are executed by a processor, the test case determination function according to the embodiments of the present invention can be implemented. In some embodiments, the test case determination apparatus 700 may be divided into one or more modules based on the particular operations implemented by the portions of the computer program instructions. For example, in fig. 7, the test case determination apparatus 700 may be divided into an acquisition module 701, a determination module 702, and a storage module 703. Wherein:
an obtaining module 701, configured to obtain, after each test case is executed, trace information corresponding to each test case from the service link trace system.
Specifically, the service link tracking system is a system that can track a user's request, and by this system, it can record which services are called by the backend in response to the request, and information such as the sequence of calling each service, the hierarchical relationship of each service, and a timestamp. The service link tracking system is designed in the prior art, such as Zipkin, pinpoint, skywalk and the like, wherein Zipkin is a service link tracking system sourced by a Twitter team, Zipkin is a distributed tracking system, the tracking system can collect data to solve potential problems in a microservice architecture, and the system can also manage and search the collected data; pinpoint is a service link tracking system sourced by a korean naver team, which can monitor a large-scale distributed system by using a link, help to analyze the overall structure of the system and how internal components are called, and provide a good solution for distributed application; skywalk is a service link tracking system sourced by sandisk in korea in 2015, which can be directed to an application performance monitoring system of a distributed system, particularly to a microservice, closed native, and containerization (house, kubernets, facilities) architecture, the core of which is a distributed tracking system.
When software development is completed, a user (such as a tester) needs to perform regression testing on each system function of the software through a designed test case; or when the software modifies the system function bug, the user also needs to adopt the corresponding test case to perform regression testing on the modified system function. In an embodiment, when performing a retest test, a service tester may manually identify a range requiring the retest and screen a required test case set on a test platform, and then manually trigger a test request based on the test case, so that the system executes the test case based on the test request after receiving the test request, and returns response data based on the test request after the test case is executed. In another embodiment, after a certain service change event is monitored, a test case set associated with the service can be obtained according to the association relationship, then each test case in the test case set is automatically executed, and response data is returned after the test case is executed.
The test case is a description of a test task performed on a specific software product, and embodies a test scheme, a method, a technology and a strategy, and the content of the test case comprises a test target, a test environment, input data, test steps, an expected result, a test script and the like, and finally forms a document. Simply considered, a test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose to verify whether a particular software requirement is met.
The tracking information is also called Trace information, is a professional term in an open source project Dapper of Google, is used for tracking a request, the request can be processed by a plurality of services in the background, each service is processed by a Span, the spans have dependency relationship, and the Trace information is a Span set with a tree structure.
Where the processing trace of each service is a Span, it can be understood as a basic working unit, and contains some description information, such as traceId (unique identifier of each request, and related spans all have the same traceId), id (Span id), parentId (the parentId is an optional id, which is a parent Span id of the current Span, and ensures the dependency relationship between spans through parentId, if there is no parentId, it indicates that the current Span is a root Span), name (name of Span, generally name of interface method), timestamp (timestamp when Span is created), duration (duration, and unit used is microsecond), and indications (note recording events, for defining the start and end of a request, including event name, service name, id, IP, port, etc.), binary notes RPCs (additional information about notes recording), etc.
In this embodiment, after each test case is executed, trace information corresponding to the test case is obtained from the service link trace system, for example, if there are three test cases, namely, TC1, TC2, and TC3, after the test case TC1 is executed, trace information corresponding to the test case TC1 is obtained from the service link trace system; after the test case TC2 is executed, acquiring tracking information corresponding to the test case TC2 from a service link tracking system; after the test case TC3 is executed, trace information corresponding to the test case TC3 is obtained from the service link trace system.
In an exemplary embodiment, the obtaining module 701 is further configured to obtain response data returned after the test case is executed after each test case is executed.
Specifically, the execution of each test case is triggered based on one test request, the system can automatically execute the test case based on the test request, and after the test case is executed, response data is returned based on the test request.
The obtaining module 701 is further configured to determine whether a tracking flag exists in the response data.
Specifically, the trace mark is also called traceId, and is a unique identifier of each test request, and response data returned based on the test request has the same traceId as the test request. Different test requests have different traceids, and accordingly, response data returned based on different test requests also have different traceids.
In one embodiment, the presence or absence of the trace flag in the response data may be determined by determining whether or not a traceId is present in the response header of the response data.
The obtaining module 701 is further configured to obtain, if a trace marker exists in the response data, trace information corresponding to the test case from the service link tracking system according to the trace marker.
Specifically, when it is determined that a trace flag exists in the response data, that is, a traceId exists, the trace information corresponding to the traceId may be acquired from the serving link trace system according to the traceId. In this embodiment, each test case corresponds to one trace marker, so that trace information of the test case can be obtained according to the trace marker.
In this embodiment, after response data returned after the test case is executed is acquired, the response data is determined, so that when it is determined that the trace mark exists in the response data, trace information corresponding to the test case can be conveniently acquired from the service link trace system according to the trace mark.
In an exemplary embodiment, the obtaining module 701 is further configured to send notification information to a preset user if the tracking flag does not exist in the response data.
Specifically, when it is determined that the tracking flag does not exist in the response data, that is, the traceId does not exist, indicating that the service does not access the service link tracking system, a notification message may be sent to the predetermined user, so that the predetermined user may know the condition that the service accesses the service link tracking system in time, and may access the service to the service link tracking system in a supplementary manner. The preset user may be a developer of the service, a manager of the service, or the like. In this embodiment, the content of the notification information is not limited, and may be "access XX service to service link tracking system", for example.
In this embodiment, when it is determined that the tracking flag does not exist in the response data, the notification information is sent, so that the user can access the service to the service link tracking system in time.
A determining module 702, configured to determine, according to the trace information, a service associated with each test case.
Specifically, the service associated with each test case is a service called when each test case is executed. The Trace information (i.e., the Trace information) includes a Span set with a tree structure, and the annotations information included in each Span (work unit) can be obtained through each Span, and then the service name, the service id, and the like processed by the work unit can be further obtained from the annotations information. After the processed service name is acquired in each Span in the Span set, all the acquired services can be used as services called when the test case is executed. Examples are as follows:
supposing that the Span set comprises Span 1, Span 2 and Span 3, wherein the annotations information in Span 1 comprises service 1; the annotations information in Span 2 includes service 2; if the annotations information in Span 3 includes service 3, service 1, service 2, and service 3 are used as services called when the test case is executed.
A saving module 703, configured to save each test case and the service associated with each test case in a database.
Specifically, after determining the call relationship between each test case and each service, the test case and the service called by the test case may be associated, and then the association relationship is stored in the database.
For example, referring to fig. 4, for the test case TC4, it is determined that 2 services called by executing the test case TC4 are respectively service 3 and service n, then the service 3 and the service n may be associated with the test case TC4, that is, a mapping relationship between the test case TC4 and the service 3 and the service n is established, and then the mapping relationship may be stored in the database.
In the embodiment of the invention, after all the test cases are executed, the mapping relation between all the test cases and each service can be obtained.
According to the embodiment of the invention, the service called in the execution process of each test case, the calling sequence, the calling hierarchical relationship, the time stamp and other information are recorded by the service link tracking system, so that the tracking information corresponding to the test case can be obtained from the service link tracking system after each test case is executed. The test case determining method in the embodiment of the invention can effectively avoid the problem that the regression test case is easy to miss when the regression test case of each service is determined only according to manual experience, thereby improving the accuracy of the regression test case.
Further, in an embodiment, the test case determining apparatus 700 further includes a monitoring module.
The monitoring module is used for acquiring a test case set associated with the first service from the database when monitoring that the first service is changed, and taking each test case in the acquired test case set as a retest test case of the first service.
Specifically, the first service is a changed service. The service change refers to an operation that the software needs to update and modify code for a certain service due to version update, bug repair and the like, and then redeployes the release. The change may be an addition, a modification, or a deletion. The adding refers to the operation of newly adding the service in the system, the modifying refers to the operation of modifying the original service, and the deleting refers to the operation of deleting the service.
And monitoring the change event of each service in real time or at regular time, and when a certain service is monitored to be changed, acquiring a test case set associated with the service from the database because the mapping relation between each test case and the corresponding service is stored in the database. The test case set may include all interface test cases that depend on the service, and the test case set may include one or more test cases.
After the test case set is obtained, each test case in the test case set can be used as a regression test case of the first service, so that regression testing can be performed on the service by using the regression test case.
According to the embodiment of the invention, when the service is changed, the test case set corresponding to the service can be automatically obtained without manual determination, so that the speed of determining the regression test case can be improved, the problem of selection omission of the regression test case caused by manual selection of the regression test case can be avoided, and the effectiveness of the regression test can be improved.
Further, in another embodiment, the monitoring module is further configured to search all services associated with the test case from the database according to the name of the first service.
Specifically, the services associated with each test case may be sequentially compared and searched by the name of the first service until all the services associated with the test cases are compared and searched. For example, when the services associated with each test case are compared and searched, the name of the first service may be sequentially matched with the names of the services associated with the test case to be compared, and if the name of the first service is matched with the name of one of the services associated with the test case to be compared, it is indicated that the test case to be compared is the test case of the first service. After the comparison and search of the services related to one test case are completed, the comparison and search of the services related to the next test case are continuously carried out until the comparison and search of the services related to all the test cases are completed.
The monitoring module is further configured to, when the first service exists in the services related to the test cases, use the found test case as one test case in the test case set, where all the found test cases constitute the test case set.
Specifically, after the comparison and search of all test cases are completed, all the searched test cases may be combined into the test case set associated with the first service.
For example, referring to fig. 4, when a change of service 2 is detected, the set of test cases { TC6, TC1, TC3, TC5} associated with the first service may be found according to the name of the service 2.
In this embodiment, all services associated with the test case are searched from the database according to the name of the first service, so that the test case set associated with the first service can be quickly searched.
Further, in an embodiment, the monitoring module is further configured to send a warning message when the set of test cases associated with the first service is not acquired from the database.
Specifically, when the set of test cases associated with the first service is not obtained from the database, that is, no test case is associated with the first service, in order to implement the regression test on the first service, a prompt message may be sent to prompt a user (for example, a service tester) to design a new test case or manually screen a test case that needs to be regressed.
For example, referring to fig. 4, when it is monitored that the service 1 is changed, a test case set associated with the service 1 is not obtained from the database, and then a prompt message needs to be sent to prompt a user to design a new test case or manually filter a test case that needs to be regressed.
In this embodiment, when the test case set associated with the first service is not acquired, a prompt message is sent out, so as to prompt a user to design a new test case or manually screen a test case that needs regression to execute regression testing.
Fig. 8 schematically shows a hardware architecture diagram of a computer device 2 suitable for implementing the test case determination method according to an embodiment of the present application. In the present embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set in advance or stored. For example, the server may be a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers). As shown in fig. 8, the computer device 2 includes at least, but is not limited to: the memory 801, processor 802, network interface 803 may be communicatively linked to each other by a system bus. Wherein:
the memory 801 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the storage 801 may be an internal storage module of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 801 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device 2. Of course, the memory 801 may also include both internal and external memory modules of the computer device 2. In this embodiment, the memory 801 is generally used to store an operating system installed in the computer device 2 and various types of application software, such as program codes of a test case determination method. In addition, the memory 801 can also be used to temporarily store various types of data that have been output or are to be output.
The processor 802 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 802 generally serves to control the overall operation of the computer device 2, such as to perform control and processing related to data interaction or communication with the computer device 2. In this embodiment, the processor 802 is configured to execute program codes stored in the memory 801 or process data.
The network interface 803 may include a wireless network interface or a wired network interface, and the network interface 803 is typically used to establish a communication link between the computer device 2 and other computer devices. For example, the network interface 803 is used to connect the computer device 2 with an external terminal via a network, establish a data transmission channel and a communication link between the computer device 2 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It is noted that FIG. 8 only shows a computer device having components 801-803, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. In this embodiment, the test case determination method stored in the memory 801 may be further divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 802) to complete the present invention.
The embodiment of the present application provides a non-volatile computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the test case determination method in the embodiment.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is generally used for storing an operating system and various types of application software installed in the computer device, for example, the program code of the test case determination method in the embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on at least two network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill 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 application.

Claims (10)

1. A method for determining test cases is characterized by comprising the following steps:
after each test case is executed, acquiring tracking information corresponding to each test case from a service link tracking system;
determining the service associated with each test case according to the tracking information;
and storing each test case and the service related to each test case in a database.
2. The method according to claim 1, wherein obtaining the trace information corresponding to each test case from the service link trace system after each test case is executed comprises:
after each test case is executed, response data returned after the test case is executed is obtained;
judging whether a tracking mark exists in the response data or not;
and if the response data has the tracking mark, acquiring the tracking information corresponding to the test case from the service link tracking system according to the tracking mark.
3. The method according to claim 2, wherein obtaining the trace information corresponding to each test case from the service link trace system after each test case is executed further comprises:
and if the tracking mark does not exist in the response data, sending notification information to a preset user.
4. The test case determination method according to any one of claims 1 to 3, wherein the test case determination further includes:
when the change of the first service is monitored to the change of the first service, a test case set associated with the first service is obtained from the database, and each obtained test case in the test case set is used as a retest test case of the first service.
5. The method according to claim 4, wherein the obtaining the set of test cases associated with the first service from the database comprises:
searching all services related to the test cases from the database according to the name of the first service;
and when the first service exists in the service related to the test case, using the searched test case as one test case in the test case set, wherein all the searched test cases form the test case set.
6. The method according to claim 4, wherein after the obtaining the set of test cases associated with the first service from the database, further comprising:
sending a reminder message when the set of test cases associated with the first service is not retrieved from the database.
7. The test case determination method according to claim 4, wherein the change comprises a deletion, an addition, or a modification.
8. A test case determination apparatus, comprising:
the acquisition module is used for acquiring the tracking information corresponding to each test case from the service link tracking system after each test case is executed;
the determining module is used for determining the service associated with each test case according to the tracking information;
and the storage module is used for storing each test case and the service related to each test case in a database.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the test case determination method of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program, when executed by a processor, implements the steps of the test case determination method of any of claims 1 to 7.
CN201911166218.3A 2019-11-25 2019-11-25 Test case determination method and device and computer equipment Pending CN112835779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911166218.3A CN112835779A (en) 2019-11-25 2019-11-25 Test case determination method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911166218.3A CN112835779A (en) 2019-11-25 2019-11-25 Test case determination method and device and computer equipment

Publications (1)

Publication Number Publication Date
CN112835779A true CN112835779A (en) 2021-05-25

Family

ID=75922921

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911166218.3A Pending CN112835779A (en) 2019-11-25 2019-11-25 Test case determination method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN112835779A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407458A (en) * 2021-07-09 2021-09-17 广州博冠信息科技有限公司 Interface testing method and device, electronic equipment and computer readable medium
CN115391233A (en) * 2022-10-31 2022-11-25 深圳联友科技有限公司 Accurate test method based on coverage rate analysis and link tracking

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110048A (en) * 2009-12-28 2011-06-29 国际商业机器公司 Regression testing selection method and device for frame-based application program
CN106547678A (en) * 2015-09-16 2017-03-29 伊姆西公司 For the method and apparatus of white-box testing
CN107423214A (en) * 2017-04-18 2017-12-01 恒生电子股份有限公司 Software regression testing use-case acquisition methods, device and storage medium and electronic equipment
CN109240911A (en) * 2018-08-13 2019-01-18 腾讯科技(北京)有限公司 Accurate test method, device and computer equipment
CN109951355A (en) * 2019-03-13 2019-06-28 苏州洞察云信息技术有限公司 A method of it is tracked for distributed system whitepack associated path
CN110362463A (en) * 2018-04-10 2019-10-22 挖财网络技术有限公司 A kind of method and apparatus selected test case automatically and carry out regression test
CN110413506A (en) * 2019-06-19 2019-11-05 平安普惠企业管理有限公司 Test case recommended method, device, equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102110048A (en) * 2009-12-28 2011-06-29 国际商业机器公司 Regression testing selection method and device for frame-based application program
CN106547678A (en) * 2015-09-16 2017-03-29 伊姆西公司 For the method and apparatus of white-box testing
CN107423214A (en) * 2017-04-18 2017-12-01 恒生电子股份有限公司 Software regression testing use-case acquisition methods, device and storage medium and electronic equipment
CN110362463A (en) * 2018-04-10 2019-10-22 挖财网络技术有限公司 A kind of method and apparatus selected test case automatically and carry out regression test
CN109240911A (en) * 2018-08-13 2019-01-18 腾讯科技(北京)有限公司 Accurate test method, device and computer equipment
CN109951355A (en) * 2019-03-13 2019-06-28 苏州洞察云信息技术有限公司 A method of it is tracked for distributed system whitepack associated path
CN110413506A (en) * 2019-06-19 2019-11-05 平安普惠企业管理有限公司 Test case recommended method, device, equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113407458A (en) * 2021-07-09 2021-09-17 广州博冠信息科技有限公司 Interface testing method and device, electronic equipment and computer readable medium
CN113407458B (en) * 2021-07-09 2023-07-14 广州博冠信息科技有限公司 Interface testing method and device, electronic equipment and computer readable medium
CN115391233A (en) * 2022-10-31 2022-11-25 深圳联友科技有限公司 Accurate test method based on coverage rate analysis and link tracking

Similar Documents

Publication Publication Date Title
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
US9405662B2 (en) Process for displaying test coverage data during code reviews
CN109376166B (en) Script conversion method, script conversion device, computer equipment and storage medium
CN111522728A (en) Method for generating automatic test case, electronic device and readable storage medium
CN111026647B (en) Method and device for acquiring code coverage rate, computer equipment and storage medium
CN110704297A (en) Code evaluation method and device, computer equipment and storage medium
CN109871368B (en) Database detection method, database detection device, computer device and storage medium
CN111654495B (en) Method, apparatus, device and storage medium for determining traffic generation source
CN110750443A (en) Webpage testing method and device, computer equipment and storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
CN108255735B (en) Associated environment testing method, electronic device and computer readable storage medium
CN112835779A (en) Test case determination method and device and computer equipment
CN113448862A (en) Software version testing method and device and computer equipment
CN107391528B (en) Front-end component dependent information searching method and equipment
CN113419950A (en) Method and device for generating UI automation script, computer equipment and storage medium
CN113391998A (en) Regression testing method, device, electronic equipment and storage medium
CN113010208A (en) Version information generation method, version information generation device, version information generation equipment and storage medium
EP2962180A1 (en) Determining event and input coverage metrics for a graphical user interface control instance
CN110740081A (en) Data visualization method for page performance of standard multiple companies
CN113835965B (en) Parameter track mark-keeping method and device
CN112162954B (en) User operation log generation and path positioning method, device, equipment and medium
JP2016133946A (en) Source code reviewing method and system therefor
CN115203306A (en) Data exporting method and device, computer equipment and readable storage medium
CN114371969A (en) Page performance testing method and device, electronic equipment and storage medium
CN113656318A (en) Software version testing method and device and computer equipment

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