CN117667745A - Method and device for testing target system, storage medium and electronic device - Google Patents

Method and device for testing target system, storage medium and electronic device Download PDF

Info

Publication number
CN117667745A
CN117667745A CN202311855464.6A CN202311855464A CN117667745A CN 117667745 A CN117667745 A CN 117667745A CN 202311855464 A CN202311855464 A CN 202311855464A CN 117667745 A CN117667745 A CN 117667745A
Authority
CN
China
Prior art keywords
test
target system
file
testing
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311855464.6A
Other languages
Chinese (zh)
Inventor
林亦宁
李朝光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Supremind Intelligent Technology Co Ltd
Original Assignee
Shanghai Supremind Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Supremind Intelligent Technology Co Ltd filed Critical Shanghai Supremind Intelligent Technology Co Ltd
Priority to CN202311855464.6A priority Critical patent/CN117667745A/en
Publication of CN117667745A publication Critical patent/CN117667745A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method and a device for testing a target system, a storage medium and an electronic device, wherein the method comprises the following steps: configuring a keyword library in response to a received first configuration operation, wherein the keyword library comprises: a key for indicating a test instruction; configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function; testing the target system according to the test file; by adopting the scheme, the problems that a great deal of programming knowledge and experience are required for writing and maintaining the conventional UI and API automatic test in the related technology and the use difficulty of a user is high are solved.

Description

Method and device for testing target system, storage medium and electronic device
Technical Field
The present invention relates to the field of communications, and in particular, to a method and apparatus for testing a target system, a storage medium, and an electronic apparatus.
Background
Automated testing has become an integral part of the software development process. UI and API automation testing are two of the most important aspects of software testing, and UI automation testing is a testing method that can automatically execute the operation of a Web application program and verify whether its behavior meets expectations, and API automation testing is to check the functions and performances of a software system by calling APIs.
However, the writing and maintenance of UI and API automation tests is a challenging task, requiring a great deal of programming knowledge and experience, resulting in great difficulty for the user to use.
Aiming at the problems of large programming knowledge and experience, high use difficulty of users and the like in the related technology, the writing and maintenance of the existing UI and API automatic test are required, and no effective solution is found at present.
Disclosure of Invention
The embodiment of the application provides a testing method and device of a target system, a storage medium and an electronic device, which at least solve the problems that in the related technology, writing and maintenance of the existing UI and API automatic test need a great deal of programming knowledge and experience, and the use difficulty of a user is great.
According to an embodiment of the present application, there is provided a method for testing a target system, including: configuring a keyword library in response to a received first configuration operation, wherein the keyword library comprises: a key for indicating a test instruction; configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function; and testing the target system according to the test file.
In one exemplary embodiment, configuring the test file according to the second configuration operation includes: configuration: determining a target function or a target component of the target system indicated by the test step according to the received first selection operation, and selecting a keyword corresponding to the test step from the keyword library according to the received second selection operation, wherein the second configuration operation comprises the first selection operation and the second selection operation; and executing the configuration step for a plurality of times to obtain the test file, wherein the test file comprises a plurality of test steps and a plurality of keywords, and the plurality of test steps and the plurality of keywords are in one-to-one correspondence.
In an exemplary embodiment, before testing the target system according to the test file, the method further includes: receiving test parameters carried by a third configuration operation, wherein the test parameters are used for indicating parameters required for executing a test instruction corresponding to a keyword in the test file; and testing the target system according to the test parameters and the test file.
In an exemplary embodiment, testing the target system according to the test parameters and the test file includes: determining the corresponding relation between a plurality of test sub-parameters contained in the test parameters and a plurality of keywords contained in the test file; transmitting at least one test sub-parameter to a keyword corresponding to the test step according to the corresponding relation; and executing the test instruction indicated by the keyword on the target function indicated by the test step according to the at least one test sub-parameter so as to test the target function of the target system.
In an exemplary embodiment, after testing the target system according to the test file, the method further includes: obtaining a test result of the test file, and comparing the test result with an expected test result carried by the third configuration operation, wherein the expected test result is used for indicating an expected execution result of the test file corresponding to the test parameter; determining that the target function passes the test under the condition that the comparison result indicates that the test result is the same as the expected test result; and under the condition that the comparison result indicates that the test result is different from the expected test result, determining that the target function fails the test.
In an exemplary embodiment, after testing the target system according to the test file, the method further includes: generating a test report corresponding to the test file, wherein the test report comprises: the test result of the test file, the execution result of each test step, and the test sub-parameters corresponding to each test step; and sending the test report to a second object.
In one exemplary embodiment, configuring the key library in response to the received first configuration operation includes: importing a plurality of third party packages in a preset environment, wherein the plurality of third party packages comprise a plurality of function methods; configuring keywords for the function methods according to the first configuration operation, wherein the function methods are in one-to-one correspondence with the test instructions; and generating the keyword library according to the obtained keywords.
According to another embodiment of the present application, there is also provided a test apparatus of a target system, including: the first configuration module is used for responding to the received first configuration operation to configure a keyword library, wherein the keyword library comprises: a key for indicating a test instruction; the second configuration module is used for configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function; and the test module is used for testing the target system according to the test file.
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the test method of the target system described above when running.
According to still another aspect of the embodiments of the present application, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the method for testing the target system described above through the computer program.
In the embodiment of the application, a keyword library is configured in response to the received first configuration operation, wherein the keyword library contains keywords for indicating test instructions; configuring a test file according to the received second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing the target function of the target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function; then testing the target system according to the test file; by adopting the scheme, the test steps and operations in the test file are defined as keywords through the keyword driving test framework, and the test cases are written and executed through the keyword driving, so that the test script (test file) is easy to understand and maintain; therefore, the problems that a great deal of programming knowledge and experience are needed for writing and maintaining the conventional UI and API automatic test in the related technology, and the use difficulty of a user is high are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a block diagram of the hardware architecture of a computer terminal of an alternative method of testing a target system according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative method of testing a target system according to an embodiment of the present application;
FIG. 3 is a system flow diagram of an alternative method of testing a target system according to an embodiment of the present application;
fig. 4 is a block diagram of an alternative target system testing apparatus according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The following explains the specialized words appearing in the present application:
1. gitlab: using Gitlab as source code management, and the source code creates different branches according to different environments, tst branch (test environment), stg branch (prefire environment), prd branch (production environment);
2. selenium: is a popular UI automation test tool that can be used to test Web applications. The Selenium provides a set of APIs that can interact with the Web browser and simulate the behavior of the user, such as clicking, filling in forms, etc. Pytest is a popular Python test framework that can be used to write various types of tests, including UI and API automation tests. It provides many useful functions such as assertions, parametric testing, and test reporting;
3. pytest is a powerful Python test framework that supports unit testing, integration testing, functional testing, and API testing. Pytest has the following characteristics:
a. flexibility: pytest can run any Python function as a test case without following naming rules for a particular test case class or method.
b. Plug-in system: pytest has rich plug-in systems, and can easily expand the functions of a test framework, such as supporting HTML test reports, test coverage, performance tests and the like.
c. And (3) automation: pytest has an automated test collection and operation function that automatically discovers and operates all test cases that meet a particular naming convention.
d. Assertion library: pytest provides a built-in assertion library, supporting rich assertion methods and custom error information.
The method embodiments provided by the embodiments of the present application may be performed in a computer terminal or similar computing system. Taking the example of running on a computer terminal, fig. 1 is a block diagram of the hardware structure of the computer terminal of a test method of a target system according to an embodiment of the present application. As shown in fig. 1, the computer terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing system such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and in one exemplary embodiment, may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the configuration shown in fig. 1 is merely illustrative and is not intended to limit the configuration of the computer terminal described above. For example, a computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than the equivalent functions shown in FIG. 1 or more than the functions shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a test method of a target system in the embodiment of the present application, and the processor 102 executes the computer program stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage systems, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the computer terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet.
In this embodiment, a method for testing a target system is provided and applied to the computer terminal, and fig. 2 is a flowchart of an alternative method for testing a target system according to an embodiment of the present application, where the flowchart includes the following steps:
step S202, configuring a keyword library in response to the received first configuration operation, where the keyword library includes: a key for indicating a test instruction;
step S204, configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function;
and step S206, testing the target system according to the test file.
The method comprises the steps that a keyword library is configured in response to received first configuration operation, wherein the keyword library comprises keywords used for indicating test instructions; configuring a test file according to the received second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing the target function of the target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function; then testing the target system according to the test file; by adopting the scheme, the test steps and operations in the test file are defined as keywords through the keyword driving test framework, and the test cases are written and executed through the keyword driving, so that the test script (test file) is easy to understand and maintain; therefore, the problems that a great deal of programming knowledge and experience are needed for writing and maintaining the conventional UI and API automatic test in the related technology, and the use difficulty of a user is high are solved.
In one exemplary embodiment, configuring the test file according to the second configuration operation includes: configuration: determining a target function or a target component of the target system indicated by the test step according to the received first selection operation, and selecting a keyword corresponding to the test step from the keyword library according to the received second selection operation, wherein the second configuration operation comprises the first selection operation and the second selection operation; and executing the configuration step for a plurality of times to obtain the test file, wherein the test file comprises a plurality of test steps and a plurality of keywords, and the plurality of test steps and the plurality of keywords are in one-to-one correspondence.
Determining a target function or a target component indicated by the test step according to the received first selection operation, and selecting a keyword corresponding to the test step from a keyword library according to the received second selection operation, wherein the second configuration operation comprises the first selection operation and the second selection operation; the configuration step is executed for a plurality of times, so that a test file is obtained, wherein the test file comprises a plurality of test steps and a plurality of keywords, and each test step corresponds to one keyword.
Optionally, the above step S206 is performed: before testing the target system according to the test file, the method further comprises: receiving test parameters carried by a third configuration operation, wherein the test parameters are used for indicating parameters required for executing a test instruction corresponding to a keyword in the test file; and testing the target system according to the test parameters and the test file.
Before testing, the test parameters carried by the third configuration operation are required to be received, wherein the test parameters are parameters required by executing each test instruction, namely test data, for example, account number and password data required by the test are required to be configured when logging in the system operation is executed; and then testing the target system according to the received test parameters and the test file.
Optionally, step S206 is: testing the target system according to the test parameters and the test file, including: determining the corresponding relation between a plurality of test sub-parameters contained in the test parameters and a plurality of keywords contained in the test file; transmitting at least one test sub-parameter to a keyword corresponding to the test step according to the corresponding relation; and executing the test instruction indicated by the keyword on the target function indicated by the test step according to the at least one test sub-parameter so as to test the target function of the target system.
Firstly, determining the corresponding relation between a plurality of test sub-parameters contained in the received test parameters and a plurality of keywords contained in the test file; and then, transmitting at least one test sub-parameter corresponding to each keyword to the keywords according to the corresponding relation, and executing a test instruction according to the at least one test sub-parameter so as to complete the test of the target function of the target system.
The above step S206 is performed: after testing the target system according to the test file, the method further comprises: obtaining a test result of the test file, and comparing the test result with an expected test result carried by the third configuration operation, wherein the expected test result is used for indicating an expected execution result of the test file corresponding to the test parameter; determining that the target function passes the test under the condition that the comparison result indicates that the test result is the same as the expected test result; and under the condition that the comparison result indicates that the test result is different from the expected test result, determining that the target function fails the test.
After testing the target system according to the test file, acquiring a test result corresponding to the test file, and comparing the test result with an expected test result carried by a third configuration operation, wherein the expected test result is an expected execution result of the test file corresponding to the test parameter; for example, for the login function, if the correct account number and password are input, the corresponding expected test result should be successful login, and a prompt message is popped up; after the wrong account number or password is input, the corresponding expected test result should be login failure and corresponding prompt message is popped up; if the comparison result indicates that the target function and the target function are the same, determining that the target function passes the test, and if the comparison result indicates that the target function and the target function are not the same, determining that the target function passes the test.
Optionally, the above step S206 is performed: after testing the target system according to the test file, the method further comprises: generating a test report corresponding to the test file, wherein the test report comprises: the test result of the test file, the execution result of each test step, and the test sub-parameters corresponding to each test step; and sending the test report to a second object.
After the test is completed, a test report can be generated according to the test result, wherein the test report comprises the test result of the test file, the execution result of each test step and the test sub-parameters corresponding to each test step; and then the test report is sent to the team member so that the team member can analyze the test process according to the test report and adjust the test process in time when the test fails.
Optionally, step S202 is: configuring the key library in response to the received first configuration operation may be accomplished by: importing a plurality of third party packages in a preset environment, wherein the plurality of third party packages comprise a plurality of function methods; configuring keywords for the function methods according to the first configuration operation, wherein the function methods are in one-to-one correspondence with the test instructions; and generating the keyword library according to the obtained keywords.
Firstly, a plurality of third party packages are required to be imported in a preset environment, the plurality of third party packages comprise a plurality of function methods, then keywords are respectively configured for the plurality of function methods according to the received first configuration operation, the function methods are in one-to-one correspondence with test instructions, namely the test instructions call the function methods, and finally the keyword library is generated according to the obtained plurality of keywords.
In order to better understand the process of the testing method of the target system, the following describes the implementation method flow of the testing of the target system with reference to the alternative embodiments, but is not limited to the technical solution of the embodiments of the present application.
The application also provides an optional testing method of the target system, which comprises the following steps:
step 1, installing python executable environment (corresponding to the preset environment), and importing selenium, pytest, allure a third party package (corresponding to the plurality of third party packages);
and 2, defining a keyword library, wherein each keyword corresponds to one test operation. For example, UI tests may include keywords such as click, input, get element properties, etc., and API tests may include keywords such as request, assertion, parse response, etc.;
and 3, defining test cases and test data by using the YAML file. The test case needs to define a test step and a corresponding keyword, and the test data needs to contain parameters (corresponding to the test parameters) and expected results (corresponding to the expected test results) required in the test case;
step 4, defining a test executor, reading test cases and test data, and transmitting the test data to corresponding keywords to execute a test;
step 5, using Selenium WebDriver or API request library to execute test operation. In the UI test, a browser needs to be operated by Selenium WebDriver to simulate the interactive operation of a user; in the API test, it is necessary to send a request using an API request library and parse response data;
step 6, reading yaml test cases under different directories through run file operation, calling a writing function, defining the specific content of the py file in the function, and automatically generating the py file into the tests directory;
step 7, executing by using a pytest command line, collecting test.py test files by using a pytest characteristic, and running all test cases;
and 8, integrating a test framework by using a CI/CD tool, automatically executing the test after the code is submitted, generating a detailed test report for the test result, including the execution condition of the test case, the test result, the test data and other information, and sending the test report to team members.
In the present embodiment, by combining the Selenium and Pytest, a complete UI and API automation test framework can be implemented that uses the YAML keyword driver to write and execute test cases, where each test step is defined as a keyword. Keywords may represent some basic operations such as clicking, entering text, etc., or some complex operations such as logging in, adding data, etc. In performing the test, the test framework parses the YAML file and converts each key to a corresponding test step and operation.
By this embodiment, using keywords to drive the framework to perform automated testing has several advantages: 1. the readability is strong: the use of keyword drivers may make the test script easier to understand and read because each keyword represents a particular operation or behavior; 2. the maintenance cost is low: when the test script needs to be modified, only the corresponding key words need to be modified, and repeated codes do not need to be modified in each test case. Thus, the maintenance cost can be greatly reduced; 3. the reusability is high: the same keyword can be reused in a plurality of test cases, so that the reusability of codes is improved; 4. the expandability is strong: new keywords can be added as needed, so that the functions of the test framework are expanded; 5. the learning cost is low: the programming of test cases can be completed by simply learning the page element positioning mode and the interface calling method without a complete code foundation; 6. the test coverage rate can be improved: because the keyword driver can easily write a plurality of test cases, the test coverage rate can be improved, and the software can be ensured to normally run under various conditions.
The system flow of the method for testing a target system is shown in fig. 3, and fig. 3 is a system flow chart of the method for testing a target system according to an embodiment of the application, as shown in fig. 3, specifically including:
step 3.1, scanning a casedata catalog to generate a test.py file with a corresponding name;
step 3.2, storing Yaml test cases;
step 3.3, processing to obtain Yaml data;
step 3.4, defining a keyword warehouse;
step 3.5, defining code logic to finish the action chain;
step 3.6, generating an executable file according to the yaml test case;
step 3.7, executing the use case in the testcase directory by using the pytest;
and 3.8, generating a test report.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the embodiments of the present application.
FIG. 4 is a block diagram of a testing device of a target system according to an embodiment of the present application; as shown in fig. 4, includes:
a first configuration module 42, configured to configure a keyword library in response to the received first configuration operation, where the keyword library includes: a key for indicating a test instruction;
the second configuration module 44 is configured to configure a test file according to a second configuration operation, where the test file includes a test step and a keyword corresponding to the test step, the test step is used for executing a target function of the target system, and the keyword corresponding to the test step is used for indicating a test instruction executed on the target function;
and the test module 46 is used for testing the target system according to the test file.
By the device, a keyword library is configured in response to the received first configuration operation, wherein the keyword library contains keywords used for indicating test instructions; configuring a test file according to the received second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing the target function of the target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function; then testing the target system according to the test file; by adopting the scheme, the test steps and operations in the test file are defined as keywords through the keyword driving test framework, and the test cases are written and executed through the keyword driving, so that the test script (test file) is easy to understand and maintain; therefore, the problems that a great deal of programming knowledge and experience are needed for writing and maintaining the conventional UI and API automatic test in the related technology, and the use difficulty of a user is high are solved.
In an exemplary embodiment, the second configuration module 44 is further configured to perform the configuration steps of: determining a target function or a target component of the target system indicated by the test step according to the received first selection operation, and selecting a keyword corresponding to the test step from the keyword library according to the received second selection operation, wherein the second configuration operation comprises the first selection operation and the second selection operation; and executing the configuration step for a plurality of times to obtain the test file, wherein the test file comprises a plurality of test steps and a plurality of keywords, and the plurality of test steps and the plurality of keywords are in one-to-one correspondence.
Determining a target function or a target component indicated by the test step according to the received first selection operation, and selecting a keyword corresponding to the test step from a keyword library according to the received second selection operation, wherein the second configuration operation comprises the first selection operation and the second selection operation; the configuration step is executed for a plurality of times, so that a test file is obtained, wherein the test file comprises a plurality of test steps and a plurality of keywords, and each test step corresponds to one keyword.
Optionally, the test module 46 is further configured to receive a test parameter carried by a third configuration operation, where the test parameter is used to indicate a parameter required for executing a test instruction corresponding to a keyword in the test file; and testing the target system according to the test parameters and the test file.
Before testing, the test parameters carried by the third configuration operation are required to be received, wherein the test parameters are parameters required by executing each test instruction, namely test data, for example, account number and password data required by the test are required to be configured when logging in the system operation is executed; and then testing the target system according to the received test parameters and the test file.
In an exemplary embodiment, the test module 46 is further configured to determine correspondence between a plurality of test sub-parameters included in the test parameters and a plurality of keywords included in the test file; transmitting at least one test sub-parameter to a keyword corresponding to the test step according to the corresponding relation; and executing the test instruction indicated by the keyword on the target function indicated by the test step according to the at least one test sub-parameter so as to test the target function of the target system.
Firstly, determining the corresponding relation between a plurality of test sub-parameters contained in the received test parameters and a plurality of keywords contained in the test file; and then, transmitting at least one test sub-parameter corresponding to each keyword to the keywords according to the corresponding relation, and executing a test instruction according to the at least one test sub-parameter so as to complete the test of the target function of the target system.
In an exemplary embodiment, the test module 46 is further configured to obtain a test result of the test file, and compare the test result with an expected test result carried by the third configuration operation, where the expected test result is used to indicate an expected execution result of the test file corresponding to the test parameter; determining that the target function passes the test under the condition that the comparison result indicates that the test result is the same as the expected test result; and under the condition that the comparison result indicates that the test result is different from the expected test result, determining that the target function fails the test.
After testing the target system according to the test file, acquiring a test result corresponding to the test file, and comparing the test result with an expected test result carried by a third configuration operation, wherein the expected test result is an expected execution result of the test file corresponding to the test parameter; for example, for the login function, if the correct account number and password are input, the corresponding expected test result should be successful login, and a prompt message is popped up; after the wrong account number or password is input, the corresponding expected test result should be login failure and corresponding prompt message is popped up; if the comparison result indicates that the target function and the target function are the same, determining that the target function passes the test, and if the comparison result indicates that the target function and the target function are not the same, determining that the target function passes the test.
Optionally, the test module 46 is further configured to generate a test report corresponding to the test file, where the test report includes: the test result of the test file, the execution result of each test step, and the test sub-parameters corresponding to each test step; and sending the test report to a second object.
After the test is completed, a test report can be generated according to the test result, wherein the test report comprises the test result of the test file, the execution result of each test step and the test sub-parameters corresponding to each test step; and then the test report is sent to the team member so that the team member can analyze the test process according to the test report and adjust the test process in time when the test fails.
In an exemplary embodiment, the first configuration module 42 is further configured to import a plurality of third party packages in a preset environment, where the plurality of third party packages includes a plurality of function methods; configuring keywords for the function methods according to the first configuration operation, wherein the function methods are in one-to-one correspondence with the test instructions; and generating the keyword library according to the obtained keywords.
Firstly, a plurality of third party packages are required to be imported in a preset environment, the plurality of third party packages comprise a plurality of function methods, then keywords are respectively configured for the plurality of function methods according to the received first configuration operation, the function methods are in one-to-one correspondence with test instructions, namely the test instructions call the function methods, and finally the keyword library is generated according to the obtained plurality of keywords.
Embodiments of the present application also provide a storage medium including a stored program, wherein the program performs the method of any one of the above when run.
Alternatively, in the present embodiment, the above-described storage medium may be configured to store program code for performing the steps of:
s1, a keyword library is configured in response to a received first configuration operation, wherein the keyword library comprises: a key for indicating a test instruction;
s2, configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function;
s3, testing the target system according to the test file.
Embodiments of the present application also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, a keyword library is configured in response to a received first configuration operation, wherein the keyword library comprises: a key for indicating a test instruction;
s2, configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function;
s3, testing the target system according to the test file.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments and optional implementations, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing system, they may be centralized in a single computing system, or distributed across a network of computing systems, and they may alternatively be implemented in program code that is executable by the computing system, such that they are stored in a memory system and, in some cases, executed in a different order than that shown or described, or they may be implemented as individual integrated circuit modules, or as individual integrated circuit modules. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims (10)

1. A method for testing a target system, comprising:
configuring a keyword library in response to a received first configuration operation, wherein the keyword library comprises: a key for indicating a test instruction;
configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function;
and testing the target system according to the test file.
2. The method of testing a target system of claim 1, wherein configuring the test file according to the second configuration operation comprises:
configuration: determining a target function or a target component of the target system indicated by the test step according to the received first selection operation, and selecting a keyword corresponding to the test step from the keyword library according to the received second selection operation, wherein the second configuration operation comprises the first selection operation and the second selection operation;
and executing the configuration step for a plurality of times to obtain the test file, wherein the test file comprises a plurality of test steps and a plurality of keywords, and the plurality of test steps and the plurality of keywords are in one-to-one correspondence.
3. The method of testing a target system according to claim 1, wherein prior to testing the target system according to the test file, the method further comprises:
receiving test parameters carried by a third configuration operation, wherein the test parameters are used for indicating parameters required for executing a test instruction corresponding to a keyword in the test file;
and testing the target system according to the test parameters and the test file.
4. A method of testing a target system according to claim 3, wherein testing the target system based on the test parameters and the test file comprises:
determining the corresponding relation between a plurality of test sub-parameters contained in the test parameters and a plurality of keywords contained in the test file;
transmitting at least one test sub-parameter to a keyword corresponding to the test step according to the corresponding relation;
and executing the test instruction indicated by the keyword on the target function indicated by the test step according to the at least one test sub-parameter so as to test the target function of the target system.
5. The method of testing a target system according to claim 4, further comprising, after testing the target system according to the test file:
obtaining a test result of the test file, and comparing the test result with an expected test result carried by the third configuration operation, wherein the expected test result is used for indicating an expected execution result of the test file corresponding to the test parameter;
determining that the target function passes the test under the condition that the comparison result indicates that the test result is the same as the expected test result;
and under the condition that the comparison result indicates that the test result is different from the expected test result, determining that the target function fails the test.
6. The method of testing a target system according to claim 4, further comprising, after testing the target system according to the test file:
generating a test report corresponding to the test file, wherein the test report comprises: the test result of the test file, the execution result of each test step, and the test sub-parameters corresponding to each test step;
and sending the test report to a second object.
7. The method of testing a target system of claim 1, wherein configuring the key library in response to the received first configuration operation comprises:
importing a plurality of third party packages in a preset environment, wherein the plurality of third party packages comprise a plurality of function methods;
configuring keywords for the function methods according to the first configuration operation, wherein the function methods are in one-to-one correspondence with the test instructions;
and generating the keyword library according to the obtained keywords.
8. A test apparatus for a target system, comprising:
the first configuration module is used for responding to the received first configuration operation to configure a keyword library, wherein the keyword library comprises: a key for indicating a test instruction;
the second configuration module is used for configuring a test file according to a second configuration operation, wherein the test file comprises a test step and keywords corresponding to the test step, the test step is used for executing a target function of a target system, and the keywords corresponding to the test step are used for indicating a test instruction executed on the target function;
and the test module is used for testing the target system according to the test file.
9. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program when run performs the method of any of the preceding claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method according to any of the claims 1 to 7 by means of the computer program.
CN202311855464.6A 2023-12-28 2023-12-28 Method and device for testing target system, storage medium and electronic device Pending CN117667745A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311855464.6A CN117667745A (en) 2023-12-28 2023-12-28 Method and device for testing target system, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311855464.6A CN117667745A (en) 2023-12-28 2023-12-28 Method and device for testing target system, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN117667745A true CN117667745A (en) 2024-03-08

Family

ID=90069810

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311855464.6A Pending CN117667745A (en) 2023-12-28 2023-12-28 Method and device for testing target system, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN117667745A (en)

Similar Documents

Publication Publication Date Title
CN105303112B (en) The detection method and device of component call loophole
US10853227B2 (en) Systems and methods for modular test platform for applications
CN105512029A (en) Method, server and system for testing intelligent terminal
CN110933095A (en) Message parsing method and device
CN108920146A (en) Page control assembly and visual Simulation operating system
CN110532182B (en) Automatic testing method and device for virtualization platform
CN112463467B (en) Automated integrated test system and method thereof
CN108804315B (en) Test method and device applied to dynamic development, electronic equipment and storage medium
CN107704499A (en) A kind of page jump control method and device of application program
CN111913889A (en) Test system building method and test system
CN116069341A (en) Automatic deployment method, equipment and storage medium for application program
CN115118582A (en) Log analysis method and device
CN112988588B (en) Client software debugging method and device, storage medium and electronic equipment
CN114328250A (en) Automatic self-checking method, medium and device for software system
US20170220449A1 (en) Infrastructure rule generation
CN117370203A (en) Automatic test method, system, electronic equipment and storage medium
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
US10055516B1 (en) Testing open mobile alliance server payload on an open mobile alliance client simulator
CN115934559A (en) Testing method of intelligent form testing system
CN117667745A (en) Method and device for testing target system, storage medium and electronic device
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN114416305A (en) Robot engine implementation method and system and electronic equipment
CN114048134A (en) Automatic testing method and device based on POM and data driving
CN113434417B (en) Regression testing method and device for loopholes, storage medium and electronic device
CN105683938A (en) Recording an application test

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination