Test case generation method and device, electronic equipment and storage medium

By automating the generation of test cases for network variables, the problem of high workload and low efficiency caused by manual design is solved, and batch generation of test cases and efficient automated testing are achieved.

CN121560746APending Publication Date: 2026-02-24CHINA TECHENERGY
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511683431.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

In distributed control systems, the design of test cases for network variables relies on manual operation, resulting in a large workload, low efficiency, high requirements for personnel skills, and a high risk of errors.

Method used

By obtaining the network variable information table, extracting the first data and transforming it based on the target project test rules, test cases are generated. The transformation from the first data to the second data is automatically completed, and test cases for network variables are generated.

Benefits of technology

It enables batch generation of test cases, significantly reducing workload and personnel skill requirements, improving testing efficiency, and supporting seamless adaptation to automated testing tools.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121560746A_ABST
    Figure CN121560746A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a network variable information table; extracting first data used for generating a test case of a network variable from the network variable information table; performing data conversion on the first data based on a target engineering test rule to obtain second data, the target engineering test rule corresponding to the type of the first data; and based on the second data, generating a test case of the network variable, the test case being used for testing the network variable. Visibly, according to the scheme, the test case does not need to be written manually, so that batch generation of the test case can be realized for the network variable with a large scale, and the workload is remarkably reduced. And moreover, the participation of test workers is not needed, so that the test workload and the capability requirements of the test workers are reduced, and the test efficiency is integrally improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for generating test cases. Background Technology

[0002] In a distributed control system (DCS), network variables play a crucial role as communication media, responsible for enabling signal transmission between different control stations, communication stations, and gateway stations within the same network level. Moreover, the overall scale of these variables is usually very large.

[0003] However, in current network variable testing, the design of test cases still relies on manual operation. This not only results in a high workload but also places high demands on the skills of testing personnel. Furthermore, manual operation is prone to errors, ultimately leading to low overall testing efficiency. Summary of the Invention

[0004] This application provides a method, apparatus, electronic device, and storage medium for generating test cases, which eliminates the need for testing personnel, thereby reducing the workload of testing and the skill requirements of testing personnel, and improving overall testing efficiency.

[0005] Firstly, embodiments of this application provide a method for generating test cases, including:

[0006] Obtain the network variable information table;

[0007] Extract the first data for generating test cases for network variables from the network variable information table;

[0008] The first data is transformed based on the target engineering test rules to obtain the second data, wherein the target engineering test rules correspond to the type of the first data.

[0009] Based on the second data, test cases are generated for the network variables, and the test cases are used to test the network variables.

[0010] Optionally, the step of extracting the first data for generating test cases for network variables from the network variable information table includes:

[0011] The network variable information table is cleaned to obtain a cleaned network variable information table. The cleaning process includes at least one of the following: fixing format errors, processing duplicate data, and deleting empty rows or columns in the network variable information table.

[0012] The first data is read from the cleaned network variable information table using a library of programs for reading and writing spreadsheets.

[0013] Optionally, the first data includes the target point type corresponding to the network variable;

[0014] The process of transforming the first data based on the target engineering test rules to obtain the second data includes:

[0015] Obtain the candidate project test rules corresponding to different point types;

[0016] By using conditional statements, based on the target point type, the engineering test rule corresponding to the target point type is determined from the candidate engineering test rules and used as the target engineering test rule to transform the first data and obtain the second data.

[0017] Optionally, the target point type includes at least one of Boolean type BOOL, real number type REAL, and word type WORD;

[0018] The test engineering rules corresponding to BOOL include converting the first data into a Boolean value to obtain the second data;

[0019] The test project rules corresponding to REAL include converting the first data into floating-point numbers and setting the range of the floating-point numbers based on the target project requirements to obtain the second data;

[0020] The test project rules corresponding to the WORD include converting the first data into an integer and setting the range of the integer based on the target project requirements to obtain the second data.

[0021] Optionally, generating test cases for the network variables based on the second data includes:

[0022] Determine the target output format, which includes the sequence number, input bit number, input station number, output bit number, output station number, protocol type, and test steps;

[0023] The test cases are obtained by organizing the second data using a library of programs for reading and writing spreadsheets.

[0024] Optionally, the method further includes:

[0025] Import the test cases into the testing tool;

[0026] In response to the launch operation of the testing tool, the test is executed based on the test cases using the testing tool to obtain test results.

[0027] Secondly, embodiments of this application provide a test case generation apparatus, comprising:

[0028] The information acquisition module is used to acquire network variable information tables;

[0029] The data extraction module is used to extract the first data for generating test cases for network variables from the network variable information table;

[0030] The data conversion module is used to convert the first data based on the target engineering test rules to obtain the second data, wherein the target engineering test rules correspond to the type of the first data.

[0031] The test case generation module is used to generate test cases for the network variables based on the second data, and the test cases are used to test the network variables.

[0032] Optionally, the data extraction module is specifically used for:

[0033] The network variable information table is cleaned to obtain a cleaned network variable information table. The cleaning process includes at least one of the following: fixing format errors, processing duplicate data, and deleting empty rows or columns in the network variable information table.

[0034] The first data is read from the cleaned network variable information table using a library of programs for reading and writing spreadsheets.

[0035] Thirdly, embodiments of this application provide an electronic device, the device including: a processor, a memory, and a system bus;

[0036] The processor and the memory are connected via the system bus;

[0037] The memory is used to store a program, the program including instructions that, when executed by the processor, cause the processor to perform any of the implementation steps of the above-described test case generation method.

[0038] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the implementation steps of the test case generation method described above.

[0039] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0040] In this embodiment, after obtaining the network variable information table, first data for generating test cases for network variables can be extracted from the table. Then, the first data is transformed based on the target engineering test rules to obtain second data, where the target engineering test rules correspond to the type of the first data. Test cases for network variables can then be generated based on the second data, and these test cases can be used to test the network variables. It is evident that the transformation from first data to second data can be automatically completed using the target engineering test rules corresponding to the type of the first data. This allows for direct generation of test cases based on the second data without the need for manual writing of test cases. Therefore, for large-scale network variables, batch generation of test cases can be achieved, significantly reducing workload. Furthermore, since no testing personnel are required, the testing workload and the skill requirements for testing personnel are reduced, thus improving overall testing efficiency. Attached Figure Description

[0041] Figure 1 A flowchart illustrating a method for generating test cases provided in an embodiment of this application;

[0042] Figure 2 A schematic diagram of a network variable information table provided in an embodiment of this application;

[0043] Figure 3 A schematic diagram of a test case in the form of a truth table provided in an embodiment of this application;

[0044] Figure 4 A schematic diagram illustrating the automatic generation of test cases using TestCaseGenerateTool, provided as an embodiment of this application;

[0045] Figure 5 This is a schematic diagram illustrating the import of test cases into an automated testing tool, as provided in an embodiment of this application.

[0046] Figure 6 A schematic diagram of an automated testing tool provided in an embodiment of this application;

[0047] Figure 7 A schematic diagram of a test record provided in an embodiment of this application;

[0048] Figure 8 This is a schematic diagram of a test case generation device provided in an embodiment of this application. Detailed Implementation

[0049] As mentioned earlier, in network variable testing, the design of test cases still relies on manual operation. This not only results in a high workload but also places high demands on the skills of the testing personnel. Furthermore, manual operation is prone to errors, ultimately leading to low overall testing efficiency.

[0050] In practical applications, taking Tianwan Unit 7 (a type of nuclear power unit) as an example, it includes 26,549 inter-site network variables, with engineering design changes occurring more than 10 times. Therefore, on Tianwan Unit 7, the test design for a single round of network variables requires more than 10 people per day, test execution requires more than 30 people per day, and the test design workload caused by a single design change requires more than 5 people per day. It is evident that this process requires both manual design of test cases, which is labor-intensive, repetitive, prone to omissions, and inefficient, and manual execution of test cases, heavily relying on the number of maintenance tools and the capabilities of the testers.

[0051] To address the aforementioned issues, this application provides a method for generating test cases, comprising: after obtaining a network variable information table, first data for generating test cases for network variables can be extracted from the network variable information table; then, the first data is transformed based on target engineering test rules to obtain second data, wherein the target engineering test rules correspond to the type of the first data; and then, test cases for network variables can be generated based on the second data, which can be used to test the network variables. It is evident that by using target engineering test rules corresponding to the type of the first data, the transformation from first data to second data can be automatically completed. This allows for direct generation of test cases based on the second data without the need for manual test case writing. Therefore, for large-scale network variables, batch generation of test cases can be achieved, significantly reducing workload. Furthermore, since no testing personnel are required, the testing workload and the skill requirements for testing personnel are reduced, thereby improving overall testing efficiency.

[0052] It should be noted that the implementation of the test case generation method in this application is not limited to a specific entity. For example, the test case generation method in this application can be applied to data processing devices such as servers or terminal devices. The server can be a standalone server, a cluster server, or a cloud server. The terminal device can be an electronic device such as a smartphone, computer, personal digital assistant (PDA), or tablet computer.

[0053] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0054] Figure 1 This is a flowchart illustrating a method for generating test cases according to an embodiment of this application. (In conjunction with...) Figure 1 As shown, the test case generation method provided in this application embodiment may include the following steps S101-S104.

[0055] S101: Obtain the network variable information table.

[0056] In this embodiment, the network variable information table refers to the information about network variables displayed in spreadsheet format. This information belongs to the network variables of different control stations, communication stations, or gateway stations in the DCS system.

[0057] For example, an Excel spreadsheet can be used, which can include columns for network variables such as domain number, source station number, point name, and point type. All data in these columns is used to generate test cases. Specifically, all source station numbers need to maintain a consistent data format, such as three-digit numbers like 030 or 139; all point types also need to maintain a consistent data format, such as abbreviations for Boolean (BOOL), Real (REAL), or Word (WORD) variables being all uppercase.

[0058] It should be noted that BOOL can be used to represent two states of a variable, typically True or False, and usually occupies 1 bit of storage space. In the field of industrial automation, the BOOL type is often used to control the on / off states of equipment, and is very suitable for representing signals that have only two possible states, such as the start and stop of a motor or the opening and closing of a valve.

[0059] REAL can be used to represent numerical values ​​with decimal points, and can represent continuously changing parameters, typically occupying 4 bytes (32 bits) of storage space. In the field of industrial automation, the REAL type is widely used for sensor data acquisition and processing, such as the measurement of parameters like temperature, pressure, or flow. It can accurately represent the real-time changes of these parameters, improving the accuracy of the control system.

[0060] A WORD value typically occupies 2 bytes (16 bits) of storage space and can represent values ​​ranging from 0 to 65535 (unsigned) or -32768 to 32767 (signed). In industrial automation, the WORD type is often used for counters, timers, or other control parameters that require a large range of values, such as the cumulative count of a counter and the running time of a device.

[0061] Accordingly, in practical applications, the network variable information table can be stored locally and retrieved through local reading. Alternatively, the network variable information table can also be stored on other devices with data storage capabilities, and retrieved when needed by accessing those other devices.

[0062] S102: Extract the first data from the network variable information table to generate test cases for network variables.

[0063] In practice, to extract the first data, the network variable information table can first be cleaned to obtain a cleaned network variable information table. The cleaning process includes at least one of the following: correcting format errors, processing duplicate data, and deleting empty rows or columns in the network variable information table.

[0064] This includes correcting format errors, such as inconsistencies in data format between source station numbers or point types; and handling duplicate data, such as deduplicating or labeling duplicate point names. In this way, data cleaning can improve the completeness and consistency of the extracted primary data before it is actually extracted.

[0065] Next, the first data can be read from the cleaned network variable information table using a program library for reading and writing spreadsheets.

[0066] In this embodiment, the aforementioned library is, for example, the libxl library. Accordingly, a program can be written in C++ to use the libxl library to read the cleaned network variable information table to obtain the first data.

[0067] As an example, the program can be shown as follows:

[0068] libxl::Book* pSrcBook = xlCreateXMLBook();

[0069] pSrcBook->load(m_szRefVarFilePath);

[0070] Libxl::Book* pSrcSheet = pSrcBook->getSheet(0);

[0071] / / Extract domain ID, origin ID, point name, and point type

[0072] wsDomainNo = pSrcSheet->readStr(row, iDomaonNoCol)

[0073] wsSrcStnNum = pSrcSheet->readStr(row, iSrcStnNumCol)

[0074] wsPointName = pSrcSheet->readStr(row, iPointNameCol)

[0075] wsDataType = pSrcSheet->readStr(row, iDataTypeCol)

[0076] In addition, to further reduce the operational complexity for staff, in this embodiment of the application, a deep learning model can be used to identify and read the cleaned network variable information table in order to extract the first data.

[0077] As can be seen, through the above step S102, the required data can be extracted from the original network variable information table, so that the corresponding test cases can be generated based on the data.

[0078] S103: Based on the target engineering test rules, the first data is transformed to obtain the second data, and the target engineering test rules correspond to the type of the first data.

[0079] The target project test rules refer to the rules used to generate test cases that correspond to the requirements of the target project. As mentioned earlier, the relevant information in the network variable information table belongs to network variables of different control stations, communication stations, or gateway stations in the DCS system. Therefore, the extracted first data is actually data from different sources or structures. Accordingly, in this embodiment, the first data is transformed into second data based on the target project test rules, achieving a data isomorphism effect. That is, data from different sources or structures are mapped and unified through certain rules, making these data consistently identifiable and processable. This facilitates the subsequent generation of corresponding test cases based on the second data.

[0080] In practical applications, target engineering test rules can indicate the extraction points of network variables. Figure 2For example, the network variable information table is the receiving point table of the control station to be tested, such as the network variable receiving point table exported from ReferencedVariable in Network Variable of station 37. Taking 70CWM01_CH001A_XG01 of station 37 as an example, the sending station number can be confirmed as station 34 based on this table.

[0081] Furthermore, the target project test rules can also instruct the conversion of network variable receiving point names, such as adding the unit number + station number + @ before the receiving point name. Generally, the station number is three digits; therefore, for cases with fewer than three digits, 0 can be used as a substitute, such as station number 30 being represented as 030.

[0082] Furthermore, as mentioned earlier, the network variable information table can include various types of data, such as the point type corresponding to the network variable. This point type is also used to generate test cases; therefore, the first data extracted above can include the target point type corresponding to the network variable.

[0083] Accordingly, when performing data transformation, the first step is to obtain the candidate engineering test rules corresponding to different point types. In other words, different data types correspond to different engineering test rules.

[0084] Next, using conditional statements, based on the target point type, the corresponding engineering test rule is determined from the candidate engineering test rules and used as the target engineering test rule to transform the first data into the second data. For ease of understanding, an example is provided below.

[0085] As an example, a program can be written in C++ to apply the rules using conditional statements, as follows:

[0086] # Define conversion rules

[0087] if(wsDataType == “BOOL”){

[0088] pDestSheet->writeStr(row, col, “T”);

[0089] pDestSheet->writeStr(row, col + 1, "F");

[0090] }

[0091] if(wsDataType == “REAL”){

[0092] pDestSheet->writeStr(row, col, “100”);

[0093] pDestSheet->writeStr(row, col + 1, "0");

[0094] }

[0095] if(wsDataType == “WORD”){

[0096] pDestSheet->writeStr(row, col, “1”);

[0097] pDestSheet->writeStr(row, col + 1, "0");

[0098] }

[0099] Specifically, the target point type can include at least one of BOOL, REAL, and WORD.

[0100] Accordingly, the test engineering rules for BOOL include converting the first data into a boolean value to obtain the second data, such as True or False as mentioned above.

[0101] The test engineering rules corresponding to REAL include converting the first data into floating-point numbers and setting the range of floating-point numbers based on the target engineering requirements to obtain the second data, such as a temperature range of 0~100℃.

[0102] The test project rules corresponding to WORD include converting the first data into an integer and setting the range of the integer based on the target project requirements to obtain the second data, such as a counter range of 0~1000.

[0103] To facilitate understanding, let's take an example. For BOOL, when generating test cases, the input can be "T" (True) or "F" (False), and the output is the corresponding signal state. For REAL, the input can be a specific numerical value (such as a temperature value), and the output is the corresponding signal state. For WORD, the input can be a specific numerical value (such as a counter value), and the output is the corresponding signal state.

[0104] Furthermore, in practical applications, during the data extraction and transformation process of steps S102 and S103, a data verification step can be added, namely, verifying the accuracy and completeness of the extracted first data, and / or verifying the accuracy and completeness of the transformed second data.

[0105] S104: Based on the second data, generate test cases for network variables. The test cases are used to test the network variables.

[0106] In practical applications, the aforementioned target engineering test rules may also include the format of test case information. Therefore, in this embodiment, the target output format can first be determined based on the target engineering test rules. Specifically, the target output format may include sequence number, input tag number, input station number, output tag number, output station number, protocol type, and test steps, etc.

[0107] Next, the second data can be organized using a program library for reading and writing spreadsheets to obtain test cases.

[0108] In practical applications, taking Table 1 below as an example, the second data can be organized and output in the form of a test case table.

[0109] Table 1

[0110]

[0111] Specifically, a program can be written in C++ and the libxl library can be used to organize the converted second data to obtain a test case table.

[0112] As an example, the program can be shown as follows:

[0113] pDestBook->save(“. / TestCase / ” + m_szSaveName);

[0114] Furthermore, in practical applications, the second data can also be organized and output as a TD Base truth table. The test case information includes sequence number (automatically sorted and generated), input signals (tag number, station number), output signals (tag number, station number), protocol type, and test steps. Figure 3 For example, point 80JTX21_ER260_XV31, based on the data table compiled by the network variables, has an input signal station number of 232 and an output signal station number of 145. The generated output network variable point name is 8232@80JTX21_ER260_XV31.

[0115] In this way, once the test cases are obtained, they can be imported into the testing tool. Accordingly, in response to the launch operation of the testing tool, the tool executes the tests based on the test cases and obtains the test results. It is evident that these test cases can be directly adapted to automated testing tools, and the entire testing process can be seamlessly integrated, thereby significantly improving testing efficiency.

[0116] Based on the above steps S101-S104, it is clear that in this embodiment, after obtaining the network variable information table, first data for generating test cases for network variables can be extracted from the table. Then, the first data is transformed based on the target engineering test rules to obtain second data, where the target engineering test rules correspond to the type of the first data. Subsequently, test cases for network variables can be generated based on the second data, and these test cases can be used to test the network variables. It is evident that by using the target engineering test rules corresponding to the type of the first data, the transformation from first data to second data can be automatically completed. This allows for direct generation of test cases based on the second data without the need for manual writing of test cases. Therefore, for large-scale network variables, batch generation of test cases can be achieved, significantly reducing workload. Furthermore, since no testing personnel are required, the testing workload and the skill requirements for testing personnel are reduced, thus improving overall testing efficiency.

[0117] Based on the test case generation method provided in the above embodiments, this application embodiment can also provide a corresponding practical application scenario to describe the test case generation method. For ease of understanding, the following description is provided in conjunction with embodiments and accompanying drawings.

[0118] Taking the VVER-1200 reactor type test application of Unit 7 in the Tianwan project as an example, the specific steps involved in generating test cases for network variables and conducting the test can be as follows:

[0119] Step 1: Select the ReferenceVarFile folder of the control station. Here, we take station 30 as an example and select "Reference NetVar.xlsx" to export the network variable source file of station 30 from the engineer station. Name the exported file according to the following naming rule: Reference + Station Number + Export-NO or Reference + Station Number + Export-SR. Name station 30 as "Reference 30Export-NO" or "Reference 30Export-SR.xlsx".

[0120] Step 2: Using the automated test case generation tool TestCaseGenerateTool, select the named file containing the network variable source file for later test case differentiation. Naming rules: "Output30Export-NO.xlsx" and "Output30Export-SR.xlsx" must include the ".xlsx" suffix; otherwise, test case generation will fail.

[0121] Step 3: Combining Figure 4As shown, the TestCaseGenerateTool tool described above can be used to automatically generate test cases. Clicking the confirmation button will automatically generate the corresponding test case file.

[0122] Step 4: Combining Figure 5 As shown, import the test cases in the form of the generated network variable truth table. Figure 6 In the automated testing tool shown, you can start the test automatically by clicking the "Start Test" button.

[0123] Step 5: Combining Figure 7 As shown, the automated testing tool can compare the test cases with the network variable information and dynamic functions configured in the project. If they match, a "√" will be displayed in the test results; if they do not match, an "×" will be displayed, and a test record will be automatically generated.

[0124] This approach enables the rapid and accurate creation of test cases. The automatically generated test cases offer comprehensive test scope and complete test functionality, and seamlessly integrate with automated testing tools, supporting automated test execution. Therefore, compared to manual test case design, this method is highly efficient, accurate, and automated, significantly saving test design time and improving test execution efficiency.

[0125] Based on the test case generation method provided in the above embodiments, this application embodiment can also provide a test case generation apparatus. The test case generation apparatus will now be described in conjunction with embodiments and accompanying drawings.

[0126] Figure 8 This is a schematic diagram of a test case generation device provided in an embodiment of this application. (In conjunction with...) Figure 8 As shown, the test case generation apparatus 800 provided in this application embodiment includes:

[0127] Information acquisition module 801 is used to acquire network variable information table;

[0128] The data extraction module 802 is used to extract the first data for generating test cases for network variables from the network variable information table;

[0129] The data conversion module 803 is used to convert the first data based on the target engineering test rules to obtain the second data, wherein the target engineering test rules correspond to the type of the first data.

[0130] The test case generation module 804 is used to generate test cases for the network variable based on the second data, and the test cases are used to test the network variable.

[0131] Optionally, the data extraction module 802 is specifically used for:

[0132] The network variable information table is cleaned to obtain a cleaned network variable information table. The cleaning process includes at least one of the following: fixing format errors, processing duplicate data, and deleting empty rows or columns in the network variable information table.

[0133] The first data is read from the cleaned network variable information table using a library of programs for reading and writing spreadsheets.

[0134] Optionally, the first data includes the target point type corresponding to the network variable;

[0135] The data conversion module 803 is specifically used for:

[0136] Obtain the candidate project test rules corresponding to different point types;

[0137] By using conditional statements, based on the target point type, the engineering test rule corresponding to the target point type is determined from the candidate engineering test rules and used as the target engineering test rule to transform the first data and obtain the second data.

[0138] Optionally, the target point type includes at least one of Boolean type BOOL, real number type REAL, and word type WORD;

[0139] The test engineering rules corresponding to BOOL include converting the first data into a Boolean value to obtain the second data;

[0140] The test project rules corresponding to REAL include converting the first data into floating-point numbers and setting the range of the floating-point numbers based on the target project requirements to obtain the second data;

[0141] The test project rules corresponding to the WORD include converting the first data into an integer and setting the range of the integer based on the target project requirements to obtain the second data.

[0142] Optionally, the test case generation module 804 is specifically used for:

[0143] Determine the target output format, which includes the sequence number, input bit number, input station number, output bit number, output station number, protocol type, and test steps;

[0144] The test cases are obtained by organizing the second data using a library of programs for reading and writing spreadsheets.

[0145] Optionally, the test case generation device 800 further includes:

[0146] The test case import module is used to import the test cases into the testing tool;

[0147] The test execution module is used to respond to the start operation of the test tool, execute the test based on the test cases through the test tool, and obtain the test results.

[0148] Furthermore, embodiments of this application also provide an electronic device, including: a processor, a memory, and a system bus;

[0149] The processor and the memory are connected via the system bus;

[0150] The memory is used to store one or more programs, the one or more programs including instructions that, when executed by the processor, cause the processor to perform any of the implementation steps of the test case generation method described above.

[0151] Furthermore, embodiments of this application also provide a computer-readable storage medium storing instructions that, when executed on an electronic device, cause any of the implementation steps of the above-described test case generation method to be performed.

[0152] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application. It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on describing the differences from other embodiments. The same or similar parts between the various embodiments can be referred to mutually.

[0153] The system disclosed in the embodiments is described simply because it corresponds to the method disclosed in the embodiments; relevant details can be found in the method section.

[0154] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0155] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating test cases, characterized in that, include: Obtain the network variable information table; Extract the first data for generating test cases for network variables from the network variable information table; The first data is transformed based on the target engineering test rules to obtain the second data, wherein the target engineering test rules correspond to the type of the first data. Based on the second data, test cases are generated for the network variables, and the test cases are used to test the network variables.

2. The test case generation method according to claim 1, characterized in that, The first data extracted from the network variable information table for generating test cases of network variables includes: The network variable information table is cleaned to obtain a cleaned network variable information table. The cleaning process includes at least one of the following: fixing format errors, processing duplicate data, and deleting empty rows or columns in the network variable information table. The first data is read from the cleaned network variable information table using a library of programs for reading and writing spreadsheets.

3. The test case generation method according to claim 1, characterized in that, The first data includes the target point type corresponding to the network variable; The process of transforming the first data based on the target engineering test rules to obtain the second data includes: Obtain the candidate project test rules corresponding to different point types; By using conditional statements, based on the target point type, the engineering test rule corresponding to the target point type is determined from the candidate engineering test rules and used as the target engineering test rule to transform the first data and obtain the second data.

4. The test case generation method according to claim 3, characterized in that, The target point type includes at least one of the following: Boolean type BOOL, real number type REAL, and word type WORD; The test engineering rules corresponding to BOOL include converting the first data into a Boolean value to obtain the second data; The test project rules corresponding to REAL include converting the first data into floating-point numbers and setting the range of the floating-point numbers based on the target project requirements to obtain the second data; The test project rules corresponding to the WORD include converting the first data into an integer and setting the range of the integer based on the target project requirements to obtain the second data.

5. The test case generation method according to claim 3, characterized in that, The test cases for generating the network variables based on the second data include: Determine the target output format, which includes the sequence number, input bit number, input station number, output bit number, output station number, protocol type, and test steps; The test cases are obtained by organizing the second data using a library of programs for reading and writing spreadsheets.

6. The test case generation method according to claim 1, characterized in that, The method further includes: Import the test cases into the testing tool; In response to the launch operation of the testing tool, the test is executed based on the test cases using the testing tool to obtain test results.

7. A test case generation device, characterized in that, include: The information acquisition module is used to acquire network variable information tables; The data extraction module is used to extract the first data for generating test cases for network variables from the network variable information table; The data conversion module is used to convert the first data based on the target engineering test rules to obtain the second data, wherein the target engineering test rules correspond to the type of the first data. The test case generation module is used to generate test cases for the network variables based on the second data, and the test cases are used to test the network variables.

8. The method for generating test cases according to claim 7, characterized in that, The data extraction module is specifically used for: The network variable information table is cleaned to obtain a cleaned network variable information table. The cleaning process includes at least one of the following: fixing format errors, processing duplicate data, and deleting empty rows or columns in the network variable information table. The first data is read from the cleaned network variable information table using a library of programs for reading and writing spreadsheets.

9. An electronic device, characterized in that, The device includes: a processor, a memory, and a system bus; The processor and the memory are connected via the system bus; The memory is used to store a program, the program including instructions that, when executed by the processor, cause the processor to perform the steps of the test case generation method of claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the test case generation method as described in claim 8.

Citation Information

Patent Citations

  • Test data generation method and system

    CN105955887A

  • Converting method and converting system for test cases of software unit

    CN107766256A

  • IO channel test case automatic generation method and device, electronic equipment and storage medium

    CN116383040A

  • Test method and device for DCS system, storage medium and electronic equipment

    CN117724436A

  • Software interface testing method and device, electronic equipment and medium

    CN119149397A