Test support apparatus and test support method
The test support device facilitates efficient testing of Microservice Architecture systems by generating state transition and correspondence tables to create comprehensive test scenarios and contracts, addressing the inefficiencies in existing testing methods.
Patent Information
- Application Number
- JP2023114960
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-07-13
- Publication Date
- 2025-01-24
AI Technical Summary
Existing testing technologies are inefficient for systems using Microservice Architecture (MSA) as they do not account for the state transitions and interactions between multiple services, making it difficult to perform comprehensive testing.
A test support device and method that generate state transition information, test scenarios, and contract tests considering the interactions between individual services, using state transition tables and correspondence tables to create test scenarios and stateful contracts.
Enables efficient and easy testing of services composed of multiple microservices by accounting for their state transitions and interactions, ensuring data integrity and identifying potential abnormal events.
Smart Images

Figure 2025012247000001_ABST
Abstract
Description
[Technical field]
[0001] The present disclosure relates to a test support device and a test support method. [Background technology]
[0002] When developing or updating a system such as a service providing system that provides a service, it is important to test whether the service operates normally. However, in recent years, services have become larger in scale and more complex, making it difficult to perform appropriate testing.
[0003] In response to this, Patent Document 1 discloses a verification information generating device that generates test cases, which are verification information used to test a service. This verification information generating device uses state transition pair information that associates each state of the service with transitions that can be executed from those states, selects transitions with a high transition frequency, and generates test cases using the selected transitions. This makes it possible to efficiently test the service. [Prior art documents] [Patent documents]
[0004] [Patent Document 1] JP 2020-9271 A Summary of the Invention [Problem to be solved by the invention]
[0005] In recent years, a system development technique called MSA (Microservice Architecture) has been attracting attention. In MSA, a single service is constructed from a collection of multiple individual services, also called microservices, with different functions. This makes it possible to parallelize system development.
[0006] However, at the system development stage, the correspondence between the state transitions of an individual service to be tested and the state transitions of another individual service linked to that individual service is not self-evident. The technology described in Patent Document 1 does not take into consideration the case where multiple services such as MSA are linked to form one service, and only uses state transition pair information that associates states and transitions in a single service. For this reason, when multiple services are linked to form one service, testing cannot be performed efficiently.
[0007] An object of the present disclosure is to provide a test support device and a test support method that make it possible to easily perform testing even when a service is composed of multiple individual services. [Means for solving the problem]
[0008] A test support device according to one aspect of the present disclosure is a test support device that supports a test regarding maintenance of data consistency in a specified service composed of a plurality of individual services, and includes: a scenario generation unit that generates, based on state transition information indicating state transitions occurring in each of the plurality of individual services and correspondence information indicating a correspondence between the state transitions in each of the plurality of individual services and a trigger event that triggers a state transition of another of the individual services caused by the state transition, a test scenario indicating a target transition pattern that is a state transition pattern of a target service that is one of the plurality of individual services, and a destination transition pattern of a state transition of a destination service that is an individual service different from the target service and that occurs in conjunction with the target transition pattern; a contract generation unit that generates, based on the test scenario, a stateful contract that is a contract that specifies a response of the destination service taking into account the destination transition pattern; and a program generation unit that generates a contract test program that is a program for performing the test, based on the test scenario and the stateful contract. Effect of the Invention
[0009] According to the present invention, even when a service is composed of a plurality of individual services, testing can be easily performed. [Brief description of the drawings]
[0010] [Figure 1] FIG. 2 illustrates an example of a functional configuration of a test support device. [Diagram 2] FIG. 2 illustrates an example of a hardware configuration of a test support device. [Diagram 3] FIG. 13 is a diagram showing an example of a state transition table editing screen. [Figure 4] FIG. 13 is a diagram showing an example of a state transition correspondence table editing screen. [Diagram 5] 11 is a flowchart illustrating an example of a test support process. [Figure 6] FIG. 11 is a diagram for explaining an example of data related to the test support process. [Figure 7] 11 is a flowchart illustrating an example of a test scenario expansion process. [Figure 8] FIG. 11 is a diagram for explaining an example of data related to a test scenario expansion process. [Figure 9] 13 is a flowchart illustrating an example of a policy presentation process. [Figure 10] 11 is a diagram for explaining an example of data related to a policy presentation process. FIG. [Figure 11] 11 is a diagram for explaining an example of a process for generating a state transition correspondence table. FIG. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0011] Hereinafter, embodiments of the present disclosure will be described with reference to the drawings.
[0012] Fig. 1 is a diagram illustrating an example of a functional configuration of a test support device according to an embodiment of the present disclosure. The test support device 1 illustrated in Fig. 1 is a device that supports testing of a system that provides a specific service, and is communicatively connected to a target service device 2 and a destination service device 3. The test in this embodiment is a test related to maintaining data consistency. There may be multiple destination service devices 3.
[0013] The target service device 2 and the destination service device 3 constitute a system that provides a specific service. In this embodiment, the system is constructed by MSA. That is, the system, more specifically, the services provided by the system, are composed of a collection of multiple individual services also called microservices. The target service device 2 is a device that provides a test target service that is a test target by the test support device 1 among the multiple individual services that constitute the system, and the destination service device 3 is a device that provides a destination service that is an individual service different from the test target service among the multiple services that constitute the system. The target service device 2 has a service management unit 21 that manages the test target service, and the destination service device 3 has a service management unit 31 that provides the destination service.
[0014] The test support device 1 has a state transition table storage unit 11, a state transition correspondence table storage unit 12, a state transition table management unit 13, a state transition correspondence table management unit 14, a test scenario generation unit 15, a stateful contract generation unit 16, a test program generation unit 17, and a test program execution unit 18.
[0015] The state transition table storage unit 11 stores a state transition table for each of a plurality of individual services. The state transition table is state transition information indicating state transitions of the individual services, and more specifically indicates the correspondence between each state that the individual service can take, another state to which the individual service transitions from that state, and a trigger event that triggers the transition.
[0016] The state transition correspondence table storage unit 12 stores a state transition correspondence table relating to a plurality of individual services. The state transition correspondence table is correspondence information indicating the correspondence between a state transition in each of the plurality of individual services and a trigger event that is a trigger for a state transition of a connected service that occurs due to the state transition.
[0017] The state transition table management unit 13 manages the state transition table stored in the state transition table storage unit 11. For example, the state transition table management unit 13 accepts a state transition table from a user who uses the test support device 1 and stores it in the state transition table storage unit 11.
[0018] The state transition correspondence table management unit 14 is a correspondence information management unit that manages the state transition correspondence table stored in the state transition correspondence table storage unit 12. For example, the state transition correspondence table management unit 14 accepts a state transition correspondence table from a user and stores it in the state transition correspondence table storage unit 12.
[0019] Based on the state transition table stored in the state transition table storage unit 11 and the state transition correspondence table stored in the state transition correspondence table storage unit 12, the test scenario generation unit 15 generates a test scenario indicating the state transition pattern of the service to be tested (target transition pattern) and the state transition pattern of the destination service associated with that state transition pattern (destination transition pattern).
[0020] The stateful contract generation unit 16 generates a stateful contract, which is a contract (Pact) that describes the behavior (response) of the destination service taking into account the state transition pattern of the destination service, based on the test scenario generated by the test scenario generation unit 15.
[0021] The test program generation unit 17 generates a test program (contract test program) which is a program for testing the maintenance of data consistency of the test target service, based on the test scenario generated by the test scenario generation unit 15 and the stateful contract generated by the stateful contract generation unit 16.
[0022] The test program execution unit 18 performs testing by executing the test program generated by the test program generation unit 17, and based on the test execution results, proposes measures for modifying the program to provide the service being tested.
[0023] Fig. 2 is a diagram showing an example of a hardware configuration of the test support device 1. As shown in Fig. 2, the test support device 1 includes a storage 101, a CPU (Central Processing Unit) 102, a main memory 103, a keyboard 104, a mouse 105, a display 106, and a NIC (Network Interface Card) 107.
[0024] Storage 101 is a recording device that records data in a writable and readable manner, and records a program that defines the operation of CPU 102, and various information used and generated by the program. CPU 102 is an example of a processor, and realizes various functions by reading the program recorded in storage 101 into main memory 103 and executing it using main memory 103. In this embodiment, storage 101 or main memory 103 realizes state transition table storage unit 11 and state transition correspondence table storage unit 12, and CPU 102 realizes other units (13 to 18) of the test support device.
[0025] The keyboard 104 and the mouse 105 constitute input devices that receive various information from a user. The display 106 is a display device that displays various information. The NIC 107 is a communication device that is communicatively connected to the target service device 2 and the destination service device 3, which are external devices.
[0026] Like the test support device 1, the target service device 2 and the connection destination service device 3 each include a storage 201, a CPU 202, a main memory 203, a keyboard 204, a mouse 205, a display 206, and a NIC 207.
[0027] Fig. 3 is a diagram showing an example of a state transition table editing screen for a user to input and edit a state transition table. A state transition table editing screen 300 shown in Fig. 3 is a screen displayed by the state transition table management unit 13, and has a service selection field 301, an editing field 302, and a registration button 303.
[0028] The service selection field 301 is an interface for selecting an individual service for which a state transition table is to be input or edited as a service to be edited. In the example of FIG. 3, the service to be tested is selected as the service to be varied. The edit field 302 is an interface for editing the state transition table of the service to be edited selected in the service selection field 301, and in the example of FIG. 3, the state transition table after editing is shown. The register button 303 is an interface for registering the state transition table input or edited in the edit field 302. When the register button 303 is pressed, the state transition table management unit 13 stores the state transition table input or edited in the edit field 302 in the state transition table storage unit 11.
[0029] 4 is a diagram showing an example of a state transition correspondence table editing screen for a user to input and edit a state transition correspondence table. A state transition correspondence table editing screen 400 shown in FIG. 4 is a screen displayed by the state transition correspondence table management unit 14, and has an edit field 401 and a register button 402.
[0030] 4 shows the state transition correspondence table after editing. The register button 402 is an interface for registering the state transition correspondence table input or edited in the edit field 401. When the register button 402 is pressed, the state transition correspondence table management unit 14 stores the state transition correspondence table input or edited in the edit field 401 in the state transition correspondence table storage unit 12.
[0031] FIG. 5 is a flowchart illustrating an example of the test support process performed by the test support device 1, and FIG. 6 is a diagram illustrating an example of data related to the test support process.
[0032] 5 and 6, the test target service is a travel reservation service, and the destination service is a hotel reservation service. As shown in Fig. 6, a state transition table 601 of the test target service (travel reservation service) and a state transition table 602 of the destination service (hotel reservation service) are registered in advance in the state transition table storage unit 11 as state transition tables, and a state transition correspondence table 603 is registered in the state transition correspondence table storage unit 12 as a state transition correspondence table.
[0033] In the state transition table (601, 602) shown in Fig. 6, a column indicates a state before a transition, a row indicates a trigger event that triggers a state transition, and a field where a column and a row intersect stores a state after the state corresponding to the column transitions due to a trigger event corresponding to the row. For example, in state transition table 601, when the state is "waiting", if the trigger event "travel reservation" occurs, the state transitions to "hotel reservation". Also, in state transition table 602, when the state is "no reservation", if the trigger event "reservation" occurs, the state transitions to "reserved".
[0034] 6 shows the correspondence between state transitions in an individual service and trigger events that trigger state transitions in other individual services that occur as a result of the state transitions. Specifically, state transition correspondence table 603 shows that when a state transition occurs in the travel reservation service (travel reservation) where the state transition changes from "standby" to "hotel reservation", a trigger event "reservation" occurs in the hotel reservation service (hotel reservation). Furthermore, state transition correspondence table 603 shows that when a state transition occurs in the hotel reservation service from "no reservation" to "reserved", a trigger event "hotel reservation completed" occurs in the travel reservation service.
[0035] 5, in the test support process, the test scenario generation unit 15 first identifies possible state transition patterns for the service to be tested based on a state transition table 601 for the service to be tested stored in the state transition table storage unit 11, and generates a test scenario 604 including a test target column 611 that is a column indicating the state transition pattern (step S101). Note that, if there are multiple state transition patterns, the test scenario generation unit 15 may generate a test scenario 604 for each state transition pattern. Therefore, the test scenario generation unit 15 generates one or more test scenarios 604.
[0036] Next, the test scenario generating unit 15 executes a test scenario expanding process (step S102) for adding a destination column 612 indicating a destination service state transition pattern occurring in association with a state transition pattern indicated in a test target column 611 to the test scenario 604, based on a state transition table 602 for the destination service stored in the state transition table storage unit 11 and a state transition correspondence table 603 stored in the state transition correspondence table storage unit 12. Note that when there are multiple destination service state transition patterns occurring in association with the state transition patterns indicated in the test target column 611, multiple test scenarios 604 are generated with a destination column added for each destination service state transition pattern.
[0037] Thereafter, the stateful contract generating unit 16 extracts a test target sequence 611 from the test scenario 604, and generates a stateful contract 605 describing the response of the destination service taking into account the state transition pattern of the destination service based on the test target sequence 611 (step S103). The stateful contract 605 is a contract that involves state transitions, and more specifically, a contract that performs a previously specified response and changes the state (i.e., the response content) according to the state transition pattern.
[0038] Furthermore, the test program generation unit 17 generates, for each test scenario 604, a test program 606 that is a program for executing a test according to that test scenario, and associates the stateful contract 605 with the test program 606 to generate it as a contract test program (step S104).
[0039] Thereafter, the test program execution unit 18 executes the contract test program (the test program 606 linked to the stateful contract 605) to carry out a contract test on the service to be tested (step S105).
[0040] Then, the test program executing unit 18 executes a policy presenting process (see FIG. 9) for presenting a policy to the user based on the test execution result, which is the result of the contract test (step S106), and ends the process.
[0041] In the above process, the state transition correspondence table may further indicate the correspondence between the state transitions in each of the individual services and the events that occur due to the state transitions. In this case, the test scenario generator 15 expands the test scenario 604 in consideration of the events that occur in the test scenario expansion process in step S102.
[0042] Fig. 7 is a flow chart for explaining an example of a test scenario expansion process including a process for expanding the test scenario 604 in consideration of an occurring event, and Fig. 8 is a diagram for explaining an example of data related to this test scenario expansion process. Note that in Figs. 7 and 8, the occurring event is an abnormal event.
[0043] As shown in Fig. 8, state transition correspondence table 603a when abnormal events are taken into consideration has information indicating whether or not there is a possibility that an abnormal event will occur with the state transition of an individual service (presence or absence of abnormal event) added to state transition correspondence table 603 shown in Fig. 6. In addition, state transition correspondence table storage unit 12 further stores an event management table 607 that indicates the occurrence probability of an abnormal event of each type for each type of abnormal event.
[0044] In the test scenario expansion process, as shown in FIG. 7, the test scenario generation unit 15 adds a destination column 612 indicating the state transition pattern of the destination service that occurs in conjunction with the transition pattern indicated in the test target column 611 to the test scenario 604 based on the state transition table 602 for the destination service and the state transition correspondence table 603a (step S201).
[0045] After that, the test scenario generator 15 judges whether or not there is a possibility that an abnormal event will occur in the transition pattern of the test scenario 604 based on the state transition correspondence table 603a (step S202).
[0046] If there is a possibility that an abnormal event will occur (step S202: Yes), the test scenario generation unit 15 generates an expanded test scenario 608 as a new test scenario by expanding the test scenario 604 to include a state transition pattern when an abnormal event indicated in the event management table 607 occurs (step S203), and ends the process. On the other hand, if there is no possibility that an abnormal event will occur (step S202: No), the test scenario generation unit 15 skips the process of step S203 and ends the process.
[0047] FIG. 9 is a flowchart showing an example of the policy presentation process in step S106 of FIG. 5, and FIG. 10 is a diagram for explaining an example of data related to the policy presentation process.
[0048] 10, it is assumed that a test execution result 701 is generated as a test execution result that is a result of a contract test. The test execution result 701 indicates, for each identification number (#) 711 that identifies a test scenario 604, the name 712 of the test scenario 604, the presence or absence 713 of an abnormal event in the test scenario 604, the probability 714 of the occurrence of the abnormal event, the degree of parallelism 715 in the test scenario 604, and a test result 716 of the contract test corresponding to the test scenario 604. The test result 716 indicates "Pass" if the contract test is successful, and indicates "NG" if the contract test is unsuccessful.
[0049] Also, a measure management table 702 is prepared in advance. The measure management table 702 is registered in advance in, for example, the state transition table storage unit 11, the state transition correspondence table storage unit 12, or another storage unit (not shown), etc. For each identification number 721 that identifies a measure, the measure management table 702 indicates a type 722 of an abnormal event included in the test scenario 604, a degree of parallelism in the test scenario 604, a measure 723 for the test scenario 604, a prerequisite 724 that is a premise of the measure, and a priority 725 of the measure.
[0050] In the policy presentation process, as shown in FIG. 9, the test program execution unit 18 determines whether or not there is a failed test, which is a failed contract test, among the executed contract tests, based on the test execution result 701 (step S301).
[0051] If a failing test exists (step S301: YES), the test program execution unit 18 determines whether or not a measure exists that corresponds to a failure pattern, which is a test pattern that corresponds to the failing test, based on the measure management table 702 (step S302).
[0052] If a measure exists (step S302: YES), the test program execution section 18 presents the measure to the user (step S303) and ends the process.
[0053] If there is no failed test (step S301: NO) and if there is no measure (step S302: NO), the test program execution unit 18 ends the process.
[0054] The configuration and operation of the test support device 1 described above are merely examples and are not limited to these. For example, the state transition correspondence table management unit 14 may generate at least a part of the state transition correspondence table based on a source file of a program for providing the target service.
[0055] Fig. 11 is a diagram for explaining an example of a process for generating a state transition correspondence table. In the example of Fig. 11, the state transition correspondence table management unit 14 generates a state transition correspondence table 603 by analyzing annotations included in a source file 801 of a program for providing a travel reservation service, which is a target service.
[0056] As described above, according to this embodiment, the test scenario generation unit 15 generates a test scenario indicating a state transition pattern of a test target service and a state transition pattern of a destination service that occurs in association with the state transition pattern, based on a state transition table of each individual service and a state transition correspondence table indicating a correspondence between a state transition of each individual service and a trigger event that triggers a state transition of another individual service caused by the state transition. The stateful contract generation unit 16 generates a stateful contract that describes a response of the destination service, taking into account the transition pattern of the destination service. The test program generation unit 17 generates a contract test program, which is a program for performing a test, based on the test scenario and the stateful contract. This makes it possible to generate a contract test program that takes into account the correspondence of state transitions between each individual service based on the state transition correspondence table, making it possible to easily perform testing even when a service is composed of multiple individual services.
[0057] In this embodiment, the test scenario generator 15 generates a test scenario indicating a state transition pattern of a test target service based on the state transition table of the test target service, and adds the state transition pattern of the destination service to the test scenario based on the state transition table of the destination service and the state transition correspondence table. This makes it possible to more reliably generate a test pattern that takes into account the correspondence relationship of state transitions between individual services.
[0058] In this embodiment, the test scenario generator 15 generates an expanded test scenario that takes into account events that occur, such as abnormal events that occur with state transitions. This enables testing that takes abnormal events into account.
[0059] Furthermore, in this embodiment, measures for modifying a program to provide a service under test are presented based on the test execution results, making it possible to modify the program efficiently.
[0060] In this embodiment, the state transition correspondence table management unit 14 generates at least a part of the state transition correspondence table based on the source file of the program for providing the target service. This reduces the effort required to prepare the state transition correspondence table, making it easier to perform testing.
[0061] The above-described embodiments of the present disclosure are illustrative examples of the present disclosure, and are not intended to limit the scope of the present disclosure to only these embodiments. A person skilled in the art can implement the present disclosure in various other forms without departing from the scope of the present disclosure. [Explanation of symbols]
[0062] 1: Test support device 2: Target service device 3: Destination service device 11: State transition table storage unit 12: State transition correspondence table storage unit 13: State transition table management unit 14: State transition correspondence table management unit 15: Test scenario generation unit 16: Stateful contract generation unit 17: Test program generation unit 18: Test program execution unit 21: Service management unit 31: Service management unit
Claims
1. A test support device that supports a test regarding maintenance of data consistency in a predetermined service that is composed of a plurality of individual services, comprising: a scenario generating unit that generates a test scenario indicating a target transition pattern, which is a state transition pattern of a target service that is one of the plurality of individual services, and a destination transition pattern of a state transition of a destination service that is an individual service different from the target service, which occurs in association with the target transition pattern, based on state transition information indicating state transitions occurring in each of the plurality of individual services and correspondence information indicating a correspondence relationship between the state transitions in each of the plurality of individual services and a trigger event that triggers a state transition of another of the individual services caused by the state transition; a contract generation unit that generates a stateful contract, which is a contract describing a response of the connection destination service taking into account the connection destination transition pattern, based on the test scenario; a program generation unit that generates a contract test program, which is a program for performing the test, based on the test scenario and the stateful contract.
2. 2. The test support device according to claim 1, wherein the scenario generation unit generates a test scenario indicating the target transition pattern based on the state transition information of the target service, and adds the destination transition pattern to the test scenario based on the state transition information of the destination service and the correspondence information.
3. the correspondence information further indicates a correspondence relationship between the state transition and an occurrence event that may occur in association with the state transition; 2 . The test support device according to claim 1 , wherein the scenario generating unit generates an expanded test scenario as the new test scenario by adding the target transition pattern when the occurrence event occurs to the test scenario.
4. The test support device according to claim 3 , wherein the occurring event is an abnormal event.
5. 2. The test support device according to claim 1, wherein the test is performed by executing the program, and a measure for modifying the program to provide the target service is presented based on a result of the test.
6. 2. The test support device according to claim 1, further comprising a correspondence information management unit that analyzes a source file of a program for providing the target service and generates at least a part of the correspondence information.
7. 2. The test support device according to claim 1, further comprising a correspondence information management unit that displays a screen for inputting the correspondence information and receives the correspondence information via the screen.
8. A test support method using a test support device that supports a test regarding maintenance of data consistency in a predetermined service that is composed of a plurality of individual services, comprising: generating a test scenario indicating a target transition pattern, which is a state transition pattern of a target service that is one of the plurality of individual services, and a destination transition pattern of a state transition of a destination service that is one of the plurality of individual services and is an individual service different from the target service, the target transition pattern being generated in association with the target transition pattern, based on state transition information indicating state transitions occurring in each of the plurality of individual services and correspondence information indicating a correspondence relationship between the state transitions in each of the plurality of individual services and a trigger event that triggers a state transition of another of the individual services caused by the state transition; generating a stateful contract that is a contract that specifies a response of the connection destination service taking into account the connection destination transition pattern based on the test scenario; a test support method for generating a contract test program, which is a program for performing the test, based on the test scenario and the stateful contract.
Citation Information
Patent Citations
Verification information generator, verification information generation method, and verification information generation program
JP2020009271A