CN118193347A - Method and device for acquiring operation result, storage medium and electronic equipment - Google Patents

Method and device for acquiring operation result, storage medium and electronic equipment Download PDF

Info

Publication number
CN118193347A
CN118193347A CN202211595828.7A CN202211595828A CN118193347A CN 118193347 A CN118193347 A CN 118193347A CN 202211595828 A CN202211595828 A CN 202211595828A CN 118193347 A CN118193347 A CN 118193347A
Authority
CN
China
Prior art keywords
code segment
target code
target
test environment
operation result
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
CN202211595828.7A
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.)
Tencent Technology Shanghai Co Ltd
Original Assignee
Tencent Technology Shanghai 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 Tencent Technology Shanghai Co Ltd filed Critical Tencent Technology Shanghai Co Ltd
Priority to CN202211595828.7A priority Critical patent/CN118193347A/en
Publication of CN118193347A publication Critical patent/CN118193347A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a method and a device for acquiring an operation result, a storage medium and electronic equipment. Wherein the method comprises the following steps: operating an object code project in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request; acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state; operating the target code segment under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state, and obtaining a target operation result; and acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result. The method and the device solve the technical problem that the related processing technology cannot process noise differences generated by the newly added codes in different test environments.

Description

Method and device for acquiring operation result, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computers, and in particular, to a method and apparatus for obtaining an operation result, a storage medium, and an electronic device.
Background
In testing code engineering with flow playback regression, it is often necessary to run the code engineering in different environments to determine possible problems in the code according to differences in the running results in the different environments.
However, there may be a difference that cannot be used to analyze code problems among differences between operation results in different test environments, such as a noise difference due to different system times and different random number generation results in the test environments.
In addition, in the case where there is a difference in code engineering itself included in code engineering in different test environments, for example, in the case where there is a new characteristic of code engineering deployed in a first test environment with respect to a second test environment for comparison, a new noise difference may be generated due to an operation result of a new code, and the related art cannot solve the noise difference generated due to the above-described reasons.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for acquiring an operation result, a storage medium and electronic equipment, which at least solve the technical problem that related processing technology cannot process noise difference generated by newly added codes in different test environments.
According to an aspect of the embodiment of the present invention, there is provided a method for acquiring an operation result, including: running an object code project in a first test environment, wherein the object code project comprises an object code section, and the object code section is a code section carrying an external dependent access request; acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in a second test environment, and the deployment state comprises a deployed state and an undeployed state; operating the target code segment under the condition that the switch identifier indicates that the deployment state of the target code segment in the second test environment is the deployed state, so as to obtain a target operation result; and acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
According to another aspect of the embodiment of the present invention, there is also provided an apparatus for acquiring an operation result, including: the first operation unit is used for operating an object code project in a first test environment, wherein the object code project comprises an object code section, and the object code section is a code section carrying an external dependent access request; a first obtaining unit, configured to obtain a switch identifier of the target code segment, where the switch identifier is used to indicate a deployment state of the target code segment in a second test environment, and the deployment state includes a deployed state and an undeployed state; the second running unit is used for running the target code segment to obtain a target running result when the switch identifier indicates that the deployment state of the target code segment in the second test environment is the deployed state; and the second acquisition unit is used for acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
According to still another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-described method of acquiring an operation result when executed.
According to yet another aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the acquisition method of the operation result as above.
According to still another aspect of the embodiments of the present invention, there is also provided an electronic device including a memory in which a computer program is stored, and a processor configured to execute the above-described method of acquiring an operation result by the above-described computer program.
In the embodiment of the invention, an object code project is operated in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request; acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state; operating the target code segment under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state, and obtaining a target operation result; and acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result. According to the method, under the condition that the target code segment which possibly introduces new noise and carries an external dependent access request exists in the code engineering, the switch identification of the target code segment is acquired firstly to confirm the deployment state of the target code segment in the second test environment, and the target code is operated only under the condition that the target code segment is confirmed to be in the deployed state in the second test environment, so that under the condition that the target code segment is not deployed in the second test environment, the problem that new noise difference is introduced due to the fact that the target code segment is operated in the first test environment is avoided, consistency of code engineering operated in different test environments is ensured, accuracy of test results output in the test environments is ensured, and the technical problem that noise difference is introduced due to the fact that the new code is not processed in the related technology is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a schematic diagram of a hardware environment of an alternative method of obtaining an operational result according to an embodiment of the present invention;
FIG. 2 is a flow chart of an alternative method of obtaining operational results according to an embodiment of the invention;
FIG. 3 is a schematic diagram of an alternative method of obtaining operational results according to an embodiment of the present invention;
FIG. 4 is an interface diagram of an alternative method of obtaining operational results according to an embodiment of the present invention;
FIG. 5 is an interface diagram of an alternative method for obtaining results of operation according to an embodiment of the invention
FIG. 6 is an interface schematic diagram of yet another alternative method of obtaining operational results in accordance with an embodiment of the present invention;
FIG. 7 is an interface diagram of yet another alternative method of obtaining operational results in accordance with an embodiment of the present invention;
FIG. 8 is a schematic diagram of an alternative target program running device according to an embodiment of the present invention;
fig. 9 is a schematic structural view of another alternative electronic device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures 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 the embodiments of the invention 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.
The technical terms used in the present application will be described as follows:
According to an aspect of the embodiment of the present invention, there is provided a method for obtaining an operation result, which may be applied, but not limited to, an operation result obtaining system including a server 102, a terminal device 104, and a terminal device 106 as shown in fig. 1, as an alternative implementation manner. As shown in fig. 1, server 102 is connected to terminal devices 104, 106 via a network 110, which may include, but is not limited to: a wired network, a wireless network, wherein the wired network comprises: local area networks, metropolitan area networks, and wide area networks, the wireless network comprising: bluetooth, WIFI, and other networks that enable wireless communications. The terminal device may include, but is not limited to, at least one of: a Mobile phone (such as an Android Mobile phone, an iOS Mobile phone, etc.), a notebook computer, a tablet computer, a palm computer, an MID (Mobile INTERNET DEVICES, mobile internet device), a PAD, a desktop computer, a smart television, a vehicle-mounted device, etc. The terminal device may have a client installed thereon, where the terminal device 104 may have a client installed therein for requesting code engineering testing, such as an online code testing program or the like.
The terminal device 104 is further provided with a display, a processor and a memory, wherein the display can be used for displaying the program interface for performing the code test, and the processor can be used for preprocessing the label opening identification information to be sent, such as encryption processing and compression processing; the memory is used for storing the running result set returned by the server. It may be appreciated that, in the case that the switch identifier of the user for the target code segment request is received in the terminal device 104, the terminal device 104 may send switch identifier information to the server 102 through the network 110, and in the case that the server 102 receives the switch identifier information, determine to operate the target code project according to the switch identifier information in the first test environment; the terminal device 104 may then receive, via the network 110, the target operation result set returned by the server 102, and further perform code analysis according to the received target operation result set.
The server 102 may be a single server, a server cluster composed of a plurality of servers, or a cloud server. The server includes a database and a processing engine. Wherein the processing engine is configured to run the object code project in a first test environment; the database may be used to store a set of operating results in different test environments sent by the terminal device 104.
According to an aspect of the embodiment of the present invention, the above-mentioned operation result obtaining system may further perform the following steps: firstly, the terminal device 104 performs step S102, determines the switch identifier of the target code segment at the terminal device 104, and then performs step S104, where the terminal device 104 sends the switch identifier information to the server 102 through the network 110; the server 102 executes steps S106 to S112, and runs an object code project in the first test environment, where the object code project includes an object code segment, and the object code segment is a code segment carrying an external dependent access request; acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state; operating the target code segment under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state, and obtaining a target operation result; and acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result. Then, as in step S114, the server 102 sends the target running result set to the terminal device 104 through the network 110, and finally, as in step S116, the terminal device 104 performs code debugging on the target code project according to the target running result set.
In the embodiment of the invention, an object code project is operated in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request; acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state; operating the target code segment under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state, and obtaining a target operation result; and acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result. According to the method, under the condition that the target code segment which possibly introduces new noise and carries an external dependent access request exists in the code engineering, the switch identification of the target code segment is acquired firstly to confirm the deployment state of the target code segment in the second test environment, and the target code is operated only under the condition that the target code segment is confirmed to be in the deployed state in the second test environment, so that under the condition that the target code segment is not deployed in the second test environment, the problem that new noise difference is introduced due to the fact that the target code segment is operated in the first test environment is avoided, consistency of code engineering operated in different test environments is ensured, accuracy of test results output in the test environments is ensured, and the technical problem that noise difference is introduced due to the fact that the new code is not processed in the related technology is solved.
The above is merely an example, and is not limited in any way in the present embodiment.
As an alternative embodiment, as shown in fig. 2, the method for obtaining the operation result may be applied to a server, and in particular, the first server may be a server that provides a first test environment to perform test operation on an object code project, where the embodiment may include the following steps:
s202, running an object code project in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request;
S204, acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state;
S206, operating the target code segment to obtain a target operation result under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state;
s208, acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
In the step S202, the first test environment may be a test environment distinguished from the second test environment, and the distinction may be that: the first test environment and the second test environment may have different environmental characteristics, for example, the first test environment may be a test environment service, the second test environment may be an online environment service, and the distinction between the two different test environments may include: under the condition that a code segment carrying an external dependent access request is operated in the online environment service, the external dependent access can be normally executed, and a corresponding access result is obtained; in the test environment service, external dependent access cannot be normally executed, and the access result in the online environment service needs to be relied on to determine the final operation result.
It should be noted that, the external dependencies refer to other services that the tested service needs to access, such as a database, a cache, an RPC, and the like.
Further, in step S204 described above, the switch identification of the target code segment may be used to indicate the deployment status of the target code segment in the second test environment. It will be appreciated that in this embodiment, the target code segment is already deployed in the target code project in the first test environment, but there may be undeployed situations in the second test environment. In particular, the object code segment may be a new feature compared to the second test environment, which may be specifically an added code introduced by the service under test due to the evolution of the functionality.
In the step S206, if the switch identifier indicates that the deployment state of the target code segment in the second test environment is the deployed state, the target code segment is run, so as to obtain a target running result;
As an alternative embodiment, after determining the deployment state of the target code segment in the second test environment according to the switch identifier, skipping the target code segment if the switch identifier indicates that the deployment state of the target code segment in the second test environment is an undeployed state; and (3) operating the part of the target code engineering which does not comprise the target code segment to obtain a target operation result set of the target code engineering in the first test environment.
It may be appreciated that in the foregoing embodiment, in the process of executing the foregoing object code project, each time the object code segment having external access dependency is executed, the switch identifier of the object code segment may be first obtained, so as to determine the deployment state of the object code segment in the second test environment, and determine the execution result according to the deployment state of the object code segment in the second test environment.
Specifically, when the deployment state of the target code segment in the second test environment is the deployed state, the target code segment can be normally operated without generating new noise due to the operation of the code segment which is not deployed in the second test environment in the first test environment; and under the condition that the deployment state of the target code segment in the second test environment is determined to be the undeployed state, skipping the target code segment so as to avoid generating new noise when the undeployed code segment of the second test environment is operated in the first test environment.
In the step S208, the target running result set may be a set of partial running results generated by the target code engineering during the running of the first test environment; the target code engineering may also be a set of all operation results generated in the operation process of the first test environment, and the all operation results may also include intermediate results generated in the operation process. It can be understood that by acquiring the final operation result and the target operation result set formed by the intermediate operation result of the target code engineering, the comparison can be performed with the operation result sets obtained in other test environments to determine the result difference generated by the operation of the target code engineering in different test environments, and then the debugging and analysis can be performed on the target code engineering according to the result difference.
According to the embodiment of the application, the target code engineering is operated in the first test environment, wherein the target code engineering comprises a target code segment, and the target code segment is a code segment carrying an external dependent access request; acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state; operating the target code segment under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state, and obtaining a target operation result; acquiring a target operation result set of the target code engineering in a first test environment according to the target operation result; or, skipping the target code segment if the switch identification indicates that the deployed state of the target code segment in the second test environment is an undeployed state; and (3) operating the part of the target code engineering which does not comprise the target code segment to obtain a target operation result set of the target code engineering in the first test environment.
According to the method, under the condition that the target code segment which possibly introduces new noise and carries an external dependent access request exists in the code engineering, the switch identification of the target code segment is acquired firstly to confirm the deployment state of the target code segment in the second test environment, and the target code is operated only under the condition that the target code segment is confirmed to be in the deployed state in the second test environment, so that under the condition that the target code segment is not deployed in the second test environment, the problem that new noise difference is introduced due to the fact that the target code segment is operated in the first test environment is avoided, consistency of code engineering operated in different test environments is ensured, accuracy of test results output in the test environments is ensured, and the technical problem that noise difference is introduced due to the fact that the new code is not processed in the related technology is solved.
As an optional implementation manner, in step S204, obtaining the switch identifier of the target code segment includes:
S302, a query request is sent to an identification management system through a query interface, wherein the query request is used for querying a switch identification corresponding to a target code segment, the identification management system comprises a plurality of query nodes, each query node corresponds to one target code segment, and the switch state of the target code segment is recorded in each query node;
s304, acquiring a switch identifier returned by the identifier management system, wherein the switch identifier indicates that the target code segment is in a deployed state in the second test environment under the condition that the switch identifier is the first identifier, and indicates that the target code segment is in an undeployed state in the second test environment under the condition that the switch identifier is the second identifier.
It should be noted that, the query interface may be an SDK interface capability provided by the test system in the first test environment, so that when the test system runs to a code segment carrying an external dependency request, the deployment condition of the target code in the second test environment is queried through the SDK interface capability. The above-mentioned label management system may be specifically a Zookeeper system, where each switch label corresponds to ZNode in a Zookeeper, and consistency and high availability of the system are ensured by the Zookeeper. The test environment service inquires the current effective rule of the characteristic switch identification through the characteristic switch SDK so as to judge whether the corresponding characteristic code segment is in a deployed state in the online environment service when the external request is processed
Through the above embodiment of the application, the query request is sent to the identifier management system through the query interface; and acquiring a switch identifier returned by the identifier management system, wherein the switch identifier indicates that the target code segment is in a deployed state in the second test environment under the condition that the switch identifier is a first identifier, and indicates that the target code segment is in an undeployed state in the second test environment under the condition that the switch identifier is a second identifier, so that the identifier information corresponding to the target code segment is uniformly managed in the identifier management system, and further, under the condition of running to the target code segment, the deployment state of the target code segment in the second test environment is firstly queried, and then whether the target code segment is run or not is determined according to the deployment state.
As an optional real-time manner, in step S206, where the switch identifier indicates that the deployment status of the target code segment in the second test environment is the deployed status, the running the target code segment includes:
S402, an external dependency result reference sequence corresponding to the target code segment is obtained, wherein the external dependency result reference sequence is a result sequence generated in the running process of the target code segment in the second test environment;
s404, running the target code segment according to the external dependency result reference sequence.
As an optional implementation manner, before the step S402 of obtaining the external dependency result reference sequence corresponding to the target code segment, the method further includes:
s502, running an object code project in a second test environment;
s504, acquiring a request result sequence corresponding to the external dependency request sequence according to the external dependency request sequence carried in the target code segment;
S506, determining the external dependent result reference sequence corresponding to the target code segment from the request result sequence.
In this embodiment, the above test mode may be specifically a flow playback regression test. Specifically, the target code engineering may be first run in the second test environment, and under the condition that the target code segment included in the second test environment is in the deployed state, the target code segment is normally executed according to the environmental capability of the second test environment, that is, the external dependency request is normally executed, and the corresponding external dependency request result is saved and recorded.
Under the condition that the target code segment is operated in the first test environment, the external dependency request cannot be executed in the first test environment, so that the external request result obtained by the record storage is required to be played back, namely, the target code segment is executed in the first test environment by utilizing the external dependency request result obtained in the second test environment, so that the same code is ensured to be executed in the first test environment and the second test environment under the same condition, and regression test noise caused by newly added external dependency access in the increment characteristic is restrained.
As an optional implementation manner, step S202 may further include, after the running of the object code project in the first test environment:
S602, a switch identification sequence corresponding to a target code segment set in target code engineering is obtained, wherein the target code segment set comprises N target code segments, the N target code segments are target code segments carrying external dependent access requests, the switch identification sequence is used for indicating the deployment state of the N target code segments in a second test environment, the deployment state comprises a deployed state and an undeployed state, and N is an integer greater than 1;
s604, acquiring a target operation result set of the target code engineering in the first test environment according to the switch identification sequence, wherein the target operation result set does not comprise a reference operation result, and the reference operation result is an operation result of the target code segment of which the switch is identified as an undeployed state.
It should be noted that, in this embodiment, in a case where there are a plurality of target code segments in the target code project, a switch identification sequence corresponding to the plurality of target code segments may be acquired, where each switch in the switch identification sequence corresponds to one target code segment, so as to indicate a deployment state of the corresponding target code segment in the second test environment.
For example, in the case that there are 3 target code segments "code segment 1, code segment 2, and code segment 3" in the target code project, the switch identification sequences corresponding to the three code segments may be queried from the identification management system through the query interface, for example, "1,0,1" may be used to indicate that the code segment 1 is in a deployed state in the second test environment; the code segment 2 is in an undeployed state in a second test environment; the above-mentioned code segment 3 is in a deployed state in the second test environment.
Further, in the process of running the target code engineering, under the condition of running the target code engineering to the code segment 1, normally running the code segment 1, and obtaining a corresponding first external dependency result reference sequence to obtain a running result of the code segment 1, wherein it can be understood that the first external dependency result reference sequence is a request result sequence corresponding to an external dependency request when the code segment 1 runs in a second test environment; in the case of running to code segment 2, code segment 2 is skipped; under the condition of running to the code segment 3, the code segment 3 is normally run, and a corresponding third external dependent result reference sequence is acquired to obtain the running result of the code segment 3. And further acquiring all the running results of the target code engineering in the first test environment according to the running results of the three target code segments. One embodiment of the present application is described below with reference to fig. 3. As shown in fig. 3, the present application can be applied to a system consisting of an online environment service, a test environment service, a characteristic switch management system, and a flow playback regression test system.
Wherein the feature switch management system is configured to manage feature switch identifications corresponding to new features (i.e., the object code segments) applied by the developer. In the process of testing the online environment service and the test environment service, a characteristic switch system is requested to judge whether the characteristic controlled by the characteristic switch identifier is in an effective state or not.
Further, the characteristic switch management system comprises a management interface UI, a ZooKeeper cluster and a characteristic switch SDK. The developer creates, deletes the property switch identification through the management interface UI, and configures the validation rules of the property switch. Each characteristic switch corresponds to ZNode in one ZooKeeper, and consistency and high availability of the system are ensured through the ZooKeeper. The online environment service and the test environment service query the current validation rule of the characteristic switch identification through the characteristic switch SDK so as to judge whether the corresponding characteristic is in a state when an external request is processed.
In addition, the flow playback regression testing system is used for providing recording playback capability of online requests and external dependencies, receiving return results of online environment service and test environment service, and calculating regression testing differences of the online environment service and the test environment service.
The online environment service is used for deploying the online version code, reporting the access initiated by external dependence to the flow playback regression testing system while processing the online request, and completing the recording step of the flow playback.
The test environment service is used for deploying the code of the test version, switching the access depending on the outside to the MOCK service provided by the flow playback regression test system when the request on the playback line is simultaneously played, and completing the playback step of the flow playback. It should be noted that, the MOCK service is configured to obtain an external dependency return result reported by the online environment service, and apply the return result to continue to process subsequent work. In the test system shown in fig. 3, the following steps may be specifically performed:
s702, the online environment service is configured to be in a recording state of a flow playback regression test, and for each external dependency access, the online environment service sequences a request of the external dependency and a return of the external dependency and sends a sequence result to a Kafka message queue, and the flow playback regression test system consumes the message from the Kafka message queue and further persists to the HDFS distributed storage system.
S704, the test environment service is configured to play back the flow back to the playback state of the test, and for each external dependent access, the test environment service first queries the effective state of the corresponding characteristic switch identifier through the characteristic switch SDK.
S706-1, if the status of the characteristic switch identification is on, requesting the flow to replay the MOCK service provided by the regression testing system to acquire an external dependence return result reported by the online environment service, and continuing to process subsequent work after the return result is applied.
S706-2, if the status of the characteristic switch identification is off, the characteristic is a new characteristic which is not possessed by the online environment service, the online environment service does not report the returned result of the external dependent access to the flow playback regression test system, and the playback request processing flow is abnormally interrupted when the MOCK service is continuously requested, so that the external dependent access needs to be skipped, and abnormal interruption of the playback flow and generation of playback difference noise are avoided.
According to the embodiment of the application, the characteristic switch system is introduced, the new characteristic comprising the external dependent access is controlled by the characteristic switch, and the characteristic switch state is kept to be closed when the on-line request is executed in the test environment service, so that regression test noise caused by the newly added external dependent access in the incremental characteristic is restrained.
As an optional implementation manner, step S202 above, before running the object code project in the first test environment, further includes:
S802, acquiring a switch identifier creation request, wherein the identifier creation request is used for configuring a corresponding switch identifier for a target code segment;
s804, according to the switch identification information included in the identification creation request, creating a query node corresponding to the target code segment in the identification management system, wherein the query node records the deployment state of the target code.
The following describes a specific procedure for creating a switch flag according to the present application with reference to fig. 4 to 7:
as shown in fig. 4, when developing a new feature with external dependent access, a developer needs to apply a feature switch identifier at the feature switch management platform, and use the identifier to control the code of the external dependent access part in the code implementation of the new feature;
As shown in fig. 5, after the new feature is released online, the new feature is validated on the online environment service by changing the state of the feature switch, and the validation range may be all validated; or may be partially validated as shown in fig. 6;
it should be noted that the options of the effective range of the feature switch described above may be used to indicate that the new feature is effective only for a part of the scenario, for example only for certain specific users, certain specific IP addresses.
The adaptation rule shown in fig. 6 may be a complex validation rule consisting of and, or, equal, unequal, inclusive, exclusive, etc.
As shown in fig. 7, in the next version after the status of the feature switch flag is changed to the fully-on state, the control logic associated with the flag is down, and the flag deletion is deleted in the feature switch management platform. It should be noted that, the control logic refers to two sets of logic that the switch that needs to be included in the code is on and the switch is off when the characteristic switch is partially on; after the characteristic switch is fully opened, the judging logic and the logic with the switch being closed can be disconnected, and only the logic with the original switch being opened is reserved.
According to the embodiment of the application, the switch identification creation request is obtained, wherein the identification creation request is used for configuring the corresponding switch identification for the target code segment; the method for creating the query node corresponding to the target code segment in the identifier management system is convenient for developers to rapidly deploy and set new characteristics in different test environments according to the switch identifier information included in the identifier creation request, and improves the management efficiency of the new characteristic codes.
In addition, for the newly added characteristics which are not deployed in the online environment service, the switch of the newly added characteristics can be adjusted to be in an off state in the mode, so that the newly added characteristics are skipped under the condition that the target code engineering is operated in the test environment service, and regression test noise caused by the newly added external dependent access in the incremental characteristics is restrained.
As an alternative embodiment, the method further comprises:
S902, before a target operation result set of a target code project in a first test environment is obtained according to a target operation result, a second operation result set obtained by the target code project in a second test environment is obtained, and a third operation result set obtained by the target code project in a third test environment is obtained;
s904, after a target operation result set of the target code engineering in the first test environment is obtained according to the target operation result, determining a result difference of the third operation result set and the second test result set as a system noise difference;
s906, determining the target operation result set and the third operation result set as full test differences;
S908, a difference between the full test difference and the system noise difference is determined as a target test difference.
In this embodiment, the flow agent forwarding capability is added in the online environment network layer, and the online environment request is forwarded to the online environment service, the online environment contrast service and the test environment service respectively, so as to obtain three processing results. The difference in these three processing results may reflect the degree of difference in the test environment service relative to the online environment service.
Since the codes deployed in the online environment service and the online environment contrast service are the same, the difference in processing results between the two services is the inherent noise of the system itself (generally due to different system time, different random number generation results, and the like).
The resulting difference between the online environmental service and the test environmental service is a full-scale difference, including a noise difference and an actual difference, where the actual difference is the expected result of the flow playback regression test.
Therefore, the total quantity difference between the online environment service and the test environment service is compared with the inherent noise obtained by comparing the online environment service with the online environment comparison service, and the inherent noise part contained in the total quantity difference is removed, so that the suppression of the inherent noise part in the flow playback regression test is realized.
It can be understood that, in this embodiment, the target operation result set is a result set after suppressing, according to the switching system, the result noise that may be brought by the new feature. Therefore, when the new characteristic of the test environment service relative to the online environment service contains access to external dependence, the state of the characteristic switch can be kept to be in a closed state through the switch system to indicate that the new characteristic is not deployed in the online environment service, and further, the technical problem that the request processing of the test environment service is interrupted due to the fact that recording results are lack and new noise outside the inherent noise of the system is caused because the flow playback returns to a return result that the test system does not record the new external dependence access in the online environment is solved. That is, by introducing the feature switching system, a new feature including an external dependent access is controlled by the feature switch, and the feature switch state is kept off when an on-line request is performed in the test environment service, thereby achieving a technical effect of suppressing regression test noise due to the newly added external dependent access in the incremental feature.
According to the flow playback regression test noise suppression method based on the characteristic switch, regression test noise caused by newly added external dependent access in the incremental characteristic can be effectively suppressed. In the realization of the system, the system also has the advantages of low cost, high modularization degree, strong maintainability, small invasiveness to the flow playback regression test system and the like.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
According to another aspect of the embodiment of the present invention, there is also provided an operation result acquisition device for implementing the above operation result acquisition method. As shown in fig. 8, the apparatus includes:
A first running unit 802, configured to run an object code project in a first test environment, where the object code project includes an object code segment, and the object code segment is a code segment that carries an external dependent access request;
A first obtaining unit 804, configured to obtain a switch identifier of the target code segment, where the switch identifier is used to indicate a deployment state of the target code segment in the second test environment, and the deployment state includes a deployed state and an undeployed state;
a second running unit 806, configured to run the target code segment to obtain a target running result when the switch identifier indicates that the deployment state of the target code segment in the second test environment is a deployed state;
And the second obtaining unit 808 is configured to obtain a target operation result set of the target code engineering in the first test environment according to the target operation result.
Alternatively, in this embodiment, the embodiments to be implemented by each unit module may refer to the embodiments of each method described above, which are not described herein again.
According to still another aspect of the embodiment of the present invention, there is also provided an electronic device for implementing the method for obtaining an operation result as described above, where the electronic device may be a terminal device or a server as shown in fig. 9. The present embodiment is described taking the electronic device as a terminal device as an example. As shown in fig. 9, the electronic device comprises a memory 902 and a processor 904, the memory 902 having stored therein a computer program, the processor 904 being arranged to perform the steps of any of the method embodiments described above by means of the computer program.
Alternatively, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of the computer network.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
S1002, running an object code project in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request;
S1004, acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state;
S1006, operating the target code segment to obtain a target operation result under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state;
s1008, acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
Alternatively, it will be understood by those skilled in the art that the structure shown in fig. 9 is only schematic, and the electronic device may also be a vehicle-mounted terminal, a smart phone (such as an Android Mobile phone, an iOS Mobile phone, etc.), a tablet computer, a palm computer, a Mobile internet device (Mobile INTERNET DEVICES, MID), a PAD, etc. Fig. 9 is not limited to the structure of the electronic device described above. For example, the electronic device may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 9, or have a different configuration than shown in FIG. 9.
The memory 902 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for obtaining an operation result in the embodiment of the present invention, and the processor 904 executes the software programs and modules stored in the memory 902, thereby executing various functional applications and data processing, that is, implementing the method for obtaining an operation result as described above. The memory 902 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 902 may further include memory remotely located relative to the processor 904, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 902 may be used to store, but is not limited to, file information such as a target logical file. As an example, as shown in fig. 9, the memory 902 may include, but is not limited to, a first operation unit 802, a first acquisition unit 804, a second operation unit 806, and a second acquisition unit 808 in the acquisition device of the operation result. In addition, other module units in the above-mentioned operation result obtaining device may be included, but are not limited to, and are not described in detail in this example.
Optionally, the transmission device 906 is used to receive or transmit data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission means 906 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 906 is a Radio Frequency (RF) module for communicating wirelessly with the internet.
In addition, the electronic device further includes: a display 908, and a connection bus 910 for connecting the respective module components in the above-described electronic device.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the plurality of nodes through a network communication. Among them, the nodes may form a Peer-To-Peer (P2P) network, and any type of computing device, such as a server, a terminal, etc., may become a node in the blockchain system by joining the Peer-To-Peer network.
According to one aspect of the present application, there is provided a computer program product comprising a computer program/instruction containing program code for executing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via a communication portion, and/or installed from a removable medium. When executed by a central processing unit, performs various functions provided by embodiments of the present application.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
According to an aspect of the present application, there is provided a computer-readable storage medium, from which a processor of a computer device reads computer instructions, the processor executing the computer instructions, so that the computer device performs the above-described method of acquiring an operation result.
Alternatively, in the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for performing the steps of:
S1102, running an object code project in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request;
S1104, acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in the second test environment, and the deployment state comprises a deployed state and an undeployed state;
s1106, operating the target code segment to obtain a target operation result under the condition that the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state;
S1108, acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
Alternatively, in this embodiment, it will be understood by those skilled in the art that all or part of the steps in the methods of the above embodiments may be performed by a program for instructing a terminal device to execute the steps, where the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the above-described method of the various embodiments of the present invention.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided by the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the above, is merely a logical function division, and may be implemented in another manner, 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 through some interfaces, units or modules, or may be in electrical or other forms.
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 the embodiments of the present invention 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 foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (11)

1. A method for obtaining an operation result, comprising:
running an object code project in a first test environment, wherein the object code project comprises an object code segment, and the object code segment is a code segment carrying an external dependent access request;
Acquiring a switch identifier of the target code segment, wherein the switch identifier is used for indicating a deployment state of the target code segment in a second test environment, and the deployment state comprises a deployed state and an undeployed state;
operating the target code segment to obtain a target operation result under the condition that the switch identifier indicates that the deployment state of the target code segment in the second test environment is the deployed state;
and acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
2. The method of claim 1, wherein after the obtaining the switch identification of the target code segment, further comprising:
Skipping the target code segment if the switch identification indicates that the deployed state of the target code segment in the second test environment is an undeployed state;
and operating the part of the target code engineering which does not comprise the target code segment to obtain a target operation result set of the target code engineering in the first test environment.
3. The method of claim 2, wherein the obtaining the switch identification of the target code segment comprises:
Sending a query request to an identifier management system through a query interface, wherein the query request is used for querying a switch identifier corresponding to the target code segment, the identifier management system comprises a plurality of query nodes, each query node corresponds to one target code segment, and the switch state of the target code segment is recorded in each query node;
And acquiring a switch identifier returned by the identifier management system, wherein the switch identifier indicates that the target code segment is in a deployed state in the second test environment under the condition of the switch identifier being a first identifier, and indicates that the target code segment is in an undeployed state in the second test environment under the condition of the switch identifier being a second identifier.
4. The method of claim 2, wherein, in the event that the switch identification indicates that the deployment status of the target code segment in the second test environment is a deployed status, running the target code segment comprises:
obtaining an external dependency result reference sequence corresponding to the target code segment, wherein the external dependency result reference sequence is a result sequence generated in the running process of the target code segment in the second test environment;
And operating the target code segment according to the external dependency result reference sequence.
5. The method of claim 4, further comprising, prior to the obtaining the external dependency result reference sequence corresponding to the target code segment:
Running the object code project in a second test environment;
acquiring a request result sequence corresponding to the external dependency request sequence according to the external dependency request sequence carried in the target code segment;
The request result sequence is determined as the external dependency result reference sequence corresponding to the target code segment.
6. The method of any of claims 1 to 5, further comprising, prior to running the object code project in the first test environment:
acquiring a switch identifier creation request, wherein the identifier creation request is used for configuring a corresponding switch identifier for the target code segment;
And creating a query node corresponding to the target code segment in an identification management system according to the switch identification information included in the identification creation request, wherein the deployment state of the target code is recorded in the query node.
7. The method according to any one of claims 1 to 5, further comprising:
Before acquiring a target operation result set of the target code project in the first test environment according to the target operation result, acquiring a second operation result set obtained by the target code project in a second test environment, and acquiring a third operation result set obtained by the target code project in a third test environment;
After a target operation result set of the target code engineering in the first test environment is obtained according to the target operation result, determining a result difference of the third operation result set and the second test result set as a system noise difference;
Determining the target operation result set and the third operation result set as full test differences;
and determining a difference between the full test difference and the system noise difference as a target test difference.
8. An apparatus for acquiring an operation result, comprising:
the first running unit is used for running an object code project in a first test environment, wherein the object code project comprises an object code section, and the object code section is a code section carrying an external dependent access request;
A first obtaining unit, configured to obtain a switch identifier of the target code segment, where the switch identifier is used to indicate a deployment state of the target code segment in a second test environment, and the deployment state includes a deployed state and an undeployed state;
the second running unit is used for running the target code segment to obtain a target running result when the switch identification indicates that the deployment state of the target code segment in the second test environment is the deployed state;
and the second acquisition unit is used for acquiring a target operation result set of the target code engineering in the first test environment according to the target operation result.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program, wherein the program, when run, performs the method of any one of claims 1 to 7.
10. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the method of any of claims 1 to 7.
11. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 7 by means of the computer program.
CN202211595828.7A 2022-12-13 2022-12-13 Method and device for acquiring operation result, storage medium and electronic equipment Pending CN118193347A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211595828.7A CN118193347A (en) 2022-12-13 2022-12-13 Method and device for acquiring operation result, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211595828.7A CN118193347A (en) 2022-12-13 2022-12-13 Method and device for acquiring operation result, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN118193347A true CN118193347A (en) 2024-06-14

Family

ID=91402144

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211595828.7A Pending CN118193347A (en) 2022-12-13 2022-12-13 Method and device for acquiring operation result, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN118193347A (en)

Similar Documents

Publication Publication Date Title
CN106844137B (en) Server monitoring method and device
KR20120120220A (en) Cloud computing monitoring and management system
CN113055492A (en) Control method and device for service gray scale link, computer equipment and storage medium
CN110928770B (en) Software testing method, device, system, storage medium and electronic equipment
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN115380256A (en) Equipment state monitoring method, device, equipment and storage medium
WO2016115896A1 (en) Method and device for management of virtual network function (vnf)
CN112583630B (en) Device management method, device, system, device and storage medium
CN113347257A (en) Communication method, communication device, server and storage medium
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN115883310A (en) Service deployment method, service deployment system, electronic device, and storage medium
KR20210075898A (en) Integrated gateway for efficient OPC UA server data access and integration
CN118193347A (en) Method and device for acquiring operation result, storage medium and electronic equipment
CN111147600A (en) Service execution method and terminal under cluster environment
CN112650815B (en) Method and device for synchronizing environment data, storage medium and electronic device
CN113918423A (en) Cloud platform monitoring method and device and application thereof
CN114546842A (en) Interface test method and device, storage medium and electronic equipment
CN112650666B (en) Software testing system, method, device, control equipment and storage medium
CN113377682A (en) Service testing method and device
CN108733805B (en) File interaction method, system, computer equipment and storage medium
CN115314376B (en) Method and device for deploying network plug-ins in cluster, electronic equipment and storage medium
CN112748981B (en) Processing method and device for software mirror image of virtual network function
CN117883789B (en) Data acquisition method, apparatus, device, readable storage medium, and program product
CN112732296B (en) Software version updating method and device, storage medium and electronic equipment
CN110740151A (en) micro-service adjusting method, device, server and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication