Software testing method based on distributed system, electronic device and storage medium
By using logical regions to identify and route request messages in a distributed system, the same set of test scripts can be used to test applications in different distributed systems. This solves the problem of the large workload of writing and maintaining multiple sets of test cases, and improves testing and deployment efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEBANK (CHINA)
- Filing Date
- 2021-06-21
- Publication Date
- 2026-04-24
AI Technical Summary
When using multiple distributed systems to test the same application, the workload of writing and maintaining multiple sets of test cases is significant.
By setting the correspondence between the distributed system identifier, logical region identifier, business system identifier, and address set in the configuration information, the business type, service identifier, and data of the test script are encapsulated as request messages. The message bus is then used to route the request to the corresponding address based on the logical region identifier, enabling the same set of test scripts to perform application testing on different distributed systems.
This reduces the workload of writing and maintaining multiple test cases, and improves application deployment efficiency and test script maintenance efficiency.
Smart Images

Figure CN113326201B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a software testing method, electronic device, and storage medium based on a distributed system. Background Technology
[0002] With the development of computer technology, more and more technologies (such as big data) are being applied in the financial field, and the traditional financial industry is gradually transforming into fintech. However, due to the security and real-time requirements of the financial industry, fintech also places higher demands on technology. In the fintech field, in order to quickly release new versions of applications, newly developed applications are usually deployed to multiple environments for testing. An environment refers to a minimal copy that integrates all the enterprise's online business systems, and an environment consists of a distributed system.
[0003] Since different environments are isolated from each other, and devices in different environments have different Internet Protocol addresses, in related technologies, when using multiple distributed systems to test the same application, a test process is set up for each distributed system, and a set of test cases is written for each distributed system's corresponding test process. The workload of writing and maintaining multiple sets of test cases is quite large. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a software testing method, electronic device, and storage medium based on a distributed system to solve the technical problem in the related art of writing and maintaining multiple sets of test cases when using multiple distributed systems to test the same application, which involves a large workload.
[0005] To achieve the above objectives, the technical solution of the present invention is implemented as follows:
[0006] This invention provides a software testing method based on a distributed system, comprising:
[0007] Receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, and a first application identifier;
[0008] The configuration information corresponding to the first application identifier carried in the first deployment request is determined from the configuration database; the configuration information includes the configuration correspondence between the identifier of the distributed system, the identifier of the business system, and the address set.
[0009] From the determined configuration information, determine the set of addresses corresponding to the business system identifier that matches the first business system identifier;
[0010] The installation package of the first application is sent based on each address in the determined address set;
[0011] When executing the first call instruction in the test script, the service type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message according to the set message format.
[0012] Replace the field value corresponding to the first set field in the first request message with the first logical region identifier determined during the execution of the test script to obtain the second request message, and send the second request message to the message bus.
[0013] Receive a response message carrying the service identifier distributed by the message bus; wherein,
[0014] The field value corresponding to the first set field represents the business type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application under test is deployed; the first logical region identifier included in the second request message is used by the message bus to route the second request message to any address in the address set corresponding to the first logical region identifier.
[0015] In the above scheme, the setting message format includes:
[0016] The first field is used to write the business type;
[0017] The second setting field is used to write the service identifier;
[0018] The third setting field is used to write the data included in the call instruction.
[0019] The method in the above scheme further includes:
[0020] Obtain the identifier of the first distributed system;
[0021] Based on the established correspondence between the identifier of the distributed system and the identifier of the logical region, the first logical region identifier corresponding to the identifier of the first distributed system is determined.
[0022] In the above scheme, obtaining the identifier of the first distributed system includes one of the following:
[0023] Obtain the identifier of the first distributed system selected through the test settings interface;
[0024] The identifier of the first distributed system is obtained from the configuration information of the test script by executing a scheduled task.
[0025] In the above scheme, the configuration information includes the correspondence between the identifier of the distributed system, the identifier of the logical region, the identifier of the business system, and the address set.
[0026] In the above scheme, the first deployment request further includes an identifier of the distributed system used to deploy the first application; determining the address set corresponding to the business system identifier matching the first business system identifier from the determined configuration information includes:
[0027] Based on the first business system identifier and the distributed system identifier carried in the first deployment request, the address set corresponding to the first deployment request is determined from the configuration information.
[0028] In the above scheme, before executing the test script, the method further includes:
[0029] Obtain at least one address and the installation package of a second application;
[0030] A second deployment request is sent to the first device; the second deployment request carries the at least one address information and the installation package of the second application; wherein,
[0031] The at least one address information is used by the first device to send the installation package of the second application.
[0032] This invention also provides an electronic device, comprising:
[0033] The first receiving unit is configured to receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, and a first application identifier;
[0034] The first determining unit is used to determine the setting configuration information corresponding to the first application identifier from the setting database; the setting configuration information includes the setting correspondence between the business system identifier and the address set;
[0035] The second determining unit is used to determine, from the determined setting configuration information, the address set corresponding to the business system identifier that matches the first business system identifier;
[0036] The first sending unit is used to send the installation package of the first application based on each address in the determined address set;
[0037] The encapsulation unit is used to encapsulate the business type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data in the first call instruction into a first request message according to a set message format when the first call instruction in the test script is executed.
[0038] The replacement unit is used to replace the field value corresponding to the first set field in the first request message with the first logical area identifier determined during the execution of the test script, to obtain the second request message, and to send the second request message to the message bus.
[0039] A receiving unit is configured to receive a response message carrying the service identifier distributed by the message bus; wherein, the field value corresponding to the first set field represents the service type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application under test is deployed; the first logical region identifier included in the second request message is used by the message bus to route the second request message to a device corresponding to any address in the address set corresponding to the first logical region identifier.
[0040] This invention also provides an electronic device, including: a processor and a memory for storing a computer program capable of running on the processor.
[0041] When the processor runs the computer program, it executes the steps of the software testing method based on the distributed system described above.
[0042] This invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described software testing method based on a distributed system.
[0043] In this embodiment of the invention, the configuration information stored in the database includes the mapping relationship between business system identifiers and address sets. The address information corresponding to the first business system identifier carried in the first deployment request can be determined from the configuration information. Since the first deployment request does not need to carry an IP address, the same process can be used to deploy the first application to different distributed systems, improving application deployment efficiency. When executing the first call instruction in the test script, the business type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message according to the set message format. The first setting field of the first request message only contains the business type and does not specify the first logical region number corresponding to the first distributed system where the application under test is deployed. If the first logical region number is determined during the execution of the test script, the field value corresponding to the first setting field in the first request message is replaced with the determined first logical region identifier to obtain a second request message. The second request message is then sent to the message bus so that the message bus can determine the corresponding IP address based on the first logical region identifier and send the second message based on the determined IP address. Since the logical region identifier, distributed system, and address set are in one-to-one correspondence, the message bus can determine the corresponding IP address based on the logical region identifier. The test script does not need to specify the IP addresses of each device in the distributed system where the application under test is deployed. Therefore, electronic devices can switch to different distributed systems to test the application under test by replacing different logical region identifiers. This allows electronic devices to use the same set of test scripts to test the application under test deployed in different distributed systems. Relevant personnel do not need to write and maintain multiple sets of test cases, which can improve the efficiency of writing and maintaining test scripts. Attached Figure Description
[0044] Figure 1 A schematic diagram illustrating the implementation process of software testing based on a distributed system provided in an embodiment of the present invention;
[0045] Figure 2 A schematic diagram illustrating the implementation process of software testing based on a distributed system, as provided in another embodiment of the present invention;
[0046] Figure 3 A schematic diagram illustrating the implementation process of software testing based on a distributed system, provided for an application embodiment of the present invention;
[0047] Figure 4 A schematic diagram of the structure of an electronic device provided in a further embodiment of the present invention;
[0048] Figure 5 This is a schematic diagram of the hardware composition structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0050] Figure 1 This is a schematic diagram illustrating the implementation flow of a software testing method based on a distributed system provided in an embodiment of the present invention, wherein the execution entities of the flow are electronic devices such as terminals and servers. Figure 1 The software testing methods shown include those for distributed systems:
[0051] Step 101: Receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, and a first application identifier.
[0052] Here, the first deployment request is used to request the deployment of the first application to the corresponding distributed system.
[0053] Step 102: Determine the configuration information corresponding to the first application identifier carried in the first deployment request from the configuration database; the configuration information includes the configuration correspondence between the business system identifier and the address set.
[0054] The database stores configuration information for multiple applications; the configuration information includes at least one business system identifier and at least one address set with corresponding configuration relationships.
[0055] The electronic device determines the configuration information corresponding to the first application identifier from the configuration database based on the configuration correspondence between the application identifier and the configuration information.
[0056] In practical applications, when developers create new applications or add new features to existing applications, testing is required. Developers can configure the application under test through a designated configuration interface. Once the electronic device receives the configuration information for the application under test, it associates the application identifier and the corresponding configuration information into a designated database. The configuration information includes the identifier of the distributed system, logical region information, business system identifiers, and the mapping relationship between the address (IP address) set. The logical region information includes the business type (or logical region name) and logical region identifier (or logical region ID). The address set refers to the set of IP addresses of the devices that make up the distributed system. Logical region identifiers can be divided by geographical region.
[0057] In some embodiments, the configuration information includes the mapping relationship between the identifier of the distributed system, the identifier of the logical region, the identifier of the business system, and the address set. That is, the configuration information includes the mapping relationship between at least one identifier of the distributed system, at least one identifier of the logical region, at least one identifier of the business system, and at least one address set.
[0058] For example, the configuration information stored in the database is shown in Table 1:
[0059] Table 1
[0060]
[0061]
[0062] In the table above, Rdcn corresponds to the business type. For example, Rdcn represents a private transfer business; M0, N0, K0 and L0 correspond to logical area identifiers.
[0063] Step 103: Determine the set of addresses corresponding to the business system identifier that matches the first business system identifier from the configuration information.
[0064] Based on the defined configuration information, the electronic device determines the set of addresses corresponding to the business system identifier that matches the first business system identifier.
[0065] Considering that the same application can be deployed to different distributed systems, and the configuration information corresponding to the same application includes the identifiers of at least two distributed systems, and different distributed system identifiers may correspond to the same business system, in order to determine the address set corresponding to the first deployment request more quickly and accurately so as to deploy the first application to the corresponding distributed system, in some embodiments, when the configuration information includes the correspondence between the distributed system identifier, logical region identifier, business system identifier, and address set, the first deployment request also includes the identifier of the distributed system used to deploy the first application; the step of determining the address set corresponding to the business system identifier matching the first business system identifier from the configuration information includes:
[0066] Based on the first business system identifier and the distributed system identifier carried in the first deployment request, the address set corresponding to the first deployment request is determined from the configuration information.
[0067] Here, when the electronic device determines the configuration information corresponding to the first application identifier, it determines the address set corresponding to the first deployment request from the configuration information based on the configuration correspondence included in the configuration information, as well as the first business system identifier and the distributed system identifier carried in the first deployment request.
[0068] It should be noted that if the first deployment request does not carry the identifier of the distributed system, it means that the distributed system is not specified, and the first application is deployed to all devices corresponding to all address sets corresponding to the first business system identifier, thereby achieving the deployment of the first application to all distributed systems corresponding to the first business system identifier.
[0069] Step 104: Send the installation package of the first application based on each address in the determined address set.
[0070] The electronic device sends an installation package of the first application carried in the first deployment request based on each address in the determined address set, so that the device receiving the installation package of the first application can install the first application.
[0071] In this embodiment, the first deployment request does not need to carry an IP address. Therefore, the first application can be deployed to different distributed systems using the same process, which can improve application deployment efficiency.
[0072] Step 105: When executing the first call instruction in the test script, according to the set message format, the service type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message.
[0073] Here, when the electronic device receives at least one test script corresponding to the application under test and detects the set start test operation, it executes the test instructions in the test script to test the set functions of the application under test and verify whether the test results are consistent with the set results. The test script is the test script corresponding to the automated test cases.
[0074] The application under test includes a first application deployed to the distributed system using the methods described in steps 101 to 104, and may also include a second application deployed to the distributed system using other methods, such as deployment to the distributed system via other electronic devices.
[0075] In practical applications, the same set of test scripts is used to test the same application under test deployed in at least two different distributed systems. Each distributed system constitutes a test environment, and each distributed system consists of multiple business systems; one subsystem can correspond to one cluster. A set of test scripts includes at least one test script, and each test script is used to test at least one configured function of the first application.
[0076] During the execution of test instructions included in the test script, the electronic device determines whether the currently executed test instruction is the first calling instruction and obtains the determination result. In practical applications, when the electronic device detects that the currently executed test instruction includes a setting flag, it determines the currently executed test instruction as the first calling instruction.
[0077] If the judgment result indicates that the currently executed test instruction is the first call instruction, the service type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message according to the set message format.
[0078] The test script includes configuration information and test instructions. The configuration information includes at least the test script identifier and the business type of the first service corresponding to the function under test. The first invocation instruction represents an instruction to invoke any service provided by any business system in the distributed system. The first invocation instruction includes the service identifier and related data of the service being invoked.
[0079] In some embodiments, the setting message format includes:
[0080] The first field is used to write the business type;
[0081] The second setting field is used to write the service identifier;
[0082] The third setting field is used to write the data included in the call instruction, which includes the data requested and may also include input parameters.
[0083] In practical applications, the first field is named targetDCN; the second field is named Service ID; and the third field is named Data. The first request message is as follows:
[0084] Message Fields Field value Second setting field 10000256 First setting field Rdcn Third setting field Data
[0085] The service identifier is 10000256; the business type identifier is Rdcn.
[0086] Step 106: Replace the field value corresponding to the first set field in the first request message with the first logical region identifier determined during the execution of the test script to obtain the second request message, and send the second request message to the message bus.
[0087] Wherein, the field value corresponding to the first set field represents the business type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application under test is deployed; the first logical region identifier included in the second request message is used by the message bus to route the second request message to any address in the address set corresponding to the first logical region identifier.
[0088] Here, during the execution of the test script, the electronic device determines the first logical region identifier. Having determined the first logical region identifier and received the first request message, it replaces the field value corresponding to the first set field in the first request message with the determined first logical region identifier, thus obtaining a second request message, which is then sent to the message bus. It should be noted that at this point, the electronic device uses the test script to test the application under test deployed in the first distributed system.
[0089] The electronic device can obtain the identifier of the first logical region selected by the tester, or it can obtain the identifier of the first logical region through other means; the method of obtaining the identifier of the first logical region is not limited here. In practical applications, the tester can select the identifier of the first logical region while the electronic device is executing the test script, or the electronic device can be triggered to start executing the test script after the identifier of the first logical region has been selected.
[0090] In some embodiments, when the determined first logical region identifier is M0, the second request message is as follows:
[0091] Message Fields Field value Second setting field 10000256 First setting field M0 Third setting field Data
[0092] In practical applications, when the first field name is targetDCN, the second field name is Service ID, and the third field name is Data, the second request message is: {"serviceId":"01300181","targetDCN":"M0","input":{"data":"data"}}.
[0093] After the electronic device sends the second request message to the message bus, the message bus determines the first address set corresponding to the first logical region identifier from the first predefined correspondence based on the first logical region identifier in the second request message. The message bus routes the second request message to the device corresponding to any address in the determined first address set, triggering the device to process the second request message. Based on the processing result and the service identifier included in the second request message, the device sends a response message corresponding to the second request message to the message bus. Upon receiving the response message corresponding to the second request message, the message bus sends the response message corresponding to the second request message to the electronic device that sent the second request message, based on the service identifier carried in the response message.
[0094] In practical applications, the first configuration mapping represents the configuration mapping between logical region identifiers and address sets. The message bus accesses the configuration database and determines the first address set corresponding to the first logical region identifier from the configuration information stored in the database. The configuration information is shown in Table 1 above. When the configuration information includes the configuration mapping between the identifier of the distributed system, the logical region identifier, the business system identifier, and the address set, the electronic device can determine the first address set corresponding to the first logical region identifier from the configuration information corresponding to the first application.
[0095] To save testers time in finding or selecting the first logical region identifier and thus improve the efficiency of automated testing, in some embodiments, the electronic device may also determine the first logical region identifier in the following ways:
[0096] Obtain the identifier of the first distributed system;
[0097] Based on the established correspondence between the identifier of the distributed system and the identifier of the logical region, the first logical region identifier corresponding to the identifier of the first distributed system is determined.
[0098] Here, the electronic device can obtain the identifier of the first distributed system selected by the tester; when the configuration information in the test script also includes the identifier of the first distributed system, the electronic device can also obtain the identifier of the first distributed system from the configuration information in the test script.
[0099] When the electronic device obtains the identifier of the first distributed system, it determines the first logical area identifier corresponding to the identifier of the first distributed system based on the established correspondence between the identifier of the distributed system and the logical area identifier.
[0100] In practical applications, electronic devices access the configuration database to determine the first logical region identifier corresponding to the identifier of the first distributed system. The configuration database stores the configuration correspondence between the identifiers of distributed systems and the logical region identifiers.
[0101] In practical applications, when the configuration information stored in the configuration database includes the configuration correspondence between the identifier of the distributed system, the identifier of the logical region, the identifier of the business system, and the address set, the electronic device can determine the target business system identifier corresponding to the service identifier included in the first call instruction based on the configuration correspondence between the service identifier and the business system identifier. Based on the obtained identifier of the first distributed system and the target business system identifier, the corresponding first logical region identifier can be determined from the configuration information corresponding to the first application.
[0102] Considering that testers can manually select the identifier of the first distributed system, and test script writers can also write the identifier of the first distributed system into the configuration information of the test specimen, in some instances, obtaining the identifier of the first distributed system includes one of the following:
[0103] Obtain the identifier of the first distributed system selected or entered through the test interface;
[0104] The identifier of the first distributed system is obtained from the configuration information of the test script by executing a scheduled task.
[0105] Here, when the electronic device is testing the application under test deployed in the first distributed system, it obtains the identifier of the first distributed system selected or entered by the tester through the test interface, and passes the obtained identifier of the first distributed system to a set of test scripts corresponding to the application under test.
[0106] The configuration information in the test script may also include the identifier of the first distributed system. When the electronic device tests the application under test deployed in the first distributed system, it obtains the identifier of the first distributed system from the configuration information in the test script by executing a scheduled task.
[0107] Step 107: Receive the response message carrying the service identifier distributed by the message bus.
[0108] Electronic devices receive response messages distributed by the message bus based on service identifiers.
[0109] In this embodiment of the invention, when executing the first call instruction in the test script, the service type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message according to the set message format. The first setting field of the first request message only contains the service type and does not specify the first logical region number corresponding to the first distributed system where the application under test is deployed. When the first logical region number is determined during the execution of the test script, the field value corresponding to the first setting field in the first request message is replaced with the determined first logical region identifier to obtain a second request message. The second request message is then sent to the message bus so that the message bus can determine the corresponding IP address based on the first logical region identifier and send the second message based on the determined IP address. Since the logical region identifier corresponds one-to-one with the distributed system and the address set, the message bus can determine the corresponding IP address based on the logical region identifier. The test script does not need to specify the IP addresses of each device in the distributed system where the application under test is deployed. Therefore, electronic devices can switch to different distributed systems to test the application under test by replacing different logical region identifiers. This allows electronic devices to use the same set of test scripts to test the application under test deployed in different distributed systems. Relevant personnel do not need to write and maintain multiple sets of test cases, which can improve the efficiency of writing and maintaining test scripts.
[0110] In practical applications, testers can use other devices to uniformly deploy the application under test to different distributed systems. Figure 2 A schematic diagram illustrating the implementation flow of a software testing method based on a distributed system provided in another embodiment of the present invention is shown. Figure 2 The corresponding embodiments and in Figure 1 The difference in the corresponding embodiment is that, before executing the test script, the method further includes:
[0111] Step 201: Obtain at least one address information and the installation package of the second application; wherein, the at least one address information is used for the first device to send the installation package of the second application.
[0112] The electronic device acquires at least one address information input or selected by the tester, as well as the installation package of the second application selected by the tester. The at least one address information corresponds to the address of the distributed system where the second application needs to be deployed.
[0113] Step 202: Send a second deployment request to the first device; the second deployment request carries the at least one address information and the installation package of the second application.
[0114] Upon obtaining at least one address information and an installation package for a second application, an electronic device sends a second deployment request to a first device. The second deployment request carries the obtained address information and the installation package for the second application. Upon receiving the second deployment request, the first device sends the installation package for the second application based on each address information carried in the second deployment request, thereby enabling devices in the corresponding distributed system to install the second application upon receiving the installation package.
[0115] The implementation process of steps 203 to 205 is described in detail in steps 105 to 107, and will not be repeated here. It should be noted that since the application under test is the second application at this point, after the electronic device executes step 205, and then executes step 107, the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the second application is deployed.
[0116] In this embodiment, when the electronic device obtains at least one address information and the installation package of the second application, it sends a second deployment request to the first device to distribute the installation package of the second application through the first device, thereby deploying the second application to different distributed systems. This can reduce the amount of data processing by the electronic device executing the test script and improve the data processing speed of the electronic device executing the test script.
[0117] Figure 3 This diagram illustrates the implementation flow of the software testing method based on a distributed system provided in an application embodiment of the present invention. Figure 3 The software testing methods shown include those for distributed systems:
[0118] Step 301: Receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, a first application identifier, and an identifier of a first distributed system used to deploy the first application.
[0119] Here, the first deployment request is used to request the deployment of the first application to the corresponding distributed system.
[0120] Step 302: Determine the configuration information corresponding to the first application identifier carried in the first deployment request from the configuration database; the configuration information includes the configuration correspondence between the identifier of the distributed system, the identifier of the logical region, the identifier of the business system, and the address set.
[0121] The implementation process of step 302 is described in step 102, and will not be repeated here.
[0122] Step 303: Based on the identifier of the first business system and the identifier of the first distributed system, determine the set of addresses corresponding to the first deployment request from the configuration information.
[0123] The implementation process of step 303 is described in the relevant description of step 103, and will not be repeated here.
[0124] Step 304: Send the installation package of the first application based on each address in the determined address set.
[0125] Step 305: When executing the first call instruction in the test script, according to the set message format, the service type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message.
[0126] In this process, the electronic device executes a test script to test the first application in the first distributed system.
[0127] Step 306: When executing the test script, obtain the identifier of the first distributed system.
[0128] Steps 306 and 305 can be executed simultaneously.
[0129] Step 307: Based on the identifier of the first distributed system and the target business system identifier corresponding to the first service identifier, determine the first logical region identifier from the configuration information.
[0130] Step 308: Replace the field value corresponding to the first setting field in the first request message with the determined first logical area identifier to obtain the second request message, and send the second request message to the message bus.
[0131] Wherein, the field value corresponding to the first set field represents the service type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application to be tested is deployed; the first logical region identifier included in the second request message is used for the message bus to route the second request message to the device corresponding to any address in the address set determined based on the first set correspondence; the first set correspondence represents the set correspondence between the logical region identifier and the address set.
[0132] Step 309: Receive the response message carrying the service identifier distributed by the message bus.
[0133] To implement the software testing method based on a distributed system according to the embodiments of the present invention, the embodiments of the present invention also provide an electronic device, such as... Figure 4 As shown, the electronic device includes:
[0134] The first receiving unit 41 is configured to receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, and a first application identifier;
[0135] The first determining unit 42 is used to determine the setting configuration information corresponding to the first application identifier from the setting database; the setting configuration information includes the setting correspondence between the business system identifier and the address set.
[0136] The second determining unit 43 is used to determine, from the determined setting configuration information, the address set corresponding to the business system identifier that matches the first business system identifier;
[0137] The first sending unit 44 is used to send the installation package of the first application based on each address in the determined address set; the encapsulation unit 45 is used to encapsulate the service type included in the configuration information of the test script, the service identifier included in the first calling instruction, and the data in the first calling instruction into a first request message according to a set message format when the first calling instruction in the test script is executed.
[0138] Replacement unit 46 is used to replace the field value corresponding to the first set field in the first request message with the first logical area identifier determined during the execution of the test script, to obtain a second request message, and send the second request message to the message bus.
[0139] The second receiving unit 47 is configured to receive a response message carrying the service identifier distributed by the message bus; wherein,
[0140] The field value corresponding to the first set field represents the business type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application under test is deployed; the first logical region identifier included in the second request message is used by the message bus to route the second request message to any address in the address set corresponding to the first logical region identifier.
[0141] In some embodiments, the setting message format includes:
[0142] The first field is used to write the business type;
[0143] The second setting field is used to write the service identifier;
[0144] The third setting field is used to write the data included in the call instruction.
[0145] In some embodiments, the electronic device further includes:
[0146] The first acquisition unit is used to acquire the identifier of the first distributed system;
[0147] The third determining unit is used to determine the first logical region identifier corresponding to the identifier of the first distributed system based on the established correspondence between the identifier of the distributed system and the identifier of the logical region.
[0148] In some embodiments, the first acquisition unit is specifically used for one of the following:
[0149] Obtain the identifier of the first distributed system selected or entered through the test interface;
[0150] The identifier of the first distributed system is obtained from the configuration information of the test script by executing a scheduled task.
[0151] In some embodiments, the configuration information includes the mapping relationship between the identifier of the distributed system, the identifier of the logical region, the identifier of the business system, and the address set.
[0152] In some embodiments, the first deployment request further includes an identifier of the distributed system for deploying the first application; the second determining unit 43 is specifically used to: determine the address set corresponding to the first deployment request from the setting configuration information based on the first business system identifier and the identifier of the distributed system carried in the first deployment request.
[0153] In some embodiments, the electronic device further includes:
[0154] The second acquisition unit is used to acquire at least one address information and the installation package of the second application before executing the test script;
[0155] The second sending unit is configured to send a second deployment request to the first device; the second deployment request carries the at least one address information and an installation package of the second application; wherein...
[0156] The at least one address information is used by the first device to send the installation package of the second application.
[0157] In practical applications, the various units included in an electronic device can be implemented by a processor in the electronic device, such as a central processing unit (CPU), a digital signal processor (DSP), a microcontroller unit (MCU), or a field-programmable gate array (FPGA), or by a processor and a communication interface in the electronic device.
[0158] It should be noted that the above embodiments of the electronic device are only illustrated by the division of the above program modules when performing software testing based on a distributed system. In practical applications, the above processing can be distributed to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the processing described above. In addition, the electronic device provided in the above embodiments and the software testing method embodiments based on a distributed system belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0159] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of the present invention, the embodiments of the present invention also provide an electronic device. Figure 5 This is a schematic diagram of the hardware composition structure of the electronic device according to an embodiment of the present invention, such as... Figure 5 As shown, electronic device 5 includes:
[0160] The communication interface 51 is capable of exchanging information with other devices, such as network devices;
[0161] The processor 52 is connected to the communication interface 51 to enable information interaction with other devices and, when running a computer program, executes the software testing method based on a distributed system provided by one or more of the above-mentioned technical solutions. The computer program is stored in the memory 53.
[0162] Of course, in practical applications, the various components in electronic device 5 are coupled together through bus system 54. It can be understood that bus system 54 is used to realize the connection and communication between these components. In addition to the data bus, bus system 54 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in... Figure 5 The general labeled all buses as Bus System 54.
[0163] The memory 53 in this embodiment of the invention is used to store various types of data to support the operation of the electronic device 5. Examples of such data include any computer program used to operate on the electronic device 5.
[0164] It is understood that memory 53 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 53 described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0165] The methods disclosed in the above embodiments of the present invention can be applied to processor 52, or implemented by processor 52. Processor 52 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 52 or by instructions in software form. The processor 52 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 52 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of the present invention can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 53. Processor 52 reads the program in memory 53 and completes the steps of the aforementioned method in conjunction with its hardware.
[0166] Optionally, when the processor 52 executes the program, it implements the corresponding processes implemented by the terminal in the various methods of the embodiments of the present invention. For the sake of brevity, these will not be described in detail here.
[0167] In an exemplary embodiment, the present invention also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a first memory 53 storing a computer program, which can be executed by a processor 52 of a terminal to complete the steps described in the aforementioned method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.
[0168] In the several embodiments provided by this invention, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0169] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0170] In addition, in the various embodiments of the present invention, each functional unit can be integrated into one processing module, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0171] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0172] It should be noted that the technical solutions described in the embodiments of the present invention can be combined arbitrarily without conflict.
[0173] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A software testing method based on distributed systems, characterized in that, include: Receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, and a first application identifier; The configuration information corresponding to the first application identifier is determined from the configuration database; the configuration information includes the configuration correspondence between the business system identifier and the address set. From the determined configuration information, determine the set of addresses corresponding to the business system identifier that matches the first business system identifier; The installation package of the first application is sent based on each address in the determined address set; When executing the first call instruction in the test script, the service type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data are encapsulated into a first request message according to the set message format. Replace the field value corresponding to the first set field in the first request message with the first logical region identifier determined during the execution of the test script to obtain the second request message, and send the second request message to the message bus. Receive a response message carrying the service identifier distributed by the message bus; wherein, The field value corresponding to the first set field represents the business type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application under test is deployed; the first logical region identifier included in the second request message is used by the message bus to route the second request message to any address in the address set corresponding to the first logical region identifier.
2. The method according to claim 1, characterized in that, The configuration message format includes: The first field is used to write the business type; The second setting field is used to write the service identifier; The third setting field is used to write the data included in the call instruction.
3. The method according to claim 1, characterized in that, The method further includes: Obtain the identifier of the first distributed system; Based on the established correspondence between the identifier of the distributed system and the identifier of the logical region, the first logical region identifier corresponding to the identifier of the first distributed system is determined.
4. The method according to claim 3, characterized in that, Obtaining the identifier of the first distributed system includes one of the following: Obtain the identifier of the first distributed system selected or entered through the test interface; The identifier of the first distributed system is obtained from the configuration information of the test script by executing a scheduled task.
5. The method according to claim 1, characterized in that, The configuration information includes the mapping relationship between the identifier of the distributed system, the identifier of the logical region, the identifier of the business system, and the address set.
6. The method according to claim 5, characterized in that, The first deployment request also includes an identifier of the distributed system used to deploy the first application; The step of determining the set of addresses corresponding to the business system identifier that matches the first business system identifier from the determined configuration information includes: Based on the first business system identifier and the distributed system identifier carried in the first deployment request, the address set corresponding to the first deployment request is determined from the configuration information.
7. The method according to any one of claims 1 to 4, characterized in that, Before executing the test script, the method further includes: Obtain at least one address and the installation package of a second application; A second deployment request is sent to the first device; the second deployment request carries the at least one address information and the installation package of the second application; wherein, The at least one address information is used by the first device to send the installation package of the second application.
8. An electronic device, characterized in that, include: The first receiving unit is configured to receive a first deployment request; wherein the first deployment request carries a first business system identifier, an installation package of a first application, and a first application identifier; The first determining unit is used to determine the setting configuration information corresponding to the first application identifier from the setting database; the setting configuration information includes the setting correspondence between the business system identifier and the address set. The second determining unit is used to determine, from the determined setting configuration information, the address set corresponding to the business system identifier that matches the first business system identifier; The first sending unit is used to send the installation package of the first application based on each address in the determined address set; The encapsulation unit is used to encapsulate the business type included in the configuration information of the test script, the service identifier included in the first call instruction, and the data into a first request message according to a set message format when the first call instruction in the test script is executed. The replacement unit is used to replace the field value corresponding to the first set field in the first request message with the first logical area identifier determined during the execution of the test script, to obtain the second request message, and to send the second request message to the message bus. The second receiving unit is configured to receive a response message carrying the service identifier distributed by the message bus; wherein, the field value corresponding to the first setting field represents the service type; the first logical region identifier represents the logical region identifier corresponding to the first distributed system where the application under test is deployed; the first logical region identifier included in the second request message is used by the message bus to route the second request message to any address in the address set corresponding to the first logical region identifier.
9. An electronic device, characterized in that, include: The processor and the memory used to store computer programs that can run on the processor. When the processor is used to run the computer program, it performs the steps of the method according to any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method for constructing test framework of aviation schematic diagram sheet software
CN103942139A
Calling method and device
CN110704296A