CN116991713B - Method, device, computer equipment and storage medium for executing use cases across environments - Google Patents
Method, device, computer equipment and storage medium for executing use cases across environments Download PDFInfo
- Publication number
- CN116991713B CN116991713B CN202310870433.1A CN202310870433A CN116991713B CN 116991713 B CN116991713 B CN 116991713B CN 202310870433 A CN202310870433 A CN 202310870433A CN 116991713 B CN116991713 B CN 116991713B
- Authority
- CN
- China
- Prior art keywords
- environment
- information
- cross
- use case
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 88
- 238000003860 storage Methods 0.000 title claims abstract description 20
- 238000012360 testing method Methods 0.000 claims description 80
- 238000004590 computer program Methods 0.000 claims description 29
- 238000004519 manufacturing process Methods 0.000 claims description 26
- 230000007613 environmental effect Effects 0.000 claims description 11
- 238000011161 development Methods 0.000 abstract description 15
- 238000004904 shortening Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 21
- 230000006870 function Effects 0.000 description 12
- 230000004044 response Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 238000012795 verification Methods 0.000 description 7
- 238000013475 authorization Methods 0.000 description 5
- 238000010276 construction Methods 0.000 description 4
- 238000013461 design Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000008901 benefit Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000000605 extraction Methods 0.000 description 3
- 230000010354 integration Effects 0.000 description 3
- 230000007246 mechanism Effects 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 230000006399 behavior Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000012550 audit Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000004883 computer application Methods 0.000 description 1
- 235000014510 cooky Nutrition 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000013024 troubleshooting Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3698—Environments for analysis, debugging or testing of software
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
本申请涉及跨环境执行用例的方法、装置、计算机设备及存储介质。所述方法包括:在当前环境下,获取用例内容和目标环境的环境参数信息;根据所述目标环境的环境参数信息获取对应的令牌信息;根据所述令牌信息构建跨环境配置信息,其中,所述跨环境配置信息用于供所述目标环境的接口网关识别;根据所述用例内容和所述跨环境配置信息生成跨环境用例,并将所述跨环境用例同步至所述目标环境,以在所述目标环境下执行所述跨环境用例。采用本方法能够使得用例能够跨环境执行,从而缩短应用程序的开发周期,减小编写用例成本,提高开发效率。
This application relates to methods, devices, computer equipment and storage media for executing use cases across environments. The method includes: obtaining the use case content and the environment parameter information of the target environment in the current environment; obtaining the corresponding token information according to the environment parameter information of the target environment; and constructing the cross-environment configuration information according to the token information, wherein , the cross-environment configuration information is used for identification by the interface gateway of the target environment; generate a cross-environment use case according to the use case content and the cross-environment configuration information, and synchronize the cross-environment use case to the target environment, to execute the cross-environment use case in the target environment. Using this method can enable use cases to be executed across environments, thereby shortening the application development cycle, reducing the cost of writing use cases, and improving development efficiency.
Description
技术领域Technical field
本申请涉及计算机应用领域,特别是涉及一种跨环境执行用例的方法、装置、计算机设备及存储介质。The present application relates to the field of computer applications, and in particular to a method, device, computer equipment and storage medium for executing use cases across environments.
背景技术Background technique
随着应用程序的开发和测试技术的发展,目前,技术人员通过多个不同的环境对应用程序进行测试,从而获得更加全面的测试结果,保证应用程序上线后的效果符合预期。而不同环境中采用的测试用例不同,并且彼此之间不能相互调用,针对单个环境增加、删除或修改的用例内容也只作用于当前的一个环境,其他环境的用例不受影响。因此,若想要完成不同环境下的测试过程,需要在每个环境下编写对应的用例,这导致编写用例的成本较高,效率低下。With the development of application development and testing technology, technicians currently test applications in multiple different environments to obtain more comprehensive test results and ensure that the effects of the application after it is launched meet expectations. The test cases used in different environments are different and cannot be called between each other. Use case content added, deleted or modified for a single environment only affects the current environment, and use cases in other environments are not affected. Therefore, if you want to complete the testing process in different environments, you need to write corresponding use cases in each environment, which results in high cost and low efficiency in writing use cases.
发明内容Contents of the invention
基于此,有必要针对上述技术问题,提供一种能够使得用例能够跨环境执行,从而缩短应用程序的开发周期,减小编写用例成本,提高开发效率的跨环境执行用例的方法、装置、计算机设备及存储介质。Based on this, it is necessary to address the above technical issues and provide a method, device, and computer equipment for cross-environment execution of use cases that can enable use cases to be executed across environments, thereby shortening the application development cycle, reducing the cost of writing use cases, and improving development efficiency. and storage media.
第一方面,本申请提供了一种跨环境执行用例的方法。所述方法包括:In the first aspect, this application provides a method for executing use cases across environments. The methods include:
在当前环境下,获取用例内容和目标环境的环境参数信息;In the current environment, obtain the use case content and environment parameter information of the target environment;
根据所述目标环境的环境参数信息获取对应的令牌信息;Obtain corresponding token information according to the environmental parameter information of the target environment;
根据所述令牌信息构建跨环境配置信息,其中,所述跨环境配置信息用于供所述目标环境的接口网关识别;Construct cross-environment configuration information according to the token information, wherein the cross-environment configuration information is used for identification by the interface gateway of the target environment;
根据所述用例内容和所述跨环境配置信息生成跨环境用例,并将所述跨环境用例同步至所述目标环境,以在所述目标环境下执行所述跨环境用例。A cross-environment use case is generated according to the use case content and the cross-environment configuration information, and the cross-environment use case is synchronized to the target environment to execute the cross-environment use case in the target environment.
在其中一个实施例中,所述用例内容包括当前环境的环境参数信息,不同环境对应的所述环境参数信息所指示的数值不同;所述根据所述目标环境的环境参数信息获取对应的令牌信息包括:In one embodiment, the use case content includes environmental parameter information of the current environment, and the numerical values indicated by the environmental parameter information corresponding to different environments are different; the corresponding token is obtained according to the environmental parameter information of the target environment. Information includes:
比较所述当前环境和所述目标环境对应的所述环境参数信息所指示的数值;Compare the values indicated by the environment parameter information corresponding to the current environment and the target environment;
在所述当前环境的环境参数信息所指示的数值大于或等于所述目标环境的环境参数信息所指示的数值的情况下,获取与所述目标环境相对应的令牌信息。When the value indicated by the environment parameter information of the current environment is greater than or equal to the value indicated by the environment parameter information of the target environment, token information corresponding to the target environment is obtained.
在其中一个实施例中,所述在所述当前环境的环境参数信息所指示的数值大于或等于所述目标环境的环境参数信息所指示的数值的情况下,获取与所述目标环境相对应的令牌信息包括:In one embodiment, when the value indicated by the environment parameter information of the current environment is greater than or equal to the value indicated by the environment parameter information of the target environment, obtaining the value corresponding to the target environment. Token information includes:
在所述当前环境的环境参数信息所指示的数值等于所述目标环境的环境参数信息所指示的数值的情况下,直接以第一调用方式获取与所述目标环境相对应的令牌信息;When the value indicated by the environment parameter information of the current environment is equal to the value indicated by the environment parameter information of the target environment, directly obtain the token information corresponding to the target environment in the first calling method;
在所述当前环境的环境参数信息所指示的数值大于所述目标环境的环境参数信息所指示的数值的情况下,获取所述目标环境的接口网关代理地址,并根据所述接口网关代理地址,以第一调用方式获取与所述目标环境相对应的令牌信息。When the value indicated by the environment parameter information of the current environment is greater than the value indicated by the environment parameter information of the target environment, obtain the interface gateway proxy address of the target environment, and based on the interface gateway proxy address, Obtain token information corresponding to the target environment in a first calling manner.
在其中一个实施例中,所述第一调用方式是泛化调用。In one embodiment, the first calling method is a generalized calling.
在其中一个实施例中,所述根据所述令牌信息构建跨环境配置信息包括:In one embodiment, constructing cross-environment configuration information based on the token information includes:
获取所述用例内容的头信息;Obtain the header information of the use case content;
将所述令牌信息拼接到所述头信息中,以构建跨环境配置信息。The token information is spliced into the header information to construct cross-environment configuration information.
在其中一个实施例中,所述根据所述目标环境的环境参数信息获取对应的令牌信息之前还包括:In one embodiment, before obtaining the corresponding token information according to the environmental parameter information of the target environment, the method further includes:
执行所述用例内容,以获得结果日志;Execute the use case content to obtain the result log;
验证所述结果日志是否符合预设标准;Verify that the result log meets preset standards;
在所述结果日志符合所述预设标准的情况下,执行所述根据所述目标环境的环境参数信息获取对应的令牌信息的步骤。If the result log meets the preset standard, the step of obtaining corresponding token information according to the environment parameter information of the target environment is performed.
在其中一个实施例中,所述当前环境和所述目标环境分别是测试环境、预发布环境和生产环境中的任意一个。 In one embodiment, the current environment and the target environment are any one of a test environment, a pre-release environment and a production environment respectively .
第二方面,本申请还提供了一种跨环境执行用例的装置。所述装置包括:In the second aspect, this application also provides a device for executing use cases across environments. The device includes:
用例获取模块,用于在当前环境下,获取用例内容和目标环境的环境参数信息;The use case acquisition module is used to obtain the use case content and environment parameter information of the target environment in the current environment;
令牌生成模块,用于根据所述目标环境的环境参数信息获取对应的令牌信息;A token generation module, configured to obtain corresponding token information according to the environmental parameter information of the target environment;
环境配置模块,用于根据所述令牌信息构建跨环境配置信息,其中,所述跨环境配置信息用于供所述目标环境的接口网关识别;An environment configuration module, configured to construct cross-environment configuration information based on the token information, wherein the cross-environment configuration information is used for identification by the interface gateway of the target environment;
用例同步模块,用于根据所述用例内容和所述跨环境配置信息生成跨环境用例,并将所述跨环境用例同步至所述目标环境,以在所述目标环境下执行所述跨环境用例。A use case synchronization module, configured to generate a cross-environment use case based on the use case content and the cross-environment configuration information, and synchronize the cross-environment use case to the target environment to execute the cross-environment use case in the target environment. .
第三方面,本申请还提供了一种计算机设备。所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现如第一方面所述的步骤。In a third aspect, this application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps described in the first aspect when executing the computer program.
第四方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如第一方面所述的步骤。In a fourth aspect, this application also provides a computer-readable storage medium. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the steps described in the first aspect are implemented.
上述跨环境执行用例的方法、装置、计算机设备及存储介质,能够通过目标环境的环境参数信息获取到对应的令牌信息,从而完成对跨环境配置信息的构建。当进行跨环境执行用例时,需要保证目标环境的接口网关能够识别执行用例的相关信息,此时,上述跨环境配置信息能够供目标环境的接口网关识别,从而调用接口,生成能够在目标环境下执行的跨环境用例,从而完成跨环境执行用例的过程。上述的跨环境配置信息能够在需要跨环境调用时进行实时构建,实时获取其所需的令牌信息,从而保证令牌信息的有效性,很大程度上减低了令牌信息的维护成本,并且避免了手动维护的令牌信息失效的情况发生,排除令牌信息失效问题的干扰,使得用例执行过程中的报错原因更加容易定位,从而缩短应用程序的开发周期。同时,跨环境执行用例能够对不同环境下的用例进行复用,不需要针对不同环境编写同样的用例,因此能够减小编写用例成本,提高开发效率。The above-mentioned methods, devices, computer equipment and storage media for executing use cases across environments can obtain corresponding token information through the environment parameter information of the target environment, thereby completing the construction of cross-environment configuration information. When executing a use case across environments, it is necessary to ensure that the interface gateway of the target environment can identify the relevant information for executing the use case. At this time, the above cross-environment configuration information can be recognized by the interface gateway of the target environment, thereby calling the interface and generating a function that can be used in the target environment. Cross-environment use cases are executed to complete the process of cross-environment execution of use cases. The above cross-environment configuration information can be constructed in real time when it needs to be called across environments, and the required token information can be obtained in real time, thus ensuring the validity of the token information and greatly reducing the maintenance cost of the token information. It avoids the invalidation of manually maintained token information and eliminates the interference of token information invalidation, making it easier to locate the cause of errors during use case execution , thereby shortening the application development cycle. At the same time, cross-environment execution of use cases can reuse use cases in different environments. There is no need to write the same use cases for different environments, so it can reduce the cost of writing use cases and improve development efficiency.
附图说明Description of the drawings
图1为一个实施例中一种跨环境执行用例的方法的应用环境图;Figure 1 is an application environment diagram of a method for executing use cases across environments in one embodiment;
图2为一个实施例中一种跨环境执行用例的方法的流程示意图;Figure 2 is a schematic flowchart of a method for executing use cases across environments in one embodiment;
图3为一个实施例中步骤S204的流程示意图;Figure 3 is a schematic flowchart of step S204 in one embodiment;
图4为一个实施例中步骤S304的流程示意图;Figure 4 is a schematic flowchart of step S304 in one embodiment;
图5为一个实施例中步骤S206的流程示意图;Figure 5 is a schematic flowchart of step S206 in one embodiment;
图6为一个实施例中一种跨环境执行用例的方法的执行主体关系图;Figure 6 is an execution subject relationship diagram of a method for executing use cases across environments in one embodiment;
图7为一个实施例中一种跨环境执行用例的方法的执行架构图;Figure 7 is an execution architecture diagram of a method for executing use cases across environments in one embodiment;
图8为一个实施例中一种跨环境执行用例的装置的结构框图;Figure 8 is a structural block diagram of a device for executing use cases across environments in one embodiment;
图9为一个实施例中计算机设备的内部结构图;Figure 9 is an internal structure diagram of a computer device in one embodiment;
图10为一个实施例中另一种计算机设备的内部结构图。Figure 10 is an internal structure diagram of another computer device in an embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
本申请实施例提供的跨环境执行用例的方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他网络服务器上。通过终端102获取用例内容和目标环境的环境参数信息,再通过目标环境的环境参数信息获取到对应的令牌信息,从而完成对跨环境配置信息的构建。当进行跨环境执行用例时,需要保证目标环境的接口网关能够识别执行用例的相关信息,此时,上述跨环境配置信息能够供目标环境的接口网关识别,从而调通接口,生成能够在目标环境下执行的跨环境用例,从而完成跨环境执行用例的过程。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备等。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The method for executing use cases across environments provided by the embodiments of this application can be applied to the application environment as shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system may store data that server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. The use case content and the environment parameter information of the target environment are obtained through the terminal 102, and the corresponding token information is obtained through the environment parameter information of the target environment, thereby completing the construction of the cross-environment configuration information. When executing a use case across environments, it is necessary to ensure that the interface gateway of the target environment can identify the relevant information for executing the use case. At this time, the above cross-environment configuration information can be identified by the interface gateway of the target environment, so as to adjust the interface and generate the information that can be used in the target environment. Cross-environment use cases executed under the environment, thereby completing the process of cross-environment execution use cases. Among them, the terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices, etc. The server 104 can be implemented as an independent server or a server cluster composed of multiple servers.
在一个实施例中,如图2所示,提供了一种跨环境执行用例方法,本实施例以该方法应用于终端进行举例说明,可以理解的是,该方法也可以应用于服务器,还可以应用于包括终端和服务器的系统,并通过终端和服务器的交互实现。本实施例中,该方法包括以下步骤:In one embodiment, as shown in Figure 2, a cross-environment execution use case method is provided. In this embodiment, the method is applied to the terminal as an example. It can be understood that the method can also be applied to the server, and can also be It is applied to systems including terminals and servers, and is implemented through the interaction between terminals and servers. In this embodiment, the method includes the following steps:
步骤202,在当前环境下,获取用例内容和目标环境的环境参数信息。Step 202: In the current environment, obtain the use case content and the environment parameter information of the target environment.
其中,当前环境是指跨环境执行用例时,对应的用例内容原本存在的环境,可以为该用例内容的编写环境;对应的,上述目标环境是指跨环境执行用例时,需要调用的接口环境。Among them, the current environment refers to the environment where the corresponding use case content originally exists when the use case is executed across environments, and can be the writing environment for the use case content; correspondingly, the above target environment refers to the interface environment that needs to be called when the use case is executed across environments.
其中,用例内容是指描述了测试完整进程的信息。可选地,用例内容描述了对应用程序、终端与服务器接口等进行测试的具体步骤、输入数据、预期结果和验证点等信息。它用于指导测试人员或自动化测试工具执行测试操作,并验证系统在特定条件下的行为和输出是否符合预期。进一步地,用例内容通常可以包括以下要素:用例名称:简洁明确地描述测试的功能或场景;前置条件:描述测试执行前的先决条件或环境要求,确保测试的可执行性;输入数据:指定测试时所使用的输入数据或参数,包括数据类型、取值范围和边界条件等;用例步骤:具体的测试步骤和操作,包括用户界面操作、接口调用、数据输入等,确保测试的可重复性;预期结果:期望系统在执行测试步骤后的输出、状态或行为,通常是一种期望的响应或效果;验证点:用于验证预期结果的具体标准或条件,通常是通过比较实际结果与预期结果来判断测试是否通过;后置条件:描述测试执行后的期望状态或清理操作,确保测试环境的恢复或下一个测试用例的可执行性。测试用例的用例内容具备清晰、准确和可重复执行的特点,以确保测试的一致性和有效性。它是测试工作的核心文档,用于规划、执行和跟踪测试过程,帮助发现系统的缺陷和问题,以及验证系统是否符合预期需求和质量标准。Among them, the use case content refers to the information that describes the complete process of testing. Optionally, the use case content describes the specific steps, input data, expected results, verification points and other information for testing the application, terminal and server interface, etc. It is used to guide testers or automated testing tools to perform test operations and verify that the system's behavior and output are as expected under specific conditions. Furthermore, the use case content can usually include the following elements: use case name: concisely and clearly describe the function or scenario of the test; preconditions: describe the prerequisites or environmental requirements before the test is executed to ensure the executability of the test; input data: specify Input data or parameters used during testing, including data types, value ranges, boundary conditions, etc.; use case steps: specific test steps and operations, including user interface operations, interface calls, data input, etc., to ensure test repeatability ; Expected result: The expected output, state, or behavior of the system after performing a test step, usually an expected response or effect; Verification point: The specific standard or condition used to verify the expected result, usually by comparing the actual result with the expected result The results are used to determine whether the test passes; post-conditions: describe the expected state or cleanup operation after the test is executed to ensure the recovery of the test environment or the executability of the next test case. The test case content must be clear, accurate and repeatable to ensure the consistency and effectiveness of the test. It is the core document of testing work and is used to plan, execute and track the testing process, help discover system defects and problems, and verify whether the system meets expected requirements and quality standards.
其中,目标环境的环境参数信息是指,用来表征目标环境属于哪一个环境的身份信息,通过该环境参数信息能够定义到唯一一个确定的环境,从而确定本次跨环境执行用例的目标环境。Among them, the environment parameter information of the target environment refers to the identity information used to characterize which environment the target environment belongs to. Through this environment parameter information, a unique and certain environment can be defined, thereby determining the target environment of this cross-environment execution use case.
示例性地,上述的当前环境和目标环境可以分别是测试环境、预发布环境和生产环境中的任意一个。并且当前环境和目标环境可以相同也可以不同,在本实施例中不做限定。For example, the above-mentioned current environment and target environment may be any one of a test environment, a pre-release environment, and a production environment respectively. Moreover, the current environment and the target environment may be the same or different, and are not limited in this embodiment.
步骤204,根据目标环境的环境参数信息获取对应的令牌信息。Step 204: Obtain corresponding token information according to the environment parameter information of the target environment.
其中,令牌信息可以是Token,其本质是一种表示身份、权限或访问凭证的数据结构。它是在身份验证和授权过程中使用的一种方式,用于验证用户的身份并授予相应的权限或访问资源。通常情况下,Token是一个字符串,可以是随机生成的一串字符,也可以是经过加密或签名的数据。Token的本质取决于其使用的上下文和实现方式。例如,在身份验证中,Token用于验证用户的身份信息。当用户进行登录或认证时,系统会生成一个Token并将其返回给用户。用户在后续的请求中携带这个Token作为身份凭证,以证明其合法身份;在授权和访问控制中,Token用于授予用户特定的权限或访问权限。系统根据用户的身份和权限生成相应的Token,并在用户请求资源时验证Token的有效性和权限,决定是否允许访问。Among them, the token information can be Token, which is essentially a data structure representing identity, permissions or access credentials. It is a means used during authentication and authorization processes to verify a user's identity and grant appropriate permissions or access to resources. Typically, a Token is a string, which can be a randomly generated string of characters, or encrypted or signed data. The nature of a token depends on the context in which it is used and how it is implemented. For example, in authentication, Token is used to verify the user's identity information. When a user logs in or authenticates, the system generates a Token and returns it to the user. The user carries this Token as an identity credential in subsequent requests to prove his legal identity; in authorization and access control, Token is used to grant users specific permissions or access rights. The system generates the corresponding Token based on the user's identity and permissions, verifies the validity and permissions of the Token when the user requests resources, and decides whether to allow access.
Token的优点包括:无状态性、可扩展性和安全性。可选地,无状态性是指Token本身包含了用户的身份和权限信息,在一些实施例中,服务器不需要维护会话状态,使系统可以实现无状态的分布式身份验证和授权;可扩展性是指Token可以包含自定义的数据字段,在一些实施例中,可以根据需要添加额外的信息,从而满足特定的业务需求,扩大跨环境执行用例方法的应用广泛性;安全性是指通过合适的加密和签名机制,可以保证Token的安全性,防止被篡改或伪造,为跨环境执行用例提供安全保障。The advantages of Token include: statelessness, scalability and security. Optionally, statelessness means that the Token itself contains the user's identity and permission information. In some embodiments, the server does not need to maintain session state, allowing the system to implement stateless distributed authentication and authorization; scalability It means that the Token can contain customized data fields. In some embodiments, additional information can be added as needed to meet specific business needs and expand the application scope of the cross-environment execution use case method; security means that through appropriate The encryption and signature mechanism can ensure the security of Token, prevent it from being tampered with or forged, and provide security guarantee for cross-environment execution of use cases.
示例性地,当需要跨环境执行用例时,可以通过终端102编写用例,或调用已编写完成的用例,同时获取上述目标环境的环境参数。根据获取到的目标环境的环境参数信息,向服务器发出请求,此时,服务器会根据环境参数信息生成对应于目标环境的令牌信息并返回给终端,由终端完成对令牌信息的存储即可。For example, when a use case needs to be executed across environments, the use case can be written through the terminal 102, or a completed use case can be called, and the environment parameters of the above-mentioned target environment can be obtained at the same time. Based on the acquired environment parameter information of the target environment, a request is made to the server. At this time, the server will generate token information corresponding to the target environment based on the environment parameter information and return it to the terminal, and the terminal will complete the storage of the token information. .
步骤206,根据令牌信息构建跨环境配置信息,其中,跨环境配置信息用于供目标环境的接口网关识别。Step 206: Construct cross-environment configuration information based on the token information, where the cross-environment configuration information is used for identification by the interface gateway of the target environment.
其中,跨环境配置信息可以为头信息(Header),它是在HTTP请求或响应中传递附加信息的一种机制,由键值对组成,用于在HTTP报文中携带元数据,描述了报文的属性、格式和其他相关信息。头信息位于HTTP报文的首部(Header)部分,位于请求行或响应行之后,以键值对的形式表示。在一些实施例中,上述的头信息可以为请求头信息或响应头信息等,请求头信息是指在HTTP请求中,用于提供有关客户端或请求的附加信息。常见的请求头信息包括User-Agent(用户代理)、Content-Type(内容类型)、Authorization(授权信息)等;响应头信息是指在HTTP响应中,用于提供关于响应的附加信息。常见的响应头信息包括Content-Type(内容类型)、Content-Length(内容长度)、Set-Cookie(设置Cookie)等。Among them, the cross-environment configuration information can be header information (Header), which is a mechanism for transmitting additional information in HTTP requests or responses. It consists of key-value pairs and is used to carry metadata in HTTP messages and describe the message. The properties, format and other relevant information of the document. The header information is located in the header part of the HTTP message, located after the request line or response line, and is expressed in the form of key-value pairs. In some embodiments, the above-mentioned header information may be request header information or response header information, etc. The request header information refers to the HTTP request and is used to provide additional information about the client or the request. Common request header information includes User-Agent (user agent), Content-Type (content type), Authorization (authorization information), etc.; response header information refers to the HTTP response and is used to provide additional information about the response. Common response header information includes Content-Type (content type), Content-Length (content length), Set-Cookie (set cookie), etc.
进一步地,在系统架构中,通过接口网关来对进入系统的请求进行路由和识别。接口网关作为系统的入口点,负责接收请求,并根据预先定义的规则将请求转发给相应的服务或后端系统。上述的跨环境配置信息是根据目标环境对应的令牌信息构建的,因此,目标环境的接口网关能够对上述的跨环境配置信息进行识别,从而调通目标环境的接口。Further, in the system architecture, requests entering the system are routed and identified through the interface gateway. As the entry point of the system, the interface gateway is responsible for receiving requests and forwarding the requests to the corresponding services or back-end systems according to predefined rules. The above-mentioned cross-environment configuration information is constructed based on the token information corresponding to the target environment. Therefore, the interface gateway of the target environment can identify the above-mentioned cross-environment configuration information, thereby adjusting the interface of the target environment.
步骤208,根据用例内容和跨环境配置信息生成跨环境用例,并将跨环境用例同步至目标环境,以在目标环境下执行跨环境用例。Step 208: Generate a cross-environment use case based on the use case content and cross-environment configuration information, and synchronize the cross-environment use case to the target environment to execute the cross-environment use case in the target environment.
上述的用例内容存在于当前的环境,而根据上述的跨环境配置信息生成的跨环境用例具备能够调通目标环境接口的特性,因此,根据上述用例内容和跨环境配置信息生成的跨环境用例,能够直接同步至目标环境,通过目标环境的接口,调用目标环境的数据,去执行包含当前环境下编写好用例内容的跨环境用例,从而完成跨环境执行用例的操作。The above use case content exists in the current environment, and the cross-environment use case generated based on the above-mentioned cross-environment configuration information has the characteristics of being able to adjust the target environment interface. Therefore, the cross-environment use case generated based on the above-mentioned use case content and cross-environment configuration information, It can directly synchronize to the target environment, call the data of the target environment through the interface of the target environment, and execute cross-environment use cases that contain the use case content written in the current environment, thereby completing the operation of cross-environment execution of use cases.
上述跨环境执行用例的方法中,能够通过目标环境的环境参数信息获取到对应的令牌信息,从而完成对跨环境配置信息的构建。当进行跨环境执行用例时,需要保证目标环境的接口网关能够识别执行用例的相关信息,此时,上述跨环境配置信息能够供目标环境的接口网关进行识别,从而调通接口,生成能够在目标环境下执行的跨环境用例,从而完成跨环境执行用例的过程。通过采用上述技术方案,在一个环境下编写完成的用例能够在多个不同的环境下执行,调用不同环境的接口来取用数据,简化了应用程序开发过程中的不同环境测试的过程,避免了不同环境下重复编写用例的情况发生,提高了应用程序的开发效率。进一步地,上述的跨环境配置信息能够在需要跨环境调用时进行实时构建,实时获取其所需的令牌信息,从而保证令牌信息的有效性,很大程度上减低了令牌信息的维护成本,并且避免了手动维护的令牌信息失效的情况发生,排除令牌信息失效问题的干扰,使得用例执行过程中的报错原因更加容易定位。另外,使用即时获取令牌信息的方式完成对跨环境配置信息的构建,避免了第三方的接入,还能够提高应用程序开发的安全性与稳定性。In the above method of executing use cases across environments, the corresponding token information can be obtained through the environment parameter information of the target environment, thereby completing the construction of cross-environment configuration information. When executing a use case across environments, it is necessary to ensure that the interface gateway of the target environment can identify the relevant information for executing the use case. At this time, the above cross-environment configuration information can be identified by the interface gateway of the target environment, so as to adjust the interface and generate the information that can be used in the target environment. Cross-environment use cases executed in the environment, thereby completing the process of cross-environment execution of use cases. By adopting the above technical solution, use cases written in one environment can be executed in multiple different environments, calling the interfaces of different environments to obtain data, simplifying the process of testing in different environments during the application development process, and avoiding the need for Repeated writing of use cases occurs in different environments, which improves application development efficiency. Furthermore, the above-mentioned cross-environment configuration information can be constructed in real time when cross-environment calls are needed, and the required token information can be obtained in real time, thus ensuring the validity of the token information and greatly reducing the maintenance of the token information. Cost, and avoids the occurrence of invalidation of manually maintained token information, eliminates the interference of token information invalidation, and makes it easier to locate the cause of errors during use case execution. In addition, using instant access to token information to complete the construction of cross-environment configuration information avoids third-party access and can also improve the security and stability of application development.
在一个实施例中,如图3所示,上述用例内容包括当前环境的环境参数信息,上述的步骤204根据目标环境的环境参数信息获取对应的令牌信息包括:In one embodiment, as shown in Figure 3, the above use case content includes the environment parameter information of the current environment. The above step 204 to obtain the corresponding token information according to the environment parameter information of the target environment includes:
步骤302,比较当前环境和目标环境对应的环境参数信息所指示的数值。Step 302: Compare the values indicated by the environment parameter information corresponding to the current environment and the target environment.
其中,不同环境对应的环境参数信息所指示的数值不同,在一些实施例中,不同的环境根据其在应用程序开发阶段的重要性程度依次排序,其对应的环境参数信息所指示的数值依次增大,也即重要性程度越高的环境,其对应的数值越大。Among them, the numerical values indicated by the environmental parameter information corresponding to different environments are different. In some embodiments, different environments are sorted according to their importance in the application development stage, and the numerical values indicated by the corresponding environmental parameter information increase sequentially. Large, that is, the higher the importance of the environment, the larger the corresponding value.
示例性地,在一个实施例中,上述的当前环境和目标环境分别为测试环境、预发布环境和生产环境中的任意一个。For example, in one embodiment, the above-mentioned current environment and target environment are any one of a test environment, a pre-release environment, and a production environment respectively.
其中,测试环境是用于进行软件测试的环境。它通常是在开发团队内部或专门的测试团队中设置的环境。测试环境的目的是模拟生产环境下的硬件、软件和网络环境,并提供与生产环境类似的条件,以便进行系统测试、集成测试、性能测试、回归测试等。测试环境可以用于发现和修复软件中的缺陷、验证功能是否符合需求、评估系统性能等。预发布环境是在软件发布前最后一次进行验证和测试的环境。它用于模拟最终生产环境,并进行最终的功能验证、性能测试、安全审计等,预发布环境的目的是确保软件在发布到生产环境之前是稳定、可靠且符合预期的。在预发布环境中,可以进行最后的调整和修复,并进行用户验收测试,以确保软件能够在生产环境中正常运行。生产环境是软件的实际运行环境,也称为线上环境或正式环境。它是面向最终用户的环境,用于提供实际的服务和功能。生产环境具备高可用性、高性能和安全性的要求,必须保证软件系统的稳定运行。在生产环境中,软件经过全面的测试、验证和部署,用于满足用户需求并支持业务运行。因此,在不同环境下执行用例的一个重要的本质区别是,在执行用例过程中使用的数据来源不同,例如,测试环境的数据可能为开发团队的编写或创造的,且往往提前知晓测试的预期结果,而生产环境的数据是直接面向用户的、真实的且实时变化的数据。Among them, the test environment is the environment used for software testing. It is typically an environment set up within a development team or within a dedicated testing team. The purpose of the test environment is to simulate the hardware, software and network environment in the production environment and provide conditions similar to the production environment for system testing, integration testing, performance testing, regression testing, etc. The testing environment can be used to discover and repair defects in software, verify whether functions meet requirements, evaluate system performance, etc. A pre-release environment is the environment where software is verified and tested for the last time before release. It is used to simulate the final production environment and conduct final functional verification, performance testing, security audits, etc. The purpose of the pre-release environment is to ensure that the software is stable, reliable and meets expectations before being released to the production environment. In a pre-release environment, final tweaks and fixes can be made, and user acceptance testing can be conducted to ensure that the software will function properly in a production environment. The production environment is the actual running environment of the software, also known as the online environment or formal environment. It is the end-user facing environment used to provide actual services and functionality. The production environment has high availability, high performance and security requirements, and the stable operation of the software system must be ensured. In a production environment, software is thoroughly tested, validated, and deployed to meet user needs and support business operations. Therefore, an important essential difference in executing use cases in different environments is that the data sources used in executing use cases are different. For example, the data in the test environment may be written or created by the development team, and the expectations of the test are often known in advance. As a result, the data in the production environment is data that is directly facing users, real and changing in real time.
因此,根据重要性程度进行排序,得出的测试环境的环境参数信息所指示的数值最小,生产环境的环境参数信息所指示的数值最大,而预发布环境所对应的数值大于测试环境对应的数值、小于生产环境对应的数值。Therefore, by sorting according to the degree of importance, the value indicated by the environment parameter information of the test environment is the smallest, the value indicated by the environment parameter information of the production environment is the largest, and the value corresponding to the pre-release environment is greater than the value corresponding to the test environment. , smaller than the value corresponding to the production environment.
若重要性程度较低环境下的用例在重要性较高环境下执行,例如在生产环境中执行了测试环境用例的用例内容,则可能产生以下问题:首先,测试环境的测试用例可能会对生产环境中的数据进行修改、删除或创建操作,导致生产环境数据的不一致或混乱,造成数据污染;其次,测试环境通常不具备与生产环境相同的安全措施和权限限制;再次,如果测试环境的用例可以访问生产环境的敏感数据,可能会引发安全风险,导致数据泄露或被恶意利用,存在安全隐患。If use cases in a lower importance environment are executed in a higher importance environment, for example, if the use case contents of the test environment use cases are executed in the production environment, the following problems may arise: First, the test cases in the test environment may have an impact on the production environment. Modification, deletion or creation of data in the environment will lead to inconsistency or confusion in the production environment data, causing data pollution; secondly, the test environment usually does not have the same security measures and permission restrictions as the production environment; thirdly, if the use cases of the test environment Access to sensitive data in the production environment may cause security risks, lead to data leakage or malicious use, and pose security risks.
因此,通过比较当前环境与测试环境对应的环境参数信息所指示的数值,即可获知当前环境与目标环境的重要性程度,避免重要性程度较小环境的用例对重要性程度较高环境的数据进行了调用。Therefore, by comparing the values indicated by the environment parameter information corresponding to the current environment and the test environment, the importance of the current environment and the target environment can be known, so as to avoid the use cases of the environment with a lower degree of importance over the data of the environment with a higher degree of importance. A call was made.
步骤304,在当前环境的环境参数信息所指示的数值大于或等于目标环境的环境参数信息所指示的数值的情况下,获取与目标环境相对应的令牌信息。Step 304: If the value indicated by the environment parameter information of the current environment is greater than or equal to the value indicated by the environment parameter information of the target environment, obtain token information corresponding to the target environment.
示例性地,根据前述对不同环境的重要性判断,当前环境为预发布环境,目标环境为测试环境,由于预发布环境的环境参数信息所指示的数值大于测试环境的环境参数信息所指示的数值,因此,判定此种情况下跨环境执行用例不会带来上述问题,可以继续获取与目标环境相对应的令牌信息,并继续执行后续步骤。For example, based on the aforementioned judgment of the importance of different environments, the current environment is a pre-release environment and the target environment is a test environment, because the value indicated by the environment parameter information of the pre-release environment is greater than the value indicated by the environment parameter information of the test environment. , Therefore, it is determined that cross-environment execution of the use case in this case will not cause the above problems, and you can continue to obtain the token information corresponding to the target environment and continue to perform subsequent steps.
而若当前环境为测试环境,目标环境为生产环境,则判断会存在上述的问题,此时可以禁止继续获取与目标环境相对应的令牌信息,并进行报错处理。If the current environment is a test environment and the target environment is a production environment, it is judged that the above problems will exist. At this time, you can prohibit further acquisition of token information corresponding to the target environment and perform error processing.
上述方案通过禁止测试环境调用生产环境的数据,可以确保测试过程中的操作不会影响到生产环境的数据完整性和一致性,保持数据的隔离性,还可以降低安全风险,测试环境不能访问生产环境中的敏感数据,能够避免泄露敏感信息和遭受潜在的安全攻击,确保生产环境的稳定性和数据的可靠性。By prohibiting the test environment from calling data from the production environment, the above solution can ensure that operations during the test process will not affect the data integrity and consistency of the production environment, maintain data isolation, and reduce security risks. The test environment cannot access the production environment. Sensitive data in the environment can avoid leaking sensitive information and suffering potential security attacks, ensuring the stability of the production environment and the reliability of data.
可选地,在一个实施例中,如图4所示,上述步骤304可以包括:Optionally, in one embodiment, as shown in Figure 4, the above step 304 may include:
步骤402,在当前环境的环境参数信息所指示的数值等于目标环境的环境参数信息所指示的数值的情况下,直接以第一调用方式获取与目标环境相对应的令牌信息。Step 402: If the value indicated by the environment parameter information of the current environment is equal to the value indicated by the environment parameter information of the target environment, directly obtain the token information corresponding to the target environment in the first calling method.
其中,由于当前环境的环境参数信息所指示的数值等于目标环境的环境参数信息所指示的数值,当前环境与目标环境为同一环境,此时可以直接获取到对应的令牌信息。示例性地,上述的第一调用方式可以为泛化调用。Among them, since the value indicated by the environment parameter information of the current environment is equal to the value indicated by the environment parameter information of the target environment, the current environment and the target environment are the same environment, and the corresponding token information can be directly obtained at this time. For example, the above-mentioned first calling method may be a generalized calling.
可选地,泛化调用是指在编程中使用泛型来实现一种通用的调用方式,使得代码可以在不同的类型上进行重用和泛化。泛化调用的目的是提高代码的可重用性和灵活性。在传统的编程语言中,函数或方法通常是针对特定的数据类型进行定义和实现的。例如,一个函数可能会接受整数作为参数,并返回整数类型的结果。这种情况下,如果想在不同的数据类型上使用相同的函数,需要为每种数据类型单独定义一个函数。这样会导致代码的冗余和可维护性的下降。而使用泛化调用可以解决这个问题。泛化调用通过使用泛型来定义函数或方法,使其可以适用于不同的数据类型。泛型是一种抽象的数据类型,可以在编程时指定具体的类型。通过在函数或方法的定义中使用泛型参数,可以将具体的数据类型推迟到调用该函数或方法的时候再确定。Optionally, generalized calling refers to using generics in programming to implement a common calling method, so that the code can be reused and generalized on different types. The purpose of generalized calling is to improve code reusability and flexibility. In traditional programming languages, functions or methods are usually defined and implemented for specific data types. For example, a function might accept integers as parameters and return a result of type integer. In this case, if you want to use the same function on different data types, you need to define a separate function for each data type. This will lead to code redundancy and reduced maintainability. Using generalized calls can solve this problem. Generalized calls define functions or methods using generics so that they can be applied to different data types. Generics are an abstract data type that can specify specific types during programming. By using generic parameters in the definition of a function or method, you can defer determining the specific data type until the time the function or method is called.
因此,使用泛化调用可以带来以下好处:能够使得代码可以在不同的数据类型上进行复用,减少了代码的重复编写,提高了代码的可维护性;可以更加灵活地适应不同的数据类型和需求,使代码更具通用性;编译器可以进行类型检查,确保在调用时使用的具体类型与泛型参数相符,从而提高代码的类型安全性。综上所述,采用泛化调用的方式获取令牌信息,无需关心接口的版本升级,具有更高的调用效率和稳定性。Therefore, using generalized calls can bring the following benefits: it can make the code reusable on different data types, reduce the duplication of code, and improve the maintainability of the code; it can be more flexibly adapted to different data types. and requirements, making the code more versatile; the compiler can perform type checking to ensure that the specific type used during the call matches the generic parameter, thus improving the type safety of the code. To sum up, by using generalized calling to obtain token information, there is no need to worry about the version upgrade of the interface, and it has higher calling efficiency and stability.
进一步地,上述的泛化调用方式可以为Dubbo调用。可选地,Dubbo调用是指在Dubbo框架中使用接口进行远程调用的方式,要求服务提供者和服务消费者之间共享相同的接口定义。这种调用方式是基于接口进行静态类型检查和编译的,具有较高的性能和效率。Furthermore, the above generalized calling method can be called by Dubbo. Optionally, Dubbo calling refers to the method of using interfaces to make remote calls in the Dubbo framework, which requires the service provider and service consumer to share the same interface definition. This calling method is based on static type checking and compilation of interfaces, and has high performance and efficiency.
步骤404,在当前环境的环境参数信息所指示的数值大于目标环境的环境参数信息所指示的数值的情况下,获取目标环境的接口网关代理地址,并根据接口网关代理地址,以第一调用方式获取与目标环境相对应的令牌信息。Step 404: When the value indicated by the environment parameter information of the current environment is greater than the value indicated by the environment parameter information of the target environment, obtain the interface gateway proxy address of the target environment, and use the first calling method according to the interface gateway proxy address. Get the token information corresponding to the target environment.
可选地,目标环境的接口网关代理地址是指使用此方法的平台自身服务的网关代理地址,例如,本实施例中使用此方法的平台为接口自动化平台,那么上述目标环境的接口网关代理地址是指接口自动化平台的本身服务的接口网关代理地址。因此,在本实施例中,并不是直接调用获取令牌信息接口的网关地址,从而避免调用量太大造成的网关压力大的问题。Optionally, the interface gateway proxy address of the target environment refers to the gateway proxy address of the platform itself using this method. For example, in this embodiment, the platform using this method is an interface automation platform, then the interface gateway proxy address of the target environment is It refers to the interface gateway proxy address of the interface automation platform's own service. Therefore, in this embodiment, the gateway address of the interface for obtaining token information is not directly called, thereby avoiding the problem of heavy pressure on the gateway caused by too large a call volume.
其中,当前环境的环境参数信息所指示的数值大于目标环境的环境参数信息所指示的数值,此时的当前环境与目标环境不同,且不会出现上述跨环境执行用例的问题。跨环境调用首先需要获取目标环境的接口网关地址。示例性地,可以使用HttpClient获取目标环境的接口网关地址。示例性地,获取过程通常包括:初始化HttpClient、构建请求对象、发送预请求、解析预请求的响应、更新请求对象的URL,并最终发送实际请求等。具体实现的步骤取决于所使用的HttpClient库和框架。在实际的开发中,需要根据HttpClient的文档和示例,以获得更详细的指导和具体实现方式,按照库的要求进行相应的配置和操作。Among them, the value indicated by the environment parameter information of the current environment is greater than the value indicated by the environment parameter information of the target environment. At this time, the current environment is different from the target environment, and the above-mentioned cross-environment execution use case problem does not occur. Cross-environment calls first need to obtain the interface gateway address of the target environment. For example, HttpClient can be used to obtain the interface gateway address of the target environment. For example, the acquisition process usually includes: initializing HttpClient, building a request object, sending a pre-request, parsing the response of the pre-request, updating the URL of the request object, and finally sending the actual request, etc. The specific implementation steps depend on the HttpClient library and framework used. In actual development, you need to obtain more detailed guidance and specific implementation methods according to the documentation and examples of HttpClient, and perform corresponding configuration and operations according to the requirements of the library.
进一步地,第一调用方式可以为泛化调用,以上述步骤402中的解释相同,此处不再赘述。另外,在一些实施例中,还可以采用第二调用方式获取令牌信息,示例性地,第二调用方式可以为动态代理调用、RESTful调用以及gRPC调用等。Further, the first calling method may be a generalized calling, which is the same as the explanation in step 402 above, and will not be described again here. In addition, in some embodiments, a second calling method can also be used to obtain the token information. For example, the second calling method can be a dynamic proxy call, a RESTful call, a gRPC call, etc.
在一个实施例中,如图5所示,步骤206,根据所述令牌信息构建跨环境配置信息包括:In one embodiment, as shown in Figure 5, step 206, building cross-environment configuration information based on the token information includes:
步骤502,获取用例内容的头信息。Step 502: Obtain the header information of the use case content.
其中,头信息是在HTTP请求或响应中传递附加信息的一种机制,由键值对组成,用于在HTTP报文中携带元数据,描述了报文的属性、格式和其他相关信息。头信息位于HTTP报文的首部部分,位于请求行或响应行之后,以键值对的形式表示。示例性地,上述的头信息可以为请求头信息,请求头信息是指在HTTP请求中,用于提供有关客户端或请求的附加信息。Among them, header information is a mechanism for transmitting additional information in HTTP requests or responses. It consists of key-value pairs and is used to carry metadata in HTTP messages. It describes the attributes, format and other related information of the message. The header information is located in the header part of the HTTP message, located after the request line or response line, and is expressed in the form of key-value pairs. For example, the above-mentioned header information may be request header information, which is used to provide additional information about the client or the request in an HTTP request.
步骤504,将令牌信息拼接到头信息中,以构建跨环境配置信息。Step 504: Splice the token information into the header information to construct cross-environment configuration information.
可选地,将令牌信息拼接到头信息中,即可用于访问目标环境是的身份验证。Optionally, splice the token information into the header information, which can be used for authentication to access the target environment.
在一个实施例中,步骤202,根据目标环境的环境参数信息获取对应的令牌信息之前还包括:In one embodiment, step 202, before obtaining the corresponding token information according to the environment parameter information of the target environment, also includes:
首先,执行用例内容,以获得结果日志。First, execute the use case content to obtain the result log.
该步骤执行用例内容时尚未开始执行跨环境的动作,在当前环境下执行用例内容,能够先对当前的用例进行测试和验证。When this step executes the use case content, cross-environment actions have not yet started. When executing the use case content in the current environment, the current use case can be tested and verified first.
其中,结果日志是指在软件开发或系统运行过程中记录和存储操作结果的日志信息。它记录了程序执行的结果、状态和相关信息,以便后续分析、故障排查或性能优化等目的。结果日志通常包含操作结果、操作相关信息、状态变更情况、异常信息、性能指标等信息。Among them, the result log refers to the log information that records and stores the operation results during the software development or system operation process. It records the results, status and related information of program execution for subsequent analysis, troubleshooting or performance optimization purposes. Result logs usually include operation results, operation-related information, status changes, exception information, performance indicators and other information.
示例性地,上述用例内容可以包括一个或多个用例步骤,在执行用例时,先获取用例步骤的相关信息,把每个步骤提取出来的参数和全局参数放置在用例上下文中,从而确保执行用例时每个步骤都能引用到提取的参数,再将步骤节点的身份信息存储在堆栈中,方便每个步骤执行完,取出下面的步骤,每个步骤在执行时通过容器初始化加载的步骤类型分配到对应的执行器,例如http接口的执行器,断言的执行器,参数提取的执行器等,执行步骤的执行器类型信息需要由调度器分配到对应的执行器(例如上述的http接口的执行器,断言的执行器,参数提取的执行器),当执行完一个步骤节点时,将栈的下一个节点更改为当前节点,下一个节点更改为下下个节点,类似更改链表指针地址一样以便于流转步骤即可。For example, the above use case content may include one or more use case steps. When executing the use case, the relevant information of the use case steps is first obtained, and the parameters and global parameters extracted from each step are placed in the use case context to ensure that the use case is executed. Each step can reference the extracted parameters, and then store the identity information of the step node in the stack, so that after each step is executed, the following steps are taken out, and each step is allocated through the step type loaded by the container initialization during execution. To the corresponding executor, such as the executor of the http interface, the executor of assertion, the executor of parameter extraction, etc., the executor type information of the execution step needs to be assigned by the scheduler to the corresponding executor (such as the execution of the above http interface executor, assertion executor, parameter extraction executor), when a step node is executed, the next node of the stack is changed to the current node, and the next node is changed to the next node, similar to changing the linked list pointer address so that Just follow the transfer step.
其次,验证结果日志是否符合预设标准。Second, verify that the resulting logs meet preset criteria.
对上述结果日志进行验证,能够反映出当前环境下的用例编写是否准确等问题,对后续的跨环境执行用例的安全性和准确性提供保障。Verification of the above result logs can reflect issues such as whether the use cases written in the current environment are accurate and ensure the security and accuracy of subsequent cross-environment execution of use cases.
最后,在结果日志符合预设标准的情况下,执行根据目标环境的环境参数信息获取对应的令牌信息的步骤。Finally, when the result log meets the preset standards, the step of obtaining the corresponding token information based on the environment parameter information of the target environment is performed.
本实施例中,通过对当前环境下的用例进行执行测试,对其结果日志进行验证,能够能够反映出当前环境下的用例编写是否准确等问题,对后续的跨环境执行用例的安全性和准确性提供保障。In this embodiment, by executing the test on the use cases in the current environment and verifying the result logs, it can reflect issues such as whether the use cases in the current environment are written accurately and ensure the safety and accuracy of subsequent cross-environment execution of use cases. Sex provides protection.
在一个实施例中,如图6和图7所示,将上述步骤的执行主体分为用例服务器602、用例执行器604、步骤调度器606、http步骤执行器608、登录认证处理器610和Dubbo服务处理器612。并且上述执行主体分布在数据层702、业务层704、展示层706和操作层708中。In one embodiment, as shown in Figures 6 and 7, the execution subjects of the above steps are divided into use case server 602, use case executor 604, step scheduler 606, http step executor 608, login authentication processor 610 and Dubbo Service processor 612. And the above execution subjects are distributed in the data layer 702, business layer 704, presentation layer 706 and operation layer 708.
其中业务层704包括数据驱动子层级7041、场景用例子层级7042、测试计划子层级7043、测试结果子层级7044和日志记录子层级7045。其中,在数据驱动子层级7041中完成数据设计和测试场景设计的初始化操作,并且接收各阶段输入的参数;在场景用例子层级7042中完成用例和场景的创建、接口的导入和调用、执行状态的设定(包括定时执行、手动执行)等操作,从而执行用例;在测试计划子层级7043完成测试计划的创建,将不同的场景相互关联,配置接口调用方式和定时任务状态,从而执行测试计划;在测试结果子层级7044中将测试计划的执行结果的展示出来,并向终端发送对应的通知;在日志记录子层级7045中完成对上述过程的操作记录。以下为各层级具体的执行过程:The business layer 704 includes a data driver sub-level 7041, a scenario use sub-level 7042, a test plan sub-level 7043, a test result sub-level 7044 and a logging sub-level 7045. Among them, the initialization operations of data design and test scenario design are completed in the data-driven sub-level 7041, and parameters input at each stage are received; the creation of use cases and scenarios, the import and call of interfaces, and execution status are completed in the scenario use sub-level 7042. settings (including scheduled execution, manual execution) and other operations to execute the use case; complete the creation of the test plan at the test plan sub-level 7043, associate different scenarios with each other, configure the interface calling method and scheduled task status, and execute the test plan ; In the test result sub-level 7044, the execution results of the test plan are displayed and corresponding notifications are sent to the terminal; in the logging sub-level 7045, the operation record of the above process is completed. The following is the specific execution process at each level:
在业务层704中创建用例后,用例服务器602在数据层702中执行对数据的缓存、存储、调用自定义函数以及数据库的读写指令,将其中用例内容中的信息持久化到数据库中,其中,用例内容包括对应用程序、终端与服务器接口等进行测试的具体步骤、输入数据、预期结果和验证点等信息。After the use case is created in the business layer 704, the use case server 602 executes data caching, storage, calling custom functions and database read and write instructions in the data layer 702, and persists the information in the use case content to the database, where , The use case content includes specific steps, input data, expected results, verification points and other information for testing the application, terminal and server interfaces.
其中,用例的创建以及执行过程如下:Among them, the creation and execution process of use cases are as follows:
用例服务器602在业务层704的数据驱动子层级7041中获取全局参数、用例步骤参数等数据,并根据获取到的数据完成前置数据的设计,从而完成测试场景的设计;用例执行器604在场景用例子层级7042中创建当前环境下的用例,并执行用例。The use case server 602 obtains data such as global parameters and use case step parameters in the data-driven sub-level 7041 of the business layer 704, and completes the design of pre-data based on the obtained data, thereby completing the design of the test scenario; the use case executor 604 operates in the scenario Create a use case in the current environment in use case level 7042 and execute the use case.
其中,被执行的用例内容可以包括一个或多个用例步骤,在执行用例时,先获取用例步骤的相关信息,把每个步骤提取出来的参数和全局参数放置在用例上下文中,从而确保执行用例时每个步骤都能引用到提取的参数,再将步骤节点的身份信息存储在堆栈中,方便每个步骤执行完毕后取出下面的步骤。每个步骤在执行时由步骤调度器606通过容器初始化加载的步骤类型分配到对应的执行器,例如http接口的执行器,断言的执行器,参数提取的执行器等。执行步骤的执行器类型信息需要由调度器分配到对应的执行器,当执行完一个步骤节点时,将栈的下一个节点更改为当前节点,下一个节点更改为下下个节点,类似更改链表指针地址,以便于流转步骤。Among them, the executed use case content can include one or more use case steps. When executing the use case, the relevant information of the use case steps is first obtained, and the parameters and global parameters extracted from each step are placed in the use case context to ensure that the use case is executed. At this time, each step can reference the extracted parameters, and then store the identity information of the step node in the stack, so that the following steps can be taken out after each step is completed. When each step is executed, the step type loaded by the step scheduler 606 through container initialization is assigned to the corresponding executor, such as the executor of the http interface, the executor of assertions, the executor of parameter extraction, etc. The executor type information of the execution step needs to be allocated to the corresponding executor by the scheduler. When a step node is executed, the next node of the stack is changed to the current node, and the next node is changed to the next node, similar to changing a linked list. Pointer address to facilitate flow steps.
随后,在测试技术子层级中将多个用例相互关联,形成并执行完整的测试计划;在测试结果子层级7044中生成当前环境下的结果日志,并验证结果日志是否符合预设标准,对上述结果日志进行验证,能够反映出当前环境下的用例编写是否准确等问题,对后续的跨环境执行用例的安全性和准确性提供保障。Subsequently, multiple use cases are related to each other in the test technology sub-level to form and execute a complete test plan; in the test result sub-level 7044, the result log in the current environment is generated and verified whether the result log meets the preset standards. For the above Verification of the result log can reflect issues such as whether the use case writing in the current environment is accurate, and provide guarantees for the security and accuracy of subsequent cross-environment execution of use cases.
接下来,在结果日志符合预设标准的情况下,用例服务器602在业务层704的数据驱动子层级7041获取目标环境的环境参数信息,通过该环境参数信息定义到唯一一个确定的环境,从而确定本次跨环境执行用例的目标环境,当需要跨环境执行用例时,同时获取上述目标环境的环境参数,由登录认证处理器610比较当前环境和目标环境对应的环境参数信息所指示的数值,而若当前环境为测试环境,目标环境为生产环境,此时禁止继续获取与目标环境相对应的令牌信息,并进行报错处理;若当前环境为预发布环境,目标环境为测试环境,则由Dubbo服务处理器612获取测试环境的接口网关代理地址,并根据接口网关代理地址,以Dubbo调用的方式获取与测试环境相对应的令牌信息。Next, when the result log meets the preset standards, the use case server 602 obtains the environment parameter information of the target environment at the data-driven sub-level 7041 of the business layer 704, and defines the only determined environment through the environment parameter information, thereby determining The target environment of this cross-environment execution use case. When the use case needs to be executed across environments, the environment parameters of the above-mentioned target environment are obtained at the same time. The login authentication processor 610 compares the values indicated by the environment parameter information corresponding to the current environment and the target environment, and If the current environment is a test environment and the target environment is a production environment, it is prohibited to continue to obtain the token information corresponding to the target environment and perform error processing; if the current environment is a pre-release environment and the target environment is a test environment, Dubbo The service processor 612 obtains the interface gateway proxy address of the test environment, and obtains token information corresponding to the test environment by calling Dubbo based on the interface gateway proxy address.
随后,http步骤执行器608在业务层704的场景用例子层级7042中,获取上述经过验证的用例的头信息,并将上述的令牌信息拼接到头信息中,以构建能够被目标环境接口识别的跨环境配置信息,再根据上述用例的用例内容和拼接获得的跨环境配置信息生成跨环境用例。可选地,在一些实施例中,在http步骤执行器608中可以选择在头信息中拼接通过上述过程获取的令牌信息,从而构建跨环境配置信息,也可以选择通过其他方式获取令牌信息,来构建新的头信息。Subsequently, the http step executor 608 obtains the header information of the above-mentioned verified use case in the scenario use sub-level 7042 of the business layer 704, and splices the above-mentioned token information into the header information to construct a program that can be recognized by the target environment interface. Cross-environment configuration information, and then generate a cross-environment use case based on the use case content of the above use case and the cross-environment configuration information obtained by splicing. Optionally, in some embodiments, in the http step executor 608, you can choose to splice the token information obtained through the above process into the header information to construct cross-environment configuration information, or you can choose to obtain the token information through other methods. , to construct new header information.
当需要跨环境执行用例时,只需要将认证方式中的账号改为目标环境下的账号。在业务层704的场景用例子层级7042中,即可通过上述跨环境配置信息调用目标环境的接口,从而将跨环境用例同步至目标环境,进而参照上述执行当前环境用例的过程,在目标环境下执行该跨环境用例、将多个用例组成用例集,引用用例集形成测试计划,并执行测试计划。When you need to execute a use case across environments, you only need to change the account in the authentication method to the account in the target environment. In the scenario use case level 7042 of the business layer 704, the interface of the target environment can be called through the above cross-environment configuration information, thereby synchronizing the cross-environment use case to the target environment, and then referring to the above-mentioned process of executing the current environment use case, in the target environment Execute the cross-environment use case, combine multiple use cases into a use case set, refer to the use case set to form a test plan, and execute the test plan.
最后,在展示层706中将测试技术的执行结果输出成为报表。操作层708提供了一个可扩展的平台,用于构建、测试和部署软件项目,上述的过程均部署在操作层708的集成工具上,示例性的,集成工具可以为jenkins,用于配置定时任务,执行接口调度等。Finally, in the presentation layer 706, the execution results of the test technology are output as a report. The operation layer 708 provides an extensible platform for building, testing, and deploying software projects. The above processes are all deployed on the integration tool of the operation layer 708. For example, the integration tool can be Jenkins, which is used to configure scheduled tasks. , perform interface scheduling, etc.
另外,上述的各步骤执行主体均经过负载均衡处理,并从内部集群出发,通过与外部的功能服务集群进行数据调用完成所需的各个功能服务,例如:接口服务、通用服务、场景服务、目录服务、跟踪日志服务、变更记录服务、测试计划服务、参数池服务;并通过微服务集群与注册中心和外部的业务服务集群进行数据调用,完成所需的各个业务服务,例如:压力平台商务服务、授权数据屏蔽查询服务、通用订购服务、一般讯息发送服务、即时订购服务、公共时间轴服务。In addition, the execution subjects of each of the above steps have been processed by load balancing, and starting from the internal cluster, they complete the required functional services through data calls with the external functional service cluster, such as: interface services, general services, scene services, directories services, tracking log services, change record services, test plan services, and parameter pool services; and perform data calls through microservice clusters, registration centers, and external business service clusters to complete various required business services, such as: pressure platform business services , authorized data shielding query service, general ordering service, general message sending service, real-time ordering service, and public timeline service.
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts involved in the above-mentioned embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above embodiments may include multiple steps or stages. These steps or stages are not necessarily executed at the same time, but may be completed at different times. The execution order of these steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的跨环境执行用例的方法的跨环境执行用例的装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个跨环境执行用例的装置实施例中的具体限定可以参见上文中对于跨环境执行用例的方法的限定,在此不再赘述。Based on the same inventive concept, embodiments of the present application also provide a device for cross-environment execution of use cases for implementing the above-mentioned method of cross-environment execution of use cases. The problem-solving solution provided by this device is similar to the solution recorded in the above method. Therefore, for the specific limitations in the device embodiments of one or more cross-environment execution use cases provided below, please refer to the cross-environment execution above. The limitations of the use case method will not be repeated here.
在一个实施例中,如图8所示,提供了一种跨环境执行用例的装置,包括:用例获取模块、令牌生成模块、环境配置模块和用例同步模块,其中:In one embodiment, as shown in Figure 8, a device for executing use cases across environments is provided, including: a use case acquisition module, a token generation module, an environment configuration module and a use case synchronization module, wherein:
用例获取模块802,用于在当前环境下,获取用例内容和目标环境的环境参数信息;The use case acquisition module 802 is used to obtain the use case content and the environment parameter information of the target environment in the current environment;
令牌生成模块804,用于根据目标环境的环境参数信息获取对应的令牌信息;The token generation module 804 is used to obtain corresponding token information according to the environmental parameter information of the target environment;
环境配置模块806,用于根据令牌信息构建跨环境配置信息,其中,跨环境配置信息用于供目标环境的接口网关识别;The environment configuration module 806 is used to construct cross-environment configuration information based on the token information, where the cross-environment configuration information is used for identification by the interface gateway of the target environment;
用例同步模块808,用于根据用例内容和跨环境配置信息生成跨环境用例,并将跨环境用例同步至目标环境,以在目标环境下执行跨环境用例。The use case synchronization module 808 is used to generate cross-environment use cases based on the use case content and cross-environment configuration information, and synchronize the cross-environment use cases to the target environment to execute the cross-environment use cases in the target environment.
在一个实施例中,用例内容包括当前环境的环境参数信息,不同环境对应的环境参数信息所指示的数值不同,并且上述的令牌生成模块包括参数比较子模块和认证执行子模块,其中:In one embodiment, the use case content includes the environment parameter information of the current environment. The environment parameter information corresponding to different environments indicates different values, and the above-mentioned token generation module includes a parameter comparison sub-module and an authentication execution sub-module, where:
参数比较子模块,用于比较当前环境和目标环境对应的环境参数信息所指示的数值;The parameter comparison submodule is used to compare the values indicated by the environment parameter information corresponding to the current environment and the target environment;
认证执行子模块,用于在当前环境的环境参数信息所指示的数值大于或等于目标环境的环境参数信息所指示的数值的情况下,获取与目标环境相对应的令牌信息。The authentication execution submodule is used to obtain token information corresponding to the target environment when the value indicated by the environment parameter information of the current environment is greater than or equal to the value indicated by the environment parameter information of the target environment.
在一个实施例中,上述认证执行子模块包括直接调用单元和间接调用单元,其中:In one embodiment, the above authentication execution sub-module includes a direct calling unit and an indirect calling unit, where:
直接调用单元,用于在当前环境的环境参数信息所指示的数值等于目标环境的环境参数信息所指示的数值的情况下,直接以第一调用方式获取与目标环境相对应的令牌信息;A direct calling unit, configured to directly obtain the token information corresponding to the target environment in the first calling method when the value indicated by the environment parameter information of the current environment is equal to the value indicated by the environment parameter information of the target environment;
间接调用单元,用于在当前环境的环境参数信息所指示的数值大于目标环境的环境参数信息所指示的数值的情况下,获取目标环境的接口网关代理地址,并根据接口网关代理地址,以第一调用方式获取与目标环境相对应的令牌信息。The indirect calling unit is used to obtain the interface gateway proxy address of the target environment when the value indicated by the environment parameter information of the current environment is greater than the value indicated by the environment parameter information of the target environment, and based on the interface gateway proxy address, the third One call method to obtain the token information corresponding to the target environment.
在一个实施例中,上述的第一调用方式是泛化调用。In one embodiment, the above-mentioned first calling method is a generalized calling.
在一个实施例中,上述的环境配置模块包括初始模块和配置模块,其中:In one embodiment, the above-mentioned environment configuration module includes an initial module and a configuration module, where:
初始模块,用于获取用例内容的头信息;Initial module, used to obtain the header information of the use case content;
配置模块,用于将令牌信息拼接到头信息中,以构建跨环境配置信息。The configuration module is used to splice token information into header information to build cross-environment configuration information.
在一个实施例中,上述跨环境执行用例的装置还包括:In one embodiment, the above-mentioned device for executing use cases across environments further includes:
测试模块,用于执行用例内容,以获得结果日志;Test module, used to execute the use case content to obtain result logs;
验证模块,用于验证结果日志是否符合预设标准;Verification module, used to verify whether the result log meets the preset standards;
执行模块,用于在结果日志符合预设标准的情况下,执行根据目标环境的环境参数信息获取对应的令牌信息。The execution module is used to obtain the corresponding token information based on the environment parameter information of the target environment when the result log meets the preset standards.
上述跨环境执行用例的装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned device for executing use cases across environments can be implemented in whole or in part by software, hardware, and combinations thereof. Each of the above modules may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图9所示。该计算机设备包括处理器、存储器、输入/输出接口(Input/Output,简称I/O)和通信接口。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储用例相关数据。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种跨环境执行用例的方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in Figure 9. The computer device includes a processor, a memory, an input/output interface (Input/Output, referred to as I/O), and a communication interface. Among them, the processor, memory and input/output interface are connected through the system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage medium stores operating systems, computer programs and databases. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media. The computer device's database is used to store use case related data. The input/output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement a method of executing use cases across environments.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图10所示。该计算机设备包括处理器、存储器、输入/输出接口、通信接口、显示单元和输入装置。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口、显示单元和输入装置通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种跨环境执行用例的方法。In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. 10 . The computer device includes a processor, memory, input/output interface, communication interface, display unit and input device. Among them, the processor, memory and input/output interface are connected through the system bus, and the communication interface, display unit and input device are connected to the system bus through the input/output interface. Wherein, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage medium stores operating systems and computer programs. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used for wired or wireless communication with external terminals. The wireless mode can be implemented through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer program is executed by the processor to implement a method of executing use cases across environments.
本领域技术人员可以理解,图10中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 10 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Specific computer equipment can May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:在当前环境下,获取用例内容和目标环境的环境参数信息;根据目标环境的环境参数信息获取对应的令牌信息;根据令牌信息构建跨环境配置信息,其中,跨环境配置信息用于供目标环境的接口网关识别;根据用例内容和跨环境配置信息生成跨环境用例,并将跨环境用例同步至目标环境,以在目标环境下执行跨环境用例。In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, it implements the following steps: in the current environment, obtain the use case content and the environment of the target environment. Parameter information; obtain the corresponding token information based on the environment parameter information of the target environment; construct cross-environment configuration information based on the token information, where the cross-environment configuration information is used for identification by the interface gateway of the target environment; based on the use case content and cross-environment configuration The information generates cross-environment use cases and synchronizes the cross-environment use cases to the target environment to execute the cross-environment use cases in the target environment.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:比较当前环境和目标环境对应的环境参数信息所指示的数值;在当前环境的环境参数信息所指示的数值大于或等于目标环境的环境参数信息所指示的数值的情况下,获取与目标环境相对应的令牌信息。In one embodiment, the processor also implements the following steps when executing the computer program: comparing the values indicated by the environment parameter information corresponding to the current environment and the target environment; when the value indicated by the environment parameter information of the current environment is greater than or equal to that of the target environment If the value indicated by the environment parameter information is obtained, the token information corresponding to the target environment is obtained.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:在当前环境的环境参数信息所指示的数值等于目标环境的环境参数信息所指示的数值的情况下,直接以第一调用方式获取与目标环境相对应的令牌信息;在当前环境的环境参数信息所指示的数值大于目标环境的环境参数信息所指示的数值的情况下,获取目标环境的接口网关代理地址,并根据接口网关代理地址,以第一调用方式获取与目标环境相对应的令牌信息。In one embodiment, when the processor executes the computer program, the processor also implements the following steps: when the value indicated by the environment parameter information of the current environment is equal to the value indicated by the environment parameter information of the target environment, obtain directly by the first calling method Token information corresponding to the target environment; when the value indicated by the environment parameter information of the current environment is greater than the value indicated by the environment parameter information of the target environment, the interface gateway proxy address of the target environment is obtained, and the interface gateway proxy address is obtained according to the interface gateway proxy Address, use the first calling method to obtain the token information corresponding to the target environment.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:获取用例内容的头信息;将令牌信息拼接到头信息中,以构建跨环境配置信息。In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the header information of the use case content; and splicing the token information into the header information to construct cross-environment configuration information.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:执行用例内容,以获得结果日志;验证结果日志是否符合预设标准;在结果日志符合预设标准的情况下,执行根据目标环境的环境参数信息获取对应的令牌信息的步骤。In one embodiment, when the processor executes the computer program, it also implements the following steps: execute the use case content to obtain a result log; verify whether the result log meets the preset standards; when the result log meets the preset standards, execute the test according to the target environment Steps to obtain the corresponding token information based on the environment parameter information.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:在当前环境下,获取用例内容和目标环境的环境参数信息;根据目标环境的环境参数信息获取对应的令牌信息;根据令牌信息构建跨环境配置信息,其中,跨环境配置信息用于供目标环境的接口网关识别;根据用例内容和跨环境配置信息生成跨环境用例,并将跨环境用例同步至目标环境,以在目标环境下执行跨环境用例。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: in the current environment, obtain the use case content and the environment parameter information of the target environment; Obtain the corresponding token information based on the environment parameter information of the target environment; construct cross-environment configuration information based on the token information, where the cross-environment configuration information is used for identification by the interface gateway of the target environment; generate cross-environment configuration information based on the use case content and cross-environment configuration information. environment use cases, and synchronize the cross-environment use cases to the target environment to execute the cross-environment use cases in the target environment.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:比较当前环境和目标环境对应的环境参数信息所指示的数值;在当前环境的环境参数信息所指示的数值大于或等于目标环境的环境参数信息所指示的数值的情况下,获取与目标环境相对应的令牌信息。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: comparing the values indicated by the environment parameter information corresponding to the current environment and the target environment; when the value indicated by the environment parameter information of the current environment is greater than or equal to the target environment If the value indicated by the environment parameter information is obtained, the token information corresponding to the target environment is obtained.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:在当前环境的环境参数信息所指示的数值等于目标环境的环境参数信息所指示的数值的情况下,直接以第一调用方式获取与目标环境相对应的令牌信息;在当前环境的环境参数信息所指示的数值大于目标环境的环境参数信息所指示的数值的情况下,获取目标环境的接口网关代理地址,并根据接口网关代理地址,以第一调用方式获取与目标环境相对应的令牌信息。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the value indicated by the environment parameter information of the current environment is equal to the value indicated by the environment parameter information of the target environment, directly using the first calling method Obtain the token information corresponding to the target environment; when the value indicated by the environment parameter information of the current environment is greater than the value indicated by the environment parameter information of the target environment, obtain the interface gateway proxy address of the target environment, and based on the interface gateway The proxy address is used to obtain the token information corresponding to the target environment in the first calling method.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:获取用例内容的头信息;将令牌信息拼接到头信息中,以构建跨环境配置信息。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining header information of the use case content; and splicing token information into the header information to construct cross-environment configuration information.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:执行用例内容,以获得结果日志;验证结果日志是否符合预设标准;在结果日志符合预设标准的情况下,执行根据目标环境的环境参数信息获取对应的令牌信息的步骤。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: execute the use case content to obtain a result log; verify whether the result log meets the preset standards; when the result log meets the preset standards, execute the Steps to obtain the corresponding token information from the environment parameter information.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage. In the medium, when the computer program is executed, it may include the processes of the embodiments of the above methods. Any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random) Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene memory, etc. Volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM). The databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include blockchain-based distributed databases, etc., but are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, all possible combinations should be used. It is considered to be within the scope of this manual.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-described embodiments only express several implementation modes of the present application, and their descriptions are relatively specific and detailed, but should not be construed as limiting the patent scope of the present application. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all fall within the protection scope of the present application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310870433.1A CN116991713B (en) | 2023-07-17 | 2023-07-17 | Method, device, computer equipment and storage medium for executing use cases across environments |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310870433.1A CN116991713B (en) | 2023-07-17 | 2023-07-17 | Method, device, computer equipment and storage medium for executing use cases across environments |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116991713A CN116991713A (en) | 2023-11-03 |
CN116991713B true CN116991713B (en) | 2024-02-20 |
Family
ID=88529360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310870433.1A Active CN116991713B (en) | 2023-07-17 | 2023-07-17 | Method, device, computer equipment and storage medium for executing use cases across environments |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116991713B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118092943B (en) * | 2024-04-26 | 2024-08-06 | 杭州数云信息技术有限公司 | Application release method and device, computer readable storage medium and terminal |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107908543A (en) * | 2017-07-26 | 2018-04-13 | 平安壹钱包电子商务有限公司 | Applied program testing method, device, computer equipment and storage medium |
CN112667506A (en) * | 2020-12-26 | 2021-04-16 | 一城一家网络科技有限公司 | Interface testing method and related device |
CN113127347A (en) * | 2021-04-14 | 2021-07-16 | 广联达科技股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN114168471A (en) * | 2021-12-09 | 2022-03-11 | 挂号网(杭州)科技有限公司 | Test method, device, electronic equipment and storage medium |
CN114816965A (en) * | 2021-01-18 | 2022-07-29 | 腾讯科技(深圳)有限公司 | Data verification method and device |
CN115269424A (en) * | 2022-08-04 | 2022-11-01 | 中国平安财产保险股份有限公司 | Automatic regression testing method, device, equipment and storage medium for production flow |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10261893B2 (en) * | 2016-12-05 | 2019-04-16 | Salesforce.Com, Inc. | Implicit coordination of deployment and regression testing across data centers and system clusters |
-
2023
- 2023-07-17 CN CN202310870433.1A patent/CN116991713B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107908543A (en) * | 2017-07-26 | 2018-04-13 | 平安壹钱包电子商务有限公司 | Applied program testing method, device, computer equipment and storage medium |
CN112667506A (en) * | 2020-12-26 | 2021-04-16 | 一城一家网络科技有限公司 | Interface testing method and related device |
CN114816965A (en) * | 2021-01-18 | 2022-07-29 | 腾讯科技(深圳)有限公司 | Data verification method and device |
CN113127347A (en) * | 2021-04-14 | 2021-07-16 | 广联达科技股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN114168471A (en) * | 2021-12-09 | 2022-03-11 | 挂号网(杭州)科技有限公司 | Test method, device, electronic equipment and storage medium |
CN115269424A (en) * | 2022-08-04 | 2022-11-01 | 中国平安财产保险股份有限公司 | Automatic regression testing method, device, equipment and storage medium for production flow |
Non-Patent Citations (2)
Title |
---|
Secure Token–Key Implications in an Enterprise Multi-Tenancy Environment Using BGV–EHC Hybrid Homomorphic Encryption;Pooja Dhiman等;《Electronics 2022》;第11卷(第13期);1-17 * |
SQLMVED:基于多变体执行的SQL注入运行时防御系统;马博林 等;《通信学报》;第42卷(第04期);127-138 * |
Also Published As
Publication number | Publication date |
---|---|
CN116991713A (en) | 2023-11-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11281457B2 (en) | Deployment of infrastructure in pipelines | |
CA3131079A1 (en) | Test case generation method and device, computer equipment and storage medium | |
US10305962B1 (en) | Unit testing clients of web services | |
CN106415480B (en) | High-speed application for installation on a mobile device for enabling remote configuration of the mobile device | |
US10803166B1 (en) | Automated determination of application privileges | |
US12164898B2 (en) | Automated deployment of changes to applications on a cloud computing platform | |
WO2020232883A1 (en) | Script defect scanning method and apparatus, computer device and storage medium | |
CN105389263A (en) | Method, system and equipment for monitoring application software permissions | |
CN111581077B (en) | Smart contract testing method and device | |
CN113434158A (en) | User-defined management method, device, equipment and medium for big data component | |
CN116450107B (en) | Method and device for secondary development of software by low-code platform and electronic equipment | |
CN116991713B (en) | Method, device, computer equipment and storage medium for executing use cases across environments | |
CN112650689A (en) | Test method, test device, electronic equipment and storage medium | |
CN116257438A (en) | Updating method of interface test case and related equipment | |
CN106990974B (en) | APP updating method and device and electronic equipment | |
CN115113972A (en) | Application transformation method, system, cluster, medium and program product | |
CN113760724A (en) | Automatic testing method and device, electronic equipment and computer readable medium | |
US20240095029A1 (en) | Catalog for managing modular code | |
CN113032004A (en) | Method, apparatus and program product for managing development jobs in a development environment | |
US20230259347A1 (en) | Container based generation of inputs for generic functions | |
CN113515452B (en) | Automatic test method, system, electronic equipment and storage medium for application | |
CN115525545A (en) | Docker-based automatic testing method, system, equipment and medium | |
CN113094281A (en) | Hybrid App testing method and device | |
CN112560035A (en) | Application detection method, device, equipment and storage medium | |
US20240095337A1 (en) | Security compliance for modular code |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |