CN118193355A - Code testing method, storage medium and device - Google Patents
Code testing method, storage medium and device Download PDFInfo
- Publication number
- CN118193355A CN118193355A CN202311241887.9A CN202311241887A CN118193355A CN 118193355 A CN118193355 A CN 118193355A CN 202311241887 A CN202311241887 A CN 202311241887A CN 118193355 A CN118193355 A CN 118193355A
- Authority
- CN
- China
- Prior art keywords
- service
- test
- tested
- target
- testing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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 OR CALCULATING; 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/3696—Methods or tools to render software testable
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)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明提供了一种代码的测试方法、存储介质与设备。其中上述方法包括:获取待测目标微服务的相关目标参数以及测试数据包;根据目标参数获取目标微服务中可访问的服务列表;根据测试数据包远程调用服务列表中的待测服务进行测试。通过本方法,能够通过获取待测目标微服务的相关参数以及测试数据包,从而无论待测目标微服务是否向外暴露调用接口,测试服务都能够直接对待测服务进行远程调用,随后进行测试任务,从而确保待测目标微服务的功能性。
The present invention provides a code testing method, storage medium and device. The method includes: obtaining relevant target parameters and test data packets of a target microservice to be tested; obtaining a list of accessible services in the target microservice according to the target parameters; and remotely calling the service to be tested in the service list according to the test data packet for testing. Through this method, by obtaining relevant parameters and test data packets of the target microservice to be tested, the test service can directly remotely call the service to be tested, regardless of whether the target microservice to be tested exposes a call interface to the outside, and then perform the test task, thereby ensuring the functionality of the target microservice to be tested.
Description
技术领域Technical Field
本发明涉及互联网领域,特别是涉及一种代码的测试方法、存储介质与设备。The present invention relates to the field of Internet, and in particular to a code testing method, storage medium and device.
背景技术Background technique
随着互联网的普及,大量的软件系统采用分布式架构。在分布式系统中,不同的模块之间需要进行远程调用,保证整个系统的正常运行。Feign是一个流行的微服务框架,它通过定义接口来实现远程调用,简化了开发人员的工作。然而,在分布式系统中,由于各种原因,例如网络延迟、服务故障等,远程调用接口存在很多问题。为了提高系统的鲁棒性和稳定性,需要对Feign远程调用接口进行测试。但是在实际生产环境中,很多待测微服务无法从外部直接远程调用。With the popularization of the Internet, a large number of software systems adopt distributed architecture. In a distributed system, remote calls are required between different modules to ensure the normal operation of the entire system. Feign is a popular microservice framework that simplifies the work of developers by defining interfaces to implement remote calls. However, in distributed systems, there are many problems with remote call interfaces due to various reasons, such as network delays, service failures, etc. In order to improve the robustness and stability of the system, it is necessary to test the Feign remote call interface. However, in the actual production environment, many microservices to be tested cannot be directly called remotely from the outside.
发明内容Summary of the invention
本发明的一个目的是能够远程代码中的服务进行测试。It is an object of the present invention to enable testing of services in remote code.
本发明的一个进一步的目的是保证测试接口的安全性。A further object of the present invention is to ensure the security of the test interface.
特别地,本发明提供了一种代码的测试方法,包括:In particular, the present invention provides a code testing method, comprising:
获取待测目标微服务的相关目标参数以及测试数据包;Obtain relevant target parameters and test data packets of the target microservice to be tested;
根据目标参数获取目标微服务中可访问的服务列表;Get the list of accessible services in the target microservice based on the target parameters;
根据测试数据包远程调用服务列表中的待测服务进行测试。The test data packet remotely calls the service to be tested in the service list for testing.
可选地,根据测试数据包远程调用服务列表中的待测服务进行测试的步骤包括:Optionally, the step of remotely calling the service to be tested in the service list according to the test data packet to perform the test includes:
调用测试服务获取测试数据包;Call the test service to obtain the test data package;
根据测试数据包通过远程调用框架对待测服务进行测试。The service under test is tested through the remote call framework according to the test data package.
可选地,获取待测目标微服务的相关目标参数以及测试数据包的步骤包括:Optionally, the step of obtaining relevant target parameters of the target microservice to be tested and a test data packet includes:
将测试服务发布至注册中心,从而生成测试接口;Publish the test service to the registration center to generate the test interface;
通过测试接口接收待测目标微服务的相关目标参数以及测试数据包;Receive relevant target parameters and test data packets of the target microservice to be tested through the test interface;
对目标参数进行解析,得到解析结果,解析结果包括待测目标微服务在注册中心的服务名称。Parse the target parameters to obtain the parsing result, which includes the service name of the target microservice to be tested in the registration center.
可选地,根据目标参数获取目标微服务中可访问的服务列表的步骤包括:Optionally, the step of obtaining a list of accessible services in a target microservice according to a target parameter includes:
根据服务名称在注册中心进行查找,得到服务列表。Search the registration center according to the service name to get the service list.
可选地,根据服务名称在注册中心进行查找,得到服务列表的步骤包括:Optionally, the steps of searching in a registration center according to the service name to obtain a service list include:
根据服务名称通过负载均衡器查找至待测目标微服务所在的服务器;Find the server where the target microservice to be tested is located through the load balancer based on the service name;
在服务器中根据服务名称进行查找,得到服务列表。Search the server by service name to get a list of services.
可选地,获取待测目标微服务的相关目标参数以及测试数据包的步骤之前还包括:Optionally, before the step of obtaining relevant target parameters of the target microservice to be tested and the test data packet, the step further includes:
将测试接口加入至网关路由配置中,并开启安全认证。Add the test interface to the gateway routing configuration and enable security authentication.
可选地,安全认证的步骤包括:Optionally, the steps of security authentication include:
接收测试请求;Receive test requests;
获取测试请求中携带的安全令牌;Get the security token carried in the test request;
对安全令牌进行验证;Validate the security token;
当安全令牌通过验证,则判定测试请求通过安全认证。When the security token is verified, the test request is determined to have passed the security authentication.
可选地,待测目标微服务包括外部无法直接访问的微服务。Optionally, the target microservice to be tested includes a microservice that is not directly accessible to the outside.
根据本发明的又一个方面,还提供了一种机器可读存储介质,其上存储有机器可执行程序,机器可执行程序被处理器执行时实现上述任一种的代码的测试方法。According to yet another aspect of the present invention, there is provided a machine-readable storage medium on which a machine executable program is stored. When the machine executable program is executed by a processor, any of the above code testing methods is implemented.
根据本发明的再一个方面,还提供了一种计算机设备,包括存储器、处理器及存储在存储器上并在处理器上运行的机器可执行程序,并且处理器执行机器可执行程序时实现上述任一种的代码的测试方法。According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the above code testing methods when executing the machine executable program.
本发明的方案中,首先获取待测目标微服务的相关目标参数以及测试数据包,其中相关目标参数包括目标微服务的地址等信息;随后根据目标参数获取目标微服务中可访问的服务列表;接着根据测试数据包远程调用服务列表中的待测服务进行测试。通过此方法,无论待测目标微服务是否向外暴露调用接口,测试服务都能够直接调用到待测目标微服务进行测试任务,从而确保待测目标微服务的功能性。In the solution of the present invention, firstly, the relevant target parameters and test data packets of the target microservice to be tested are obtained, wherein the relevant target parameters include information such as the address of the target microservice; then, the list of accessible services in the target microservice is obtained according to the target parameters; and then, the service to be tested in the service list is remotely called according to the test data packet for testing. Through this method, regardless of whether the target microservice to be tested exposes a calling interface to the outside, the test service can directly call the target microservice to be tested to perform the test task, thereby ensuring the functionality of the target microservice to be tested.
进一步地,本发明的方案中,将测试服务也加入至注册中心,并且生成测试接口之后将测试接口加入网关路由配置中,从而开启安全认证。通过此方法,能够保证测试服务以及测试接口的安全性。Furthermore, in the solution of the present invention, the test service is also added to the registration center, and after the test interface is generated, the test interface is added to the gateway routing configuration, thereby enabling security authentication. Through this method, the security of the test service and the test interface can be guaranteed.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
后文将参照附图以示例性而非限制性的方式详细描述本发明的一些具体实施例。附图中相同的附图标记标示了相同或类似的部件或部分。本领域技术人员应该理解,这些附图未必是按比例绘制的。附图中:Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
图1是根据本发明一个实施例的代码的测试方法的流程示意图;FIG1 is a schematic flow chart of a code testing method according to an embodiment of the present invention;
图2是根据本发明另一个实施例的代码的测试方法的流程示意图;FIG2 is a schematic flow chart of a code testing method according to another embodiment of the present invention;
图3是根据本发明再一个实施例的代码的测试方法的流程示意图;FIG3 is a schematic flow chart of a code testing method according to yet another embodiment of the present invention;
图4是根据本发明一个实施例的代码的测试方法的系统架构示意图;FIG4 is a schematic diagram of a system architecture of a code testing method according to an embodiment of the present invention;
图5是根据本发明一个实施例的代码的测试方法中机器可读存储介质的示意图;以及FIG5 is a schematic diagram of a machine-readable storage medium in a code testing method according to an embodiment of the present invention; and
图6是根据本发明一个实施例的代码的测试方法计算机设备的示意图。FIG6 is a schematic diagram of a computer device for a code testing method according to an embodiment of the present invention.
具体实施方式Detailed ways
本领域技术人员应当理解的是,下文所描述的实施例仅仅是本发明的一部分实施例,而不是本发明的全部实施例,该一部分实施例旨在用于解释本发明的技术原理,并非用于限制本发明的保护范围。基于本发明提供的实施例,本领域普通技术人员在没有付出创造性劳动的情况下所获得的其它所有实施例,仍应落入到本发明的保护范围之内。It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and these embodiments are intended to explain the technical principles of the present invention, rather than to limit the protection scope of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should still fall within the protection scope of the present invention.
图1是根据本发明一个实施例的代码的测试方法的流程示意图。在一些可选的实施例中,本流程一般可以包括:Fig. 1 is a schematic diagram of a flow chart of a method for testing a code according to an embodiment of the present invention. In some optional embodiments, this flow chart may generally include:
步骤S101,获取待测目标微服务的相关目标参数以及测试数据包。在一些可选的实施例中,微服务是指是一种云原生架构方法,在单个应用中包含众多松散耦合且可单独部署的小型组件或服务。其特点在于代码更容易更新,可以直接添加新特性或功能,而不必更新整个应用,团队可以对不同的组件使用不同的技术栈和不同的编程语言。组件可以相互独立地扩展,从而减少与必须扩展整个应用相关的浪费和成本(因为单个功能可能面临过多的负载)。Step S101, obtain the relevant target parameters and test data packets of the target microservice to be tested. In some optional embodiments, microservice refers to a cloud-native architecture method that contains many loosely coupled and independently deployable small components or services in a single application. Its characteristics are that the code is easier to update, new features or functions can be added directly without updating the entire application, and the team can use different technology stacks and different programming languages for different components. Components can be expanded independently of each other, thereby reducing the waste and cost associated with having to expand the entire application (because a single function may face excessive load).
但是,在实际生产生活中,由于部分微服务并不对外暴露,即外部无法直接调用,仅可以通过其他微服务间接使用目标微服务的部分功能。因此通常对于此类目标微服务的测试通常是重复调用其上层微服务,从而间接测试目标微服务的部分功能,但是此种测试方法无法全面地对目标微服务进行测试,为了解决上述问题,提出本实施例。However, in actual production life, since some microservices are not exposed to the outside, that is, they cannot be directly called from the outside, only some functions of the target microservice can be used indirectly through other microservices. Therefore, the test of such target microservices is usually to repeatedly call its upper-layer microservices, thereby indirectly testing some functions of the target microservices. However, this test method cannot comprehensively test the target microservice. In order to solve the above problem, this embodiment is proposed.
在本实施例中,相关目标参数一般可以包括:待测目标微服务在注册中心的名称等参数,测试数据包是指对待测目标微服务所需要输入的测试数据。本领域技术人员可以根据实际情况确定相关目标参数以及测试数据包的具体内容。In this embodiment, the relevant target parameters may generally include: the name of the target microservice to be tested in the registration center and other parameters, and the test data packet refers to the test data required to be input for the target microservice to be tested. Those skilled in the art can determine the relevant target parameters and the specific content of the test data packet according to actual conditions.
步骤S102,根据目标参数获取目标微服务中可访问的服务列表。在一些可选的实施例中,由于目标微服务是一种整体服务的框架,其内部包含了多个细化的服务及其对应的地址和端口,因此,通过目标参数获取目标微服务中可以访问的服务列表,从而确定需要具体进行测试的服务。Step S102, obtaining a list of accessible services in the target microservice according to the target parameters. In some optional embodiments, since the target microservice is a framework of an overall service, which contains multiple detailed services and their corresponding addresses and ports, the list of accessible services in the target microservice is obtained through the target parameters to determine the specific services that need to be tested.
步骤S103,根据测试数据包远程调用服务列表中的待测服务进行测试。Step S103: remotely call the service to be tested in the service list according to the test data packet to perform the test.
本实施例的代码的测试方法,通过测试服务获取待测目标微服务的相关参数以及测试数据包,随后找到需要进行测试的具体服务进行测试。通过此方法,无论待测目标微服务是否向外暴露调用接口,测试服务都能够直接调用到待测目标微服务进行测试任务,从而确保待测目标微服务的功能性。The code testing method of this embodiment obtains the relevant parameters and test data packets of the target microservice to be tested through the test service, and then finds the specific service to be tested for testing. Through this method, regardless of whether the target microservice to be tested exposes the calling interface to the outside, the test service can directly call the target microservice to be tested to perform the test task, thereby ensuring the functionality of the target microservice to be tested.
在一些可选的实施例中,根据测试数据包远程调用服务列表中的待测服务进行测试的步骤一般可以包括:调用测试服务获取测试数据包;根据测试数据包远程调用待测服务进行测试。其中远程调用框架的一种可选示例如:feign是一个http请求调用的轻量级框架,可以以java接口注解的方式来调用http请求,因此通过在测试服务的代码层面预留通过feign进行远程调用的方法,在知道所要调用的待测服务的情况下,调用此方法,同时需要将测试所需要的测试数据包作为参数传入,由此来完成对待测服务的远程调用或远程测试。In some optional embodiments, the step of remotely calling the service to be tested in the service list according to the test data packet to test can generally include: calling the test service to obtain the test data packet; remotely calling the service to be tested according to the test data packet to test. An optional example of a remote call framework is as follows: feign is a lightweight framework for http request calls, which can call http requests in the form of java interface annotations. Therefore, by reserving a method for remote calling through feign at the code level of the test service, when the service to be tested is known, this method is called, and the test data packet required for the test needs to be passed in as a parameter, thereby completing the remote call or remote test of the service to be tested.
获取待测目标微服务的相关目标参数以及测试数据包的步骤一般可以包括:将测试服务发布至注册中心,从而生成测试接口;通过测试接口接收待测目标微服务的相关目标参数以及测试数据包;对目标参数进行解析,得到解析结果,解析结果包括待测目标微服务在注册中心的服务名称等信息。在本实施例中,注册中心的一种核心功能用于服务注册。它允许服务提供者将自己的服务注册到注册中心,以便其他服务消费者可以发现和调用这些服务。在注册过程中,服务提供者通常会提供一些关键信息,如服务名称、服务地址、服务版本等。这些信息将被注册中心用于服务的管理和查找。因此,在本步骤中,将测试服务注册至注册中心,可以便于测试人员通过测试接口调用测试服务。在使用测试服务的过程中,通过获取待测目标微服务的相关目标参数以及测试数据包并解析之后,得到解析结果,解析结果包括待测目标微服务在注册中心的服务名称等信息。通过待测目标微服务在注册中心的服务名称等信息可以找到目标待测微服务,从而实现调用。The step of obtaining the relevant target parameters and test data packets of the target microservice to be tested can generally include: publishing the test service to the registration center to generate a test interface; receiving the relevant target parameters and test data packets of the target microservice to be tested through the test interface; parsing the target parameters to obtain the parsing results, and the parsing results include information such as the service name of the target microservice to be tested in the registration center. In this embodiment, a core function of the registration center is used for service registration. It allows service providers to register their services to the registration center so that other service consumers can discover and call these services. During the registration process, service providers usually provide some key information, such as service name, service address, service version, etc. This information will be used by the registration center for service management and search. Therefore, in this step, registering the test service to the registration center can facilitate the tester to call the test service through the test interface. In the process of using the test service, by obtaining the relevant target parameters and test data packets of the target microservice to be tested and parsing them, the parsing results are obtained, and the parsing results include information such as the service name of the target microservice to be tested in the registration center. The target microservice to be tested can be found through the service name of the target microservice to be tested in the registration center, thereby realizing the call.
根据目标参数获取目标微服务中可访问的服务列表的步骤一般可以包括:根据服务名称在注册中心进行查找,得到服务列表。在本实施例中,关于注册中心的一些可选示例如:Zookeeper、Eureka、Nacos、Consul和ETCD等,上述示例可以实现注册中心所需要的功能要求,通过此类注册中心,能够根据服务名称找到待测微服务在注册中心中所注册的服务列表。本领域技术人员可以根据实际情况选择注册中心的具体中间件。其中服务列表中记录了每个服务的地址以及端口等信息。The step of obtaining a list of accessible services in the target microservice according to the target parameters may generally include: searching in the registration center according to the service name to obtain a service list. In this embodiment, some optional examples of the registration center are as follows: Zookeeper, Eureka, Nacos, Consul, and ETCD, etc. The above examples can realize the functional requirements required by the registration center. Through such a registration center, the service list registered in the registration center by the microservice to be tested can be found according to the service name. Those skilled in the art can select the specific middleware of the registration center according to the actual situation. The service list records the address and port information of each service.
根据服务名称在注册中心进行查找,得到服务列表的步骤一般可以包括:根据服务名称通过负载均衡器查找至待测目标微服务所在的服务器;在服务器中根据服务名称进行查找,得到服务列表。在本实施例中,负载均衡器的作用是一种将工作负载(例如网络流量、数据请求、计算任务等)分配到多个计算资源(例如服务器、虚拟机、容器等)的技术,以便优化性能、提高可靠性和增加可扩展性。因此,在实际生产中,由于许多业务是分布式架构,且通过多个服务器集群来进行响应,因此,通过负载均衡器能够找到服务名称所对应的待测目标微服务所在的服务器,从而实现对待测微服务进行测试的目的。一种可选的负载均衡器如Ribbon以及Nginx等中间件。本领域技术人员可以根据实际情况确定负载均衡器的类型。According to the service name, the step of searching in the registration center to obtain the service list can generally include: searching the server where the target microservice to be tested is located through the load balancer according to the service name; searching in the server according to the service name to obtain the service list. In this embodiment, the role of the load balancer is a technology that distributes workloads (such as network traffic, data requests, computing tasks, etc.) to multiple computing resources (such as servers, virtual machines, containers, etc.) to optimize performance, improve reliability and increase scalability. Therefore, in actual production, since many businesses are distributed architectures and respond through multiple server clusters, the server where the target microservice to be tested corresponding to the service name can be found through the load balancer, thereby achieving the purpose of testing the microservice to be tested. An optional load balancer such as middleware such as Ribbon and Nginx. Those skilled in the art can determine the type of load balancer according to actual conditions.
获取待测目标微服务的相关目标参数以及测试数据包的步骤之前一般还可以包括:将测试接口加入至网关路由配置中,并开启安全认证。在本实施例中,网关是统一管理API的一个网络关口、通道,是整个微服务平台所有请求的唯一入口,所有的客户端和消费端都通过统一的网关接入微服务,在网关层处理所有的非业务功能。在网关中能够实现路由转发以及过滤器功能。其中路由转发是指接收一切外界请求,转发到后端的微服务上去。过滤器功能是指在服务网关中可以完成一系列的横切功能,例如权限校验、限流以及监控等。在本步骤中,通将测试接口加入网关路由配置实现对外界测试请求的转发,通过在过滤器中增加安全认证功能,能够在测试接口被调用时,对其进行安全性检测,只有通过安全性检测才能够允许调用,从而保证测试接口的安全性。网关的可选示例如:Gateway等中间件。本领域技术人员可以根据实际情况确定网关的类型和具体流程以及安全认证的具体操作方式。Before obtaining the relevant target parameters of the target microservice to be tested and the step of testing the data packet, it can also generally include: adding the test interface to the gateway routing configuration and turning on security authentication. In this embodiment, the gateway is a network gateway and channel for unified management of the API, and is the only entrance for all requests of the entire microservice platform. All clients and consumers access the microservice through a unified gateway, and all non-business functions are processed at the gateway layer. Routing forwarding and filter functions can be realized in the gateway. Routing forwarding refers to receiving all external requests and forwarding them to the microservices at the back end. The filter function refers to a series of cross-cutting functions that can be completed in the service gateway, such as permission verification, current limiting, and monitoring. In this step, the forwarding of external test requests is realized by adding the test interface to the gateway routing configuration. By adding the security authentication function to the filter, the security detection can be performed on the test interface when it is called. Only by passing the security detection can the call be allowed, thereby ensuring the security of the test interface. Optional examples of gateways include: middleware such as Gateway. Those skilled in the art can determine the type of gateway and the specific process and specific operation mode of security authentication according to actual conditions.
在一些可选的实施例中,安全认证的步骤一般可以包括:接收测试请求;获取测试请求中携带的安全令牌;对安全令牌进行验证;当安全令牌通过验证,则判定测试请求通过安全认证。其中,安全令牌是一种安全性校验的可选方式,是一种用于身份验证和访问控制的安全机制,通常是一个数字或代码,类似于密码,可以用于证明用户的身份。In some optional embodiments, the steps of security authentication may generally include: receiving a test request; obtaining a security token carried in the test request; verifying the security token; and when the security token passes the verification, determining that the test request passes the security authentication. Among them, the security token is an optional way of security verification, a security mechanism for identity authentication and access control, usually a number or code, similar to a password, which can be used to prove the identity of the user.
通过本方法,能够根据测试服务在获取到待测目标服务相关目标参数以及测试数据包的情况下,通过注册中心找到实际生产中无法直接远程调用的待测微服务对应的服务列表,随后通过测试数据包远程调用服务列表中的服务,从而实现测试隐藏服务的目的。并且能够对代码中的全部微服务进行测试,同时通过加装网关并开启安全认证的方式,保证测试服务的安全性。Through this method, when the test service obtains the target parameters and test data packets related to the target service to be tested, the service list corresponding to the microservice to be tested that cannot be directly remotely called in actual production can be found through the registration center, and then the service in the service list can be remotely called through the test data packet, thereby achieving the purpose of testing hidden services. In addition, all microservices in the code can be tested, and the security of the test service can be guaranteed by installing a gateway and opening security authentication.
图2是根据本发明另一个实施例的代码的测试方法的流程示意图。在一些可选的实施例中,本流程一般可以包括:Fig. 2 is a flow chart of a method for testing code according to another embodiment of the present invention. In some optional embodiments, this process may generally include:
步骤S201,通过网关对测试请求进行安全认证。在本实施例中,本步骤一般可以包括:将测试接口加入至网关路由配置中,并开启安全认证。其中网关是统一管理API的一个网络关口、通道,是整个微服务平台所有请求的唯一入口,所有的客户端和消费端都通过统一的网关接入微服务,在网关层处理所有的非业务功能。在网关中能够实现路由转发以及过滤器功能。其中路由转发是指接收一切外界请求,转发到后端的微服务上去。过滤器功能是指在服务网关中可以完成一系列的横切功能,例如权限校验、限流以及监控等。在本步骤中,通将测试接口加入网关路由配置实现对外界测试请求的转发,通过在过滤器中增加安全认证功能,能够在测试接口被调用时,对其进行安全性检测,只有通过安全性检测才能够允许调用,从而保证测试接口的安全性。本领域技术人员可以根据实际情况确定网关的类型和具体流程以及安全认证的具体操作方式。Step S201, security authentication is performed on the test request through the gateway. In this embodiment, this step can generally include: adding the test interface to the gateway routing configuration and opening security authentication. Wherein the gateway is a network gateway and channel for unified management of API, and is the only entrance for all requests of the entire microservice platform. All clients and consumers access the microservice through a unified gateway, and all non-business functions are processed at the gateway layer. Routing forwarding and filter functions can be realized in the gateway. Wherein routing forwarding refers to receiving all external requests and forwarding them to the microservices at the back end. The filter function refers to a series of cross-cutting functions that can be completed in the service gateway, such as permission verification, current limiting and monitoring. In this step, the forwarding of external test requests is realized by adding the test interface to the gateway routing configuration. By adding the security authentication function in the filter, the security detection can be performed on the test interface when it is called. Only by passing the security detection can the call be allowed, thereby ensuring the security of the test interface. Those skilled in the art can determine the type of gateway and the specific process and the specific operation mode of security authentication according to the actual situation.
步骤S202,通过测试接口接收待测目标微服务的相关目标参数以及测试数据包。在一些可选的实施例中,微服务是指是一种云原生架构方法,在单个应用中包含众多松散耦合且可单独部署的小型组件或服务。其特点在于代码更容易更新,可以直接添加新特性或功能,而不必更新整个应用,团队可以对不同的组件使用不同的技术栈和不同的编程语言。组件可以相互独立地扩展,从而减少与必须扩展整个应用相关的浪费和成本(因为单个功能可能面临过多的负载)。在实际生产生活中,由于部分微服务并不对外暴露,即外部无法直接调用,仅可以通过其他微服务间接使用目标微服务的部分功能。因此通常对于此类目标微服务的测试通常是重复调用其上层微服务,从而间接测试目标微服务的部分功能,但是此种测试方法无法全面地对目标微服务进行测试,为了解决上述问题,提出本实施例。Step S202, receives the relevant target parameters and test data packets of the target microservice to be tested through the test interface. In some optional embodiments, microservice refers to a cloud native architecture method, which includes many loosely coupled and separately deployable small components or services in a single application. It is characterized in that the code is easier to update, and new features or functions can be added directly without updating the entire application, and the team can use different technology stacks and different programming languages for different components. The components can be extended independently of each other, thereby reducing the waste and cost associated with having to extend the entire application (because a single function may face too much load). In actual production life, since some microservices are not exposed to the outside, that is, they cannot be directly called from the outside, only some functions of the target microservice can be indirectly used through other microservices. Therefore, the test for such target microservices is usually to repeatedly call its upper-level microservices, thereby indirectly testing some functions of the target microservices, but this test method cannot comprehensively test the target microservices. In order to solve the above problems, this embodiment is proposed.
在本实施例中,相关目标参数一般可以包括:待测目标微服务在注册中心的名称等参数,测试数据包是指对待测目标微服务所需要输入的测试数据。本领域技术人员可以根据实际情况确定相关目标参数以及测试数据包的具体内容。In this embodiment, the relevant target parameters may generally include: the name of the target microservice to be tested in the registration center and other parameters, and the test data packet refers to the test data required to be input for the target microservice to be tested. Those skilled in the art can determine the relevant target parameters and the specific content of the test data packet according to actual conditions.
步骤S203,在注册中心查找并调用测试服务。在一些可选的实施例中,注册中心的一种核心功能是用于服务注册。它允许服务提供者将自己的服务注册到注册中心,以便其他服务消费者可以发现和调用这些服务。在注册过程中,服务提供者通常会提供一些关键信息,如服务名称、服务地址、服务版本等。这些信息将被注册中心用于服务的管理和查找。因此,在本步骤中,通过将测试服务注册至注册中心之后,可以便于测试人员通过测试接口调用测试服务。Step S203, search and call the test service in the registration center. In some optional embodiments, a core function of the registration center is to register services. It allows service providers to register their services with the registration center so that other service consumers can discover and call these services. During the registration process, the service provider usually provides some key information, such as service name, service address, service version, etc. This information will be used by the registration center for service management and search. Therefore, in this step, by registering the test service with the registration center, it is convenient for testers to call the test service through the test interface.
步骤S204,对目标参数进行解析,得到解析结果。在一些可选的实施例中,在使用测试服务的过程中,通过获取待测目标微服务的相关目标参数以及测试数据包并解析之后,得到解析结果,解析结果包括待测目标微服务在注册中心的服务名称等信息。通过待测目标微服务在注册中心的服务名称等信息可以找到目标待测微服务,从而实现调用。Step S204, parse the target parameters to obtain a parsing result. In some optional embodiments, in the process of using the test service, the relevant target parameters of the target microservice to be tested and the test data packet are obtained and parsed to obtain a parsing result, and the parsing result includes information such as the service name of the target microservice to be tested in the registration center. The target microservice to be tested can be found through the service name of the target microservice to be tested in the registration center, so as to realize the call.
步骤S205,根据服务名称通过负载均衡器查找至待测目标微服务所在的服务器。在本实施例中,负载均衡器的作用是一种将工作负载(例如网络流量、数据请求、计算任务等)分配到多个计算资源(例如服务器、虚拟机、容器等)的技术,以便优化性能、提高可靠性和增加可扩展性。因此,在实际生产中,由于许多业务是分布式架构,且通过多个服务器集群来进行响应,因此,通过负载均衡器能够找到服务名称所对应的待测目标微服务所在的服务器,从而实现对待测微服务进行测试的目的。Step S205, find the server where the target microservice to be tested is located through the load balancer according to the service name. In this embodiment, the role of the load balancer is a technology that distributes workloads (such as network traffic, data requests, computing tasks, etc.) to multiple computing resources (such as servers, virtual machines, containers, etc.) to optimize performance, improve reliability, and increase scalability. Therefore, in actual production, since many businesses are distributed architectures and respond through multiple server clusters, the server where the target microservice to be tested corresponding to the service name is located can be found through the load balancer, thereby achieving the purpose of testing the microservice to be tested.
步骤S206,在服务器中根据服务名称进行查找,得到服务列表。在本实施例中,关于注册中心的一些可选示例如:Zookeeper、Eureka、Nacos、Consul和ETCD等,上述示例可以实现注册中心所需要的功能要求,通过此类注册中心,能够根据服务名称找到待测微服务在注册中心中所注册的服务列表。本领域技术人员可以根据实际情况选择注册中心的具体中间件。其中服务列表中记录了每个服务的地址以及端口等信息。Step S206, search the server according to the service name to obtain a service list. In this embodiment, some optional examples of the registration center are as follows: Zookeeper, Eureka, Nacos, Consul, and ETCD, etc. The above examples can realize the functional requirements required by the registration center. Through such a registration center, the service list of the microservice to be tested registered in the registration center can be found according to the service name. Those skilled in the art can select the specific middleware of the registration center according to the actual situation. The service list records the address and port information of each service.
步骤S207,根据测试数据包通过远程调用框架对待测服务进行测试。在本实施例中,远程调用框架的一种可选示例如:feign是一个http请求调用的轻量级框架,可以以java接口注解的方式来调用http请求,因此通过在测试服务的代码层面预留通过feign进行远程调用的方法,在通过上述步骤知道所要调用的待测服务的情况下,调用此方法,同时需要将测试所需要的测试数据包作为参数传入,由此来完成对待测服务的远程调用或远程测试。Step S207, testing the service to be tested through the remote call framework according to the test data packet. In this embodiment, an optional example of the remote call framework is as follows: feign is a lightweight framework for http request calls, which can call http requests in the form of java interface annotations. Therefore, by reserving a method for remote calling through feign at the code level of the test service, when the service to be tested to be called is known through the above steps, this method is called, and the test data packet required for the test needs to be passed in as a parameter, thereby completing the remote call or remote test of the service to be tested.
通过本方法,能够根据测试服务在获取到待测目标服务相关信息以及测试数据包的情况下,通过注册中心找到实际生产中无法直接调用的待测微服务对应的服务列表,随后通过测试数据包远程调用服务列表中的服务,从而实现测试隐藏服务的目的。并且能够对代码中的全部微服务进行测试,同时通过加装网关并开启安全认证的方式,保证测试服务的安全性。Through this method, when the test service obtains the relevant information of the target service to be tested and the test data packet, it can find the service list corresponding to the microservice to be tested that cannot be directly called in actual production through the registration center, and then remotely call the service in the service list through the test data packet, thereby achieving the purpose of testing hidden services. In addition, all microservices in the code can be tested, and the security of the test service can be guaranteed by installing a gateway and opening security authentication.
图3是根据本发明再一个实施例的代码的测试方法的流程示意图。在一些可选的实施例中,本流程一般可以包括:Fig. 3 is a flow chart of a method for testing a code according to another embodiment of the present invention. In some optional embodiments, this flow may generally include:
步骤S301,接收Http Request请求。在本实施例中,Http Request请求代表来自客户端发送的请求,也即测试请求;当客户端通过HTTP协议访问服务器时,HTTP请求头header中的所有信息都封装在这个对象中,通过这个对象提供的方法,可以获得客户端请求的所有信息。Step S301, receiving an Http Request. In this embodiment, an Http Request represents a request sent from a client, that is, a test request; when a client accesses a server through the HTTP protocol, all information in the HTTP request header is encapsulated in this object, and all information requested by the client can be obtained through the methods provided by this object.
步骤S302,验证请求头header中的tocken是否有效。在本实施例中,由于将测试服务加入了网关路由配置中,并开启了安全认证,因此,网关在此会验证本次请求是否安全或者符合预设规则。一种可选的方式便是,验证请求头header中的tocken是否有效。其中,tocken是一种安全令牌,其自身通过携带服务器约定好的信息,从而在网关接收到该tocken时,便能够判定出本次请求是可信的请求,从而通过安全认证。Step S302, verify whether the token in the request header is valid. In this embodiment, since the test service is added to the gateway routing configuration and security authentication is enabled, the gateway will verify whether the request is safe or complies with preset rules. An optional way is to verify whether the token in the request header is valid. Among them, token is a security token, which carries the information agreed upon by the server, so when the gateway receives the token, it can determine that the request is a credible request, thereby passing the security authentication.
步骤S303,根据请求体body中的相关参数,在注册中心中查找待测服务的ip、port。在一些可选的实施例中,ip是一个服务在服务器中的访问地址,port则是一个服务在服务器中所分配的端口,在本实施例中,port逻辑意义上的端口,通常是指TCP/IP协议中的port,port号的范围从0到65535,比方用于浏览网页服务。当获取到待测服务ip和port,也即获取得到了访问待测服务的地址以及端口,随后通过此ip和port便可以调用待测服务中的具体方法,从而进行测试。本领域技术人员可以根据实际的业务逻辑确定相关参数的具体形式。Step S303, according to the relevant parameters in the request body, search the IP and port of the service to be tested in the registration center. In some optional embodiments, IP is the access address of a service in the server, and port is the port assigned to a service in the server. In this embodiment, the port in the logical sense usually refers to the port in the TCP/IP protocol, and the port number ranges from 0 to 65535, such as for browsing web services. When the IP and port of the service to be tested are obtained, that is, the address and port for accessing the service to be tested are obtained, then the specific method in the service to be tested can be called through this IP and port, so as to perform the test. Those skilled in the art can determine the specific form of the relevant parameters according to the actual business logic.
步骤S304,根据请求体body中的测试数据包向待测服务发起request请求。在本实施例中,本步骤一般可以包括:通过步骤S301找到的待测服务的ip和port,将测试数据包作为参数远程调用其中的方法,从而实现对待测服务的测试。Step S304, initiating a request to the service under test according to the test data packet in the request body. In this embodiment, this step generally may include: remotely calling a method in the service under test using the test data packet as a parameter through the IP and port of the service under test found in step S301, thereby implementing a test on the service under test.
步骤S305,接收待测服务响应,传递响应结果给客户端。在一些可选的实施例中,当待测服务在方法被远程调用之后,按照待测服务自身的逻辑进行执行,并在运行完毕之后会得到响应结果,也即待测服务在接受调用之后所做出的响应,随后将响应结果返回至客户端,也即测试请求的接收响应结果的位置。Step S305, receiving the response of the service under test, and delivering the response result to the client. In some optional embodiments, after the method of the service under test is remotely called, it is executed according to the logic of the service under test itself, and after the operation is completed, a response result will be obtained, that is, the response made by the service under test after receiving the call, and then the response result will be returned to the client, that is, the location where the response result of the test request is received.
通过此方法,能够在客户端发起测试请求之后,根据测试请求中所携带的具体信息进行查找,在查找到待测服务的地址以及端口之后,根据测试数据包发起测试,随后将响应结果返回至客户端。相比于现有的测试方法,能够在待测服务无法直接调用或者对外隐藏的情况下,根据相关参数找到待测服务的地址和端口,从而实现远程调用待测服务的方法。进而实现对待测服务的测试。Through this method, after the client initiates a test request, it can search according to the specific information carried in the test request, and after finding the address and port of the service to be tested, initiate the test according to the test data packet, and then return the response result to the client. Compared with the existing test methods, when the service to be tested cannot be called directly or is hidden from the outside, the address and port of the service to be tested can be found according to the relevant parameters, thereby realizing the method of remotely calling the service to be tested. Then the test of the service to be tested is realized.
图4是根据本发明一个实施例的代码的测试方法的系统架构示意图。在一些可选的实施例中,本示意图一般可以包括:负载均衡器410、网关420、注册中心集群430、待测微服务440以及测试服务450。Fig. 4 is a schematic diagram of a system architecture of a code testing method according to an embodiment of the present invention. In some optional embodiments, this schematic diagram may generally include: a load balancer 410, a gateway 420, a registry cluster 430, a microservice to be tested 440, and a test service 450.
其中,负载均衡器410的作用是一种将工作负载(例如网络流量、数据请求、计算任务等)分配到多个计算资源(例如服务器、虚拟机、容器等)的技术,以便优化性能、提高可靠性和增加可扩展性。在本实施例中,负载均衡器410用于接收外部请求,随后通过负载均衡将请求发送至相应服务器的网关420中。关于负载均衡器410的一种可选示例如:Nginx中间件。本领域技术人员可以根据实际需要选择具体的负载均衡器配置。Among them, the role of the load balancer 410 is a technology that distributes workloads (such as network traffic, data requests, computing tasks, etc.) to multiple computing resources (such as servers, virtual machines, containers, etc.) in order to optimize performance, improve reliability, and increase scalability. In this embodiment, the load balancer 410 is used to receive external requests, and then send the requests to the gateway 420 of the corresponding server through load balancing. An optional example of the load balancer 410 is as follows: Nginx middleware. Those skilled in the art can select a specific load balancer configuration according to actual needs.
网关420是统一管理API的一个网络关口、通道,是整个微服务平台所有请求的唯一入口,所有的客户端和消费端都通过统一的网关接入微服务,在网关层处理所有的非业务功能。在网关中能够实现路由转发以及过滤器功能。其中路由转发是指接收一切外界请求,转发到后端的微服务上去。过滤器功能是指在服务网关中可以完成一系列的横切功能,例如权限校验、限流以及监控等。在本实施例中,网关420的一种可选示例如Gateway中间件,其能够在实现网关的作用的同时,也实现负载均衡,从而将请求发送至对应的服务器中调用相应的服务。本领域技术人员可以根据实际需要选择具体的网关配置。Gateway 420 is a network gateway and channel for unified management of APIs. It is the only entrance for all requests of the entire microservice platform. All clients and consumers access microservices through a unified gateway, and all non-business functions are processed at the gateway layer. Routing forwarding and filter functions can be implemented in the gateway. Routing forwarding refers to receiving all external requests and forwarding them to the microservices at the back end. The filter function refers to a series of cross-cutting functions that can be completed in the service gateway, such as permission verification, current limiting, and monitoring. In this embodiment, an optional example of gateway 420 is such as Gateway middleware, which can realize load balancing while realizing the role of the gateway, thereby sending requests to the corresponding server to call the corresponding service. Those skilled in the art can select a specific gateway configuration according to actual needs.
注册中心集群430的一种核心功能是用于服务注册。它允许服务提供者将自己的服务注册到注册中心,以便其他服务消费者可以发现和调用这些服务。在注册过程中,服务提供者通常会提供一些关键信息,如服务名称、服务地址、服务版本等。这些信息将被注册中心用于服务的管理和查找。并且注册中心集群430还会对网关420以及其他服务定时拉取服务列表,从而及时更新注册中心集群中的相关注册信息。注册中心集群430的一种可选示例如nacos中间件。本领域技术人员可以根据实际需要选择具体的注册中心配置。A core function of the registry cluster 430 is to register services. It allows service providers to register their services with the registry so that other service consumers can discover and call these services. During the registration process, service providers usually provide some key information, such as service name, service address, service version, etc. This information will be used by the registry to manage and find services. In addition, the registry cluster 430 will also regularly pull service lists for the gateway 420 and other services, so as to update the relevant registration information in the registry cluster in time. An optional example of the registry cluster 430 is nacos middleware. Those skilled in the art can select a specific registry configuration according to actual needs.
当测试人员通过客户端想要对待测微服务440中的待测服务441进行测试时,并且,待测微服务440由于实际业务原因,仅在注册中心集群中注册,并未对外公开,外部无法直接调用待测微服务440,也即无法直接向待测微服务440发起测试。When the tester wants to test the service 441 in the microservice 440 to be tested through the client, and the microservice 440 to be tested is only registered in the registration center cluster due to actual business reasons and is not open to the outside world, the microservice 440 to be tested cannot be directly called from the outside, that is, the test cannot be directly initiated to the microservice 440 to be tested.
在本实施例中,测试人员通过调用测试服务450来实现对待测微服务440中待测服务441的直接测试。具体的执行流程为:测试人员在可以调用测试服务450的情况下,通过客户端向测试服务450发送测试请求,测试请求中存储有待测微服务的相关目标参数以及测试数据包,相关目标参数一般可以包括:待测目标微服务440在注册中心集群430的名称等参数,测试数据包是指对待测目标微服务所需要输入的测试数据。随后经过负载均衡器410找到相应的网关420进行认证;在通过认证之后,根据测试请求中的信息确定待测微服务440在注册中心集群430中的名称等信息,从而在注册中心集群430找到对应的服务列表;接着在服务列表中找到待测服务441的地址以及端口等信息,根据测试数据包中的内容向待测服务441发起远程调用。In this embodiment, the tester implements direct testing of the service 441 to be tested in the microservice 440 to be tested by calling the test service 450. The specific execution process is: when the tester can call the test service 450, the tester sends a test request to the test service 450 through the client, and the test request stores the relevant target parameters and test data packets of the microservice to be tested. The relevant target parameters generally include: the name of the target microservice 440 to be tested in the registration center cluster 430 and other parameters, and the test data packet refers to the test data required to be input for the target microservice to be tested. Then, the load balancer 410 finds the corresponding gateway 420 for authentication; after passing the authentication, the name and other information of the microservice 440 to be tested in the registration center cluster 430 are determined according to the information in the test request, so as to find the corresponding service list in the registration center cluster 430; then, the address and port information of the service 441 to be tested are found in the service list, and a remote call is initiated to the service 441 to be tested according to the content in the test data packet.
通过上述方法,能够通过测试服务远程调用所有在注册中心集群中经过注册的服务,从而在部分服务对外隐藏的情况下,也能够进行测试,进而保证待测服务的功能性。并且测试服务同样进行注册以及加入网关,保证测试服务的安全性。Through the above method, all services registered in the registry cluster can be remotely called through the test service, so that when some services are hidden from the outside, testing can also be performed to ensure the functionality of the service under test. In addition, the test service is also registered and added to the gateway to ensure the security of the test service.
本实施还提供了一种机器可读存储介质和计算机设备。图5是根据本发明一个实施例的机器可读存储介质501的示意图,图6是根据本发明一个实施例的计算机设备603的示意图。This embodiment also provides a machine-readable storage medium and a computer device. Figure 5 is a schematic diagram of a machine-readable storage medium 501 according to an embodiment of the present invention, and Figure 6 is a schematic diagram of a computer device 603 according to an embodiment of the present invention.
机器可读存储介质501其上存储有机器可执行程序502,机器可执行程序502被处理器执行时实现上述任一实施例的代码的测试方法。The machine-readable storage medium 501 stores a machine executable program 502 , which implements the code testing method of any of the above embodiments when executed by a processor.
计算机设备603可以包括存储器601、处理器602及存储在存储器601上并在处理器602上运行的机器可执行程序502,并且处理器602执行机器可执行程序502时实现上述任一实施例的代码的测试方法。The computer device 603 may include a memory 601 , a processor 602 , and a machine executable program 502 stored in the memory 601 and running on the processor 602 , and the processor 602 implements the code testing method of any of the above embodiments when executing the machine executable program 502 .
需要说明的是,在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,远程调用待测服务,可以具体实现在任何机器可读存储介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。It should be noted that the logic and/or steps represented in the flowchart or described in other ways herein, for example, remotely calling the service to be tested, can be specifically implemented in any machine-readable storage medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.
就本实施例的描述而言,机器可读存储介质501可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。For the description of this embodiment, the machine-readable storage medium 501 may be any device that can contain, store, communicate, propagate or transmit a program for use with an instruction execution system, apparatus or device or in conjunction with such instruction execution system, apparatus or device.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
计算机设备603可以是例如车载计算机等类型的车机设备。计算机设备603可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括执行特定的任务或者实现特定的抽象数据类型的例程、程序、目标程序、组件、逻辑、数据结构等。计算机设备603可以在通过通信网络链接的远程处理设备执行任务的分布式云计算环境中实施。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统存储介质上,例如汽车中央处理器。The computer device 603 may be a vehicle-mounted device such as an onboard computer. The computer device 603 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 603 may be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device, such as a central processing unit of a vehicle.
计算机设备603可以包括适于执行存储的指令的处理器602、在操作期间为所述指令的操作提供临时存储空间的存储器601。处理器602可以是单核处理器、多核处理器、计算集群或任何数量的其他配置。存储器601可以包括随机存取存储器(RAM)、只读存储器、闪存或任何其他合适的存储系统。The computer device 603 may include a processor 602 adapted to execute stored instructions, and a memory 601 that provides temporary storage space for the operation of the instructions during operation. The processor 602 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 601 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.
处理器602可以通过系统互连(例如PCI、PCI-Express等)连接到适于将计算机设备603连接到一个或多个I/O设备(输入/输出设备)的I/O接口(输入/输出接口)。I/O设备可以包括例如键盘和指示设备,其中指示设备可以包括触摸板或触摸屏等等。I/O设备可以是计算机设备603的内置组件,或者可以是外部连接到计算设备的设备。The processor 602 may be connected to an I/O interface (input/output interface) suitable for connecting the computer device 603 to one or more I/O devices (input/output devices) through a system interconnect (e.g., PCI, PCI-Express, etc.). The I/O devices may include, for example, a keyboard and a pointing device, wherein the pointing device may include a touch pad or a touch screen, etc. The I/O devices may be built-in components of the computer device 603, or may be devices externally connected to the computing device.
处理器602也可以通过系统互连链接到适于将计算机设备603连接到显示设备的显示接口。显示设备可以包括作为计算机设备603的内置组件的显示屏。显示设备还可以包括外部连接到计算机设备603的计算机监视器、电视机或投影仪等。此外,网络接口控制器(network interface controller,NIC)可以适于通过系统互连将计算机设备603连接到网络。在一些实施例中,NIC可以使用任何合适的接口或协议(诸如因特网小型计算机系统接口等)来传输数据。网络可以是蜂窝网络、无线电网络、广域网(WAN))、局域网(LAN)或因特网等等。远程设备可以通过网络连接到计算设备。Processor 602 can also be linked to a display interface suitable for connecting computer device 603 to a display device through a system interconnection. Display device can include a display screen as a built-in component of computer device 603. Display device can also include a computer monitor, a television or a projector, etc., which are externally connected to computer device 603. In addition, a network interface controller (NIC) can be suitable for connecting computer device 603 to a network through a system interconnection. In some embodiments, NIC can use any suitable interface or protocol (such as an Internet small computer system interface, etc.) to transmit data. The network can be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN) or the Internet, etc. Remote devices can be connected to computing devices through a network.
本实施例提供的流程图并不旨在指示方法的操作将以任何特定的顺序执行,或者方法的所有操作都包括在所有的每种情况下。此外,方法可以包括附加操作。在本实施例方法提供的技术思路的范围内,可以对上述方法进行附加的变化。The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical ideas provided by the present embodiment method, additional changes may be made to the above method.
至此,本领域技术人员应认识到,虽然本文已详尽示出和描述了本发明的多个示例性实施例,但是,在不脱离本发明精神和范围的情况下,仍可根据本发明公开的内容直接确定或推导出符合本发明原理的许多其他变型或修改。因此,本发明的范围应被理解和认定为覆盖了所有这些其他变型或修改。At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and identified as covering all such other variations or modifications.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311241887.9A CN118193355A (en) | 2023-09-25 | 2023-09-25 | Code testing method, storage medium and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311241887.9A CN118193355A (en) | 2023-09-25 | 2023-09-25 | Code testing method, storage medium and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118193355A true CN118193355A (en) | 2024-06-14 |
Family
ID=91409097
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311241887.9A Pending CN118193355A (en) | 2023-09-25 | 2023-09-25 | Code testing method, storage medium and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118193355A (en) |
-
2023
- 2023-09-25 CN CN202311241887.9A patent/CN118193355A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230126651A1 (en) | Streamlined onboarding of offloading devices for provider network-managed servers | |
US10791056B2 (en) | Policy based service routing | |
CN106856434B (en) | Method and apparatus for access request conversion | |
US9489227B2 (en) | Apparatus and method for virtual desktop service | |
WO2019184164A1 (en) | Method for automatically deploying kubernetes worker node, device, terminal apparatus, and readable storage medium | |
CN114025021B (en) | Communication method, system, medium and electronic equipment crossing Kubernetes cluster | |
CN113055492A (en) | Control method and device for service gray scale link, computer equipment and storage medium | |
US20170041308A1 (en) | Dynamic identity switching | |
CN110011875B (en) | Dialing test method, device, equipment and computer-readable storage medium | |
CN106850324A (en) | Virtual network interface object | |
US11782748B2 (en) | Cloud shell extension framework | |
US10635789B1 (en) | Request authorization using recipe-based service coordination | |
CN110968400B (en) | Application program execution method and device, computer equipment and storage medium | |
CN111258627A (en) | Interface document generation method and device | |
CN111510444A (en) | Remote access method, system, server and access auxiliary component of container | |
US20080028034A1 (en) | Method for mapping an iscsi target name to a storage resource based on an initiator hardware class identifier | |
CN112860398A (en) | Data processing method, device, equipment and medium based on rule engine | |
US20250193193A1 (en) | Managed attestation service for compute instances | |
CN114039778A (en) | Request processing method, device, equipment and readable storage medium | |
US11539684B2 (en) | Dynamic authentication scheme selection in computing systems | |
CN112988385A (en) | Request processing method, device, system, storage medium and electronic equipment | |
US7350065B2 (en) | Method, apparatus and program storage device for providing a remote power reset at a remote server through a network connection | |
CN118193355A (en) | Code testing method, storage medium and device | |
CN116820958A (en) | An agent-based multi-environment automated testing method and system | |
US11487570B1 (en) | Efficient creation of endpoints for accessing services directly within a cloud-based system |
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 |