CN116521455A - Demand testing method and device, storage medium and electronic device - Google Patents

Demand testing method and device, storage medium and electronic device Download PDF

Info

Publication number
CN116521455A
CN116521455A CN202310361962.9A CN202310361962A CN116521455A CN 116521455 A CN116521455 A CN 116521455A CN 202310361962 A CN202310361962 A CN 202310361962A CN 116521455 A CN116521455 A CN 116521455A
Authority
CN
China
Prior art keywords
tested
requirement
requirements
target
environment
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
CN202310361962.9A
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.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing 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 Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd, Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202310361962.9A priority Critical patent/CN116521455A/en
Publication of CN116521455A publication Critical patent/CN116521455A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The application discloses a demand test method, a demand test device, a storage medium and an electronic device, and relates to the technical field of computers, wherein the demand test method comprises the following steps: firstly, a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested are obtained. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the plurality of to-be-tested requirements is tested, releasing the plurality of to-be-tested requirements into the production environment of the target project. The demand testing method, the demand testing device, the storage medium and the electronic device are used for improving the testing efficiency of demands and the accuracy of testing results.

Description

Demand testing method and device, storage medium and electronic device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a demand testing method and apparatus, a storage medium, and an electronic device.
Background
As market competition increases, there is an increasing demand by Product Manager (PM). Accordingly, there is an increasing need for developers to come on-line. Any need is tested before being brought on-line.
However, as the number of demands increases, the problem of insufficient server resources for demand testing becomes more serious, and developers need to wait a long time to test the demands using the test environment of the server. Moreover, as each requirement is tested in the same test environment, the accuracy of the test result can be affected to a certain extent.
Based on this, a method for solving the technical problems that the test resources are insufficient and the requirements are mutually influenced in the same test environment is urgently needed to improve the test efficiency of the requirements and the accuracy of the test results.
Disclosure of Invention
The application aims to provide a demand testing method, a demand testing device, a storage medium and an electronic device, which are used for improving the testing efficiency of demands and the accuracy of testing results.
The application provides a demand test method, which comprises the following steps:
acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project; creating a virtual test environment corresponding to each requirement to be tested in a local environment according to a configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on a test script corresponding to each requirement to be tested; and after each to-be-tested in the plurality of to-be-tested requirements is tested, releasing the plurality of to-be-tested requirements into the production environment of the target project.
Optionally, the creating a virtual test environment of each requirement to be tested in the local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested, including: acquiring the occupancy rate of local system resources, and calculating the residual system resources according to the occupancy rate of the local system resources; determining a target project set according to the residual system resources and the system resources required by each to-be-tested demand in the demands which are not tested in the plurality of to-be-tested demands, and creating a virtual test environment of each to-be-tested demand in a local environment according to a configuration file corresponding to each to-be-tested demand in the target project set; testing each requirement to be tested in the target project set based on a test script corresponding to each requirement to be tested in the target project set in a virtual test environment of each requirement to be tested; the target item set is a set of requirements to be tested, which has the highest utilization rate of the remaining system resources, among the requirements which are not tested.
Optionally, the creating a virtual test environment of each requirement to be tested in the local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested, including: under the condition that a dependency relationship exists between a first to-be-tested demand in the plurality of to-be-tested demands and a second to-be-tested demand in the plurality of to-be-tested demands, a first virtual testing environment of the first to-be-tested demand is created in a local environment based on a first configuration file corresponding to the first to-be-tested demand and a second configuration file corresponding to the second to-be-tested demand; testing the first requirement to be tested in the first virtual testing environment based on a first testing script corresponding to the first requirement to be tested; the first virtual test environment comprises a function corresponding to the second to-be-tested requirement.
Optionally, the creating a virtual testing environment of each requirement to be tested in the local environment according to the configuration file corresponding to each requirement to be tested includes: analyzing a target configuration file corresponding to any target to-be-tested requirement in the multiple to-be-tested requirements, and determining target configuration information of the target to-be-tested requirement; the target configuration information includes at least one of: a file directory, a first port number, a second port number, and an access address; creating a target dock container based on the target configuration information, and installing the environment and related dependence required by the target to-be-tested requirement to obtain a target virtual test environment of the target to-be-tested requirement; wherein, the first port number is the port number of the local system; the second port number is the port number of the target dock container; and the access address is the access address of the target to-be-tested requirement in the local area network.
Optionally, the creating a target dock container based on the target configuration information, and installing an environment and related dependencies required by the target requirement to be tested to obtain a target virtual test environment of the target requirement to be tested, including: and when the target dock container is created, a mapping relation between the first port number and the second port number is established, and after the target dock container is successfully created, a node service corresponding to the target to-be-tested requirement is started based on the file directory.
Optionally, after each to-be-tested in the plurality of requirements to be tested is completed, issuing the plurality of requirements to be tested into a production environment of the target item, including: changing the test state of the to-be-tested requirements which are tested to be finished in the plurality of to-be-tested requirements to a finished state; and submitting manual verification under the condition that the testing state of each to-be-tested requirement in the plurality of to-be-tested requirements is changed to a finished state, and releasing the plurality of to-be-tested requirements into the production environment of the target project after the verification is passed.
The application also provides a demand test device, including:
The acquisition module is used for acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project; the environment construction module is used for creating a virtual test environment corresponding to each requirement to be tested in the local environment according to the configuration file corresponding to each requirement to be tested; the demand test module is used for testing each demand to be tested based on a test script corresponding to each demand to be tested in the virtual test environment; and the release module is used for releasing the plurality of requirements to be tested into the production environment of the target project after each of the plurality of requirements to be tested is tested.
Optionally, the acquiring module is further configured to acquire an occupancy rate of a local system resource, and calculate a remaining system resource according to the occupancy rate of the local system resource; the environment construction module is specifically configured to determine a target item set according to the remaining system resources and system resources required by each requirement to be tested in the requirements which are not tested in the multiple requirements to be tested, and create a virtual test environment of each requirement to be tested in a local environment according to a configuration file corresponding to each requirement to be tested in the target item set; the demand test module is specifically configured to test each demand to be tested in the target item set in a virtual test environment of each demand to be tested based on a test script corresponding to each demand to be tested in the target item set; the target item set is a set of requirements to be tested, which has the highest utilization rate of the remaining system resources, among the requirements which are not tested.
Optionally, the environment building module is specifically configured to, in a case where a dependency relationship exists between a first requirement to be tested of the multiple requirements to be tested and a second requirement to be tested of the multiple requirements to be tested, create a first virtual test environment of the first requirement to be tested in a local environment based on a first configuration file corresponding to the first requirement to be tested and a second configuration file corresponding to the second requirement to be tested; the demand test module is specifically configured to test the first demand to be tested in the first virtual test environment based on a first test script corresponding to the first demand to be tested; the first virtual test environment comprises a function corresponding to the second to-be-tested requirement.
Optionally, the apparatus further comprises: a determining module; the determining module is configured to parse a target configuration file corresponding to any target to-be-tested requirement of the multiple to-be-tested requirements, and determine target configuration information of the target to-be-tested requirement; the target configuration information includes at least one of: a file directory, a first port number, a second port number, and an access address; the environment construction module is specifically configured to create a target dock container based on the target configuration information, and install an environment and related dependencies required by the target to-be-tested requirement to obtain a target virtual testing environment of the target to-be-tested requirement; wherein, the first port number is the port number of the local system; the second port number is the port number of the target dock container; and the access address is the access address of the target to-be-tested requirement in the local area network.
Optionally, the environment building module is specifically further configured to, when the target dock container is created, build a mapping relationship between the first port number and the second port number, and after the target dock container is created successfully, start a node service corresponding to the target requirement to be tested based on the file directory.
Optionally, the issuing module is specifically configured to change a testing state of a to-be-tested requirement for completing a test in the multiple to-be-tested requirements to a completed state; the issuing module is specifically further configured to submit a manual audit when the testing state of each of the multiple requirements to be tested is changed to a completed state, and issue the multiple requirements to be tested to the production environment of the target project after the audit is passed.
The present application also provides an electronic device comprising a memory and a processor, the memory having stored therein a computer program, the processor being arranged to perform the steps of implementing a method of demand testing as described in any of the above by means of the computer program.
The present application also provides a computer readable storage medium comprising a stored program, wherein the program when executed performs the steps of the demand test method as described in any one of the above.
The present application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of a demand test method as described in any one of the above.
The method, the device, the storage medium and the electronic device for testing the requirements provided by the application firstly acquire a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the multiple to-be-tested requirements is tested, releasing the multiple to-be-tested requirements into the production environment of the target project. Therefore, a developer can utilize local system resources to perform independent test of requirements, so that the efficiency of the requirement test is improved, and the accuracy of a test result is improved to a certain extent.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the technical solutions of the present application or the prior art, the following description will briefly introduce the drawings used in the embodiments or the description of the prior art, and it is obvious that, in the following description, the drawings are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a demand testing method provided in the present application;
FIG. 2 is a schematic flow chart of a virtual testing environment for building a requirement to be tested;
FIG. 3 is a schematic diagram of a demand test apparatus provided in the present application;
fig. 4 is a schematic structural diagram of an electronic device provided in 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 explanation is made for terms related to the embodiments of the present application:
dock is an open-source application container (container) engine that allows developers to package their applications and rely on packages into a portable container that is then published to any popular Linux or Windows operating system machine, and also allows virtualization, where the containers are completely sandboxed without any interface to each other. The container is started up separately from an image, which is made up of several layers, each superimposed as a separate object from the outside. Inside the image is a reduced operating system, and also contains files and dependency packages necessary for the application to run.
Aiming at the technical problems that test resources are insufficient and all requirements are deployed in the same test environment to affect each other in the related art, the embodiment of the application provides a requirement test method based on local system resources, which can build independent virtual test environments of each requirement in the local environment by utilizing the local system resources to independently test each requirement, thereby improving the efficiency of the requirement test and improving the accuracy of test results to a certain extent.
The following describes in detail the demand test method provided in the embodiment of the present application through specific embodiments and application scenarios thereof with reference to the accompanying drawings.
As shown in fig. 1, a method for testing requirements according to an embodiment of the present application may include the following steps 101 to 103:
step 101, obtaining a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested.
Wherein. The plurality of requirements to be tested are requirements with association relation on business in the target project.
For example, the multiple requirements to be tested and the configuration file and the test script corresponding to each requirement to be tested may be uploaded by a developer. In the embodiment of the application, a user interface can be further provided, so that a developer can upload or edit the multiple requirements to be tested, and configuration files and test scripts corresponding to the requirements to be tested. One requirement to be tested may correspond to one or more functions.
For example, the above-mentioned multiple requirements to be tested are all requirements with association relationship on the service in the same project, and need to be uniformly issued into the generating environment after the test is completed. Meanwhile, the plurality of requirements to be tested can also be requirements which have no association relation in service, and each requirement to be tested can be independently issued into a generating environment after the completion of the test.
The configuration file is used for building a virtual environment of the requirement to be tested, the test script is an automatic test script corresponding to the requirement to be tested, and the automatic test of the requirement to be tested can be completed based on the test script.
It should be noted that, based on the automatic test script, the testing of the requirements is completed, which is mature in the related art, and the specific testing method can refer to the description in the related art, and the detailed description is not made in the embodiment of the present application.
Step 102, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to a configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on a test script corresponding to each requirement to be tested.
For example, for each to-be-tested requirement of the multiple to-be-tested requirements, an independent virtual test environment can be built for the to-be-tested requirements based on the corresponding configuration file to perform functional test, and after the test is completed, system resources occupied by the virtual test environment are released.
The virtual test environment may be a virtual machine environment or a lightweight virtual environment such as a dock. Because the mirror image files used by the virtual machine are larger, the functions are more, so that the occupied system resources are larger, and the waste is serious.
For example, after the independent test environment (i.e. the virtual test environment) of the to-be-tested requirement is built, the function of the to-be-tested requirement can be tested based on the test script corresponding to the to-be-tested requirement.
Step 103, after each to-be-tested in the multiple requirements to be tested is tested, releasing the multiple requirements to be tested into the production environment of the target project.
For example, when all the tests of the plurality of requirements to be tested are completed and the tests pass, each requirement to be tested can be issued into the production environment of the target project.
Specifically, the step 103 may include the following steps 103a1 and 103a2:
step 103a1, changing the testing status of the tested requirements to be tested, which is tested, from the plurality of tested requirements to a completed status.
Step 103a2, submitting a manual audit when the test state of each to-be-tested requirement in the plurality of to-be-tested requirements is changed to a completed state, and releasing the plurality of to-be-tested requirements to the production environment of the target project after the audit is passed.
By way of example, the demand testing method provided by the embodiment of the application can also provide a testing state display interface of each demand to be tested, and a developer can know the current state of each demand at any time.
For example, the above-mentioned state of the demand to be tested may include: an untested state, a testing state, a completed state, a test failed state, etc.
Optionally, in the embodiment of the present application, local system resources are limited due to local hardware configuration, so that when performing functional testing of multiple requirements to be tested, the local system resources need to be reasonably utilized.
Specifically, the step 202 may include the following steps 202a1 to 202a3:
step 202a1, acquiring the occupancy rate of the local system resource, and calculating the rest system resource according to the occupancy rate of the local system resource.
Step 202a2, determining a target project set according to the remaining system resources and the system resources required by each to-be-tested requirement in the non-tested requirements in the multiple to-be-tested requirements, and creating a virtual test environment of each to-be-tested requirement in a local environment according to a configuration file corresponding to each to-be-tested requirement in the target project set.
Step 202a3, testing each requirement to be tested in the target project set based on the test script corresponding to each requirement to be tested in the target project set in the virtual test environment of each requirement to be tested.
The target item set is a set of requirements to be tested, which has the highest utilization rate of the remaining system resources, among the requirements which are not tested.
For example, when performing the functional test of the to-be-tested requirement locally, the test of the to-be-tested requirement needs to be reasonably arranged according to the residual system resources of the local system, so as to avoid the waste of the system resources, or the situation that the system is blocked and restarted due to the higher occupancy rate of the system resources.
For example, the system resources required by the to-be-tested requirement with the system residual resource size of 5 and the residual non-tested requirement are respectively: demand a:1, requirement B:2, requirement C:3, requirement D:3, requirement E:4 are examples. If the requirements E and B are tested next, the required system resources exceed the residual resources of the system; if the requirements a and B are tested next, the remaining 2 system resources cannot be utilized; if the requirements B and C are tested next, the utilization rate of the remaining resources of the system is the highest.
Optionally, in the embodiment of the present application, if there is a dependency relationship between multiple requirements to be tested, on the basis that each requirement to be tested has an independent virtual test environment, functions of other requirements may be added to the test environment.
Specifically, the step 202 may include the following steps 202b1 and 202b2:
step 202b1 is to create a first virtual testing environment of the first requirement to be tested in a local environment based on a first configuration file corresponding to the first requirement to be tested and a second configuration file corresponding to the second requirement to be tested under the condition that a dependency relationship exists between the first requirement to be tested in the plurality of requirements to be tested and a second requirement to be tested in the plurality of requirements to be tested.
Step 202b2, testing the first requirement to be tested in the first virtual testing environment based on the first test script corresponding to the first requirement to be tested.
The first virtual test environment comprises a function corresponding to the second to-be-tested requirement.
The second configuration file is used for adding related functions of the second to-be-tested requirement in the first virtual testing environment. Specifically, the environment and the related dependence required by the second to-be-tested requirement can be added in the first testing environment according to the second configuration file, so that the related function of the second to-be-tested requirement is realized.
Alternatively, in the embodiment of the present application, a virtual test environment may be created for each demand to be tested by the following steps.
Specifically, the step 202 may further include the following steps 202c and 202d:
step 202c, analyzing a target configuration file corresponding to any target to-be-tested requirement in the multiple to-be-tested requirements, and determining target configuration information of the target to-be-tested requirement.
Wherein the target configuration information includes at least one of: file directory, first port number, second port number, access address.
Step 202d, creating a target dock container based on the target configuration information, and installing the environment and the related dependence required by the target requirement to be tested to obtain a target virtual test environment of the target requirement to be tested.
Wherein, the first port number is the port number of the local system; the second port number is the port number of the target dock container; and the access address is the access address of the target to-be-tested requirement in the local area network.
The file directory is used to indicate the path of the functional implementation files of the target requirements to be tested. For example, taking the target requirement to be tested as vue item, the file directory is used to indicate the path of the dist folder after the vue item is packaged.
The requirement may be tested remotely by other devices within the local area network or locally by local devices, for example, based on the access address.
Specifically, the step 202d may further include the following step 202d1:
step 202d1, when the target dock container is created, a mapping relationship between the first port number and the second port number is established, and after the target dock container is successfully created, a node service corresponding to the target requirement to be tested is started based on the file directory.
For example, in order to enable the normal access of the requirements to be tested in the local lan, port mapping needs to be performed on the test environment, that is, a mapping relationship is established between the port number of the target dock container (i.e., the second port number) and the port number of the local system (i.e., the first port number).
For example, in order to achieve the normal access of the target function corresponding to the target to-be-tested requirement, a node service is started in the target virtual test environment, and the normal access of the target function is achieved based on the node service.
For example, as shown in fig. 2, a flow chart of a virtual test environment for building a requirement to be tested in the embodiment of the present application is taken as an example to create virtual test environments of requirement 1, requirement 2 and requirement 3. Firstly, determining an engineering packaging catalog of each requirement according to a configuration file, taking vue engineering as an example, wherein the engineering packaging catalogs of the requirements are respectively: a dist1 directory, a dist2 directory, and a dist3 directory. Then, a container corresponding to each requirement, namely a virtual test environment, can be started through a dock run command, and a node service is started in the container through a server command. Taking the above requirement 1 as an example, the dock node container 1 can be generated by dock run-i-t-p 3000:3000node command, and at the same time, the command can also perform port mapping on 3000 ports of the container and 3000 ports of a local system. Then, in the dock node container 1, the node service can be started by a server-p 3000dist1 command, and then the establishment of the virtual test environment of the requirement 1 is completed. After the virtual test environment of the requirement 1 is built, the related functions of the requirement 1 can be accessed through the address 1 on any device (including the local device) in the local area network.
According to the demand testing method provided by the embodiment of the application, a plurality of demands to be tested, and configuration files and test scripts corresponding to each demand to be tested are obtained first; the plurality of requirements to be tested are requirements with association relation on business in the target project. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the multiple to-be-tested requirements is tested, releasing the multiple to-be-tested requirements into the production environment of the target project. Therefore, a developer can utilize local system resources to perform independent test of requirements, so that the efficiency of the requirement test is improved, and the accuracy of a test result is improved to a certain extent.
It should be noted that, in the demand test method provided in the embodiment of the present application, the execution body may be a demand test device, or a control module in the demand test device for executing the demand test method. In the embodiment of the present application, a method for executing a demand test by a demand test device is taken as an example, and the demand test device provided in the embodiment of the present application is described.
In the embodiment of the application, the method is shown in the drawings. The demand test method is exemplified by a drawing in combination with the embodiment of the present application. In specific implementation, the requirement testing method shown in the above method drawings may also be implemented in combination with any other drawing that may be combined and is illustrated in the above embodiment, and will not be repeated here.
The demand test device provided in the present application is described below, and the demand test method described below and the demand test method described above may be referred to correspondingly to each other.
Fig. 3 is a schematic structural diagram of a demand test device according to an embodiment of the present application, and as shown in fig. 3, the demand test device specifically includes:
the acquiring module 301 is configured to acquire a plurality of requirements to be tested, and a configuration file and a test script corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project; the environment construction module 302 is configured to create a virtual test environment corresponding to each requirement to be tested in the local environment according to the configuration file corresponding to each requirement to be tested; the requirement testing module 303 is configured to test each requirement to be tested in a virtual testing environment based on a test script corresponding to each requirement to be tested; and the publishing module 304 is configured to publish the plurality of requirements to be tested to a production environment of the target project after each of the plurality of requirements to be tested is tested.
Optionally, the acquiring module 301 is further configured to acquire an occupancy rate of a local system resource, and calculate a remaining system resource according to the occupancy rate of the local system resource; the environment construction module 302 is specifically configured to determine a target item set according to the remaining system resources and system resources required by each of the requirements to be tested in the requirements to be tested, and create a virtual test environment of each of the requirements to be tested in a local environment according to a configuration file corresponding to each of the requirements to be tested in the target item set; the requirement testing module 303 is specifically configured to test each requirement to be tested in the target project set based on a test script corresponding to each requirement to be tested in the target project set in a virtual testing environment of each requirement to be tested; the target item set is a set of requirements to be tested, which has the highest utilization rate of the remaining system resources, among the requirements which are not tested.
Optionally, the environment building module 302 is specifically configured to, in a case where there is a dependency relationship between a first requirement to be tested of the multiple requirements to be tested and a second requirement to be tested of the multiple requirements to be tested, create, in a local environment, a first virtual test environment of the first requirement to be tested based on a first configuration file corresponding to the first requirement to be tested and a second configuration file corresponding to the second requirement to be tested; the requirement testing module 303 is specifically configured to test the first requirement to be tested in the first virtual testing environment based on a first test script corresponding to the first requirement to be tested; the first virtual test environment comprises a function corresponding to the second to-be-tested requirement.
Optionally, the apparatus further comprises: a determining module; the determining module is configured to parse a target configuration file corresponding to any target to-be-tested requirement of the multiple to-be-tested requirements, and determine target configuration information of the target to-be-tested requirement; the target configuration information includes at least one of: a file directory, a first port number, a second port number, and an access address; the environment construction module 302 is specifically configured to create a target dock container based on the target configuration information, and install an environment and related dependencies required by the target to-be-tested requirement, so as to obtain a target virtual testing environment of the target to-be-tested requirement; wherein, the first port number is the port number of the local system; the second port number is the port number of the target dock container; and the access address is the access address of the target to-be-tested requirement in the local area network.
Optionally, the environment construction module 302 is specifically further configured to establish a mapping relationship between the first port number and the second port number when the target dock container is created, and after the target dock container is created successfully, start a node service corresponding to the target requirement to be tested based on the file directory.
Optionally, the issuing module 304 is specifically configured to change a testing state of a to-be-tested requirement for completing the test in the multiple to-be-tested requirements to a completed state; the publishing module 304 is specifically further configured to submit a manual audit when the testing status of each of the plurality of requirements to be tested is changed to a completed status, and publish the plurality of requirements to be tested to the production environment of the target project after the audit is passed.
The demand testing device provided by the application firstly obtains a plurality of demands to be tested, and configuration files and test scripts corresponding to each demand to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the multiple to-be-tested requirements is tested, releasing the multiple to-be-tested requirements into the production environment of the target project. Therefore, a developer can utilize local system resources to perform independent test of requirements, so that the efficiency of the requirement test is improved, and the accuracy of a test result is improved to a certain extent.
Fig. 4 illustrates a physical schematic diagram of an electronic device, as shown in fig. 4, which may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. The processor 410 may invoke logic instructions in the memory 430 to perform a demand test method comprising: firstly, acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the multiple to-be-tested requirements is tested, releasing the multiple to-be-tested requirements into the production environment of the target project.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present application also provides a computer program product comprising a computer program stored on a computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform a method of demand testing provided by the methods described above, the method comprising: firstly, acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the multiple to-be-tested requirements is tested, releasing the multiple to-be-tested requirements into the production environment of the target project.
In still another aspect, the present application further provides a computer readable storage medium, where the computer readable storage medium includes a stored program, where the program executes a demand test method provided by the above methods, and the method includes: firstly, acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project. And then, creating a virtual test environment corresponding to each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on the test script corresponding to each requirement to be tested. And finally, after each to-be-tested in the multiple to-be-tested requirements is tested, releasing the multiple to-be-tested requirements into the production environment of the target project.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (10)

1. A demand test method, comprising:
acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project;
creating a virtual test environment corresponding to each requirement to be tested in a local environment according to a configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual test environment based on a test script corresponding to each requirement to be tested;
and after each to-be-tested in the plurality of to-be-tested requirements is tested, releasing the plurality of to-be-tested requirements into the production environment of the target project.
2. The method for testing requirements according to claim 1, wherein creating a virtual testing environment of each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual testing environment based on the test script corresponding to each requirement to be tested, includes:
acquiring the occupancy rate of local system resources, and calculating the residual system resources according to the occupancy rate of the local system resources;
determining a target project set according to the residual system resources and the system resources required by each to-be-tested demand in the demands which are not tested in the plurality of to-be-tested demands, and creating a virtual test environment of each to-be-tested demand in a local environment according to a configuration file corresponding to each to-be-tested demand in the target project set;
testing each requirement to be tested in the target project set based on a test script corresponding to each requirement to be tested in the target project set in a virtual test environment of each requirement to be tested;
the target item set is a set of requirements to be tested, which has the highest utilization rate of the remaining system resources, among the requirements which are not tested.
3. The method for testing requirements according to claim 1, wherein creating a virtual testing environment of each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested, and testing each requirement to be tested in the virtual testing environment based on the test script corresponding to each requirement to be tested, includes:
under the condition that a dependency relationship exists between a first to-be-tested demand in the plurality of to-be-tested demands and a second to-be-tested demand in the plurality of to-be-tested demands, a first virtual testing environment of the first to-be-tested demand is created in a local environment based on a first configuration file corresponding to the first to-be-tested demand and a second configuration file corresponding to the second to-be-tested demand;
testing the first requirement to be tested in the first virtual testing environment based on a first testing script corresponding to the first requirement to be tested;
the first virtual test environment comprises a function corresponding to the second to-be-tested requirement.
4. The method for testing requirements according to claim 1, wherein creating a virtual testing environment for each requirement to be tested in a local environment according to the configuration file corresponding to each requirement to be tested comprises:
Analyzing a target configuration file corresponding to any target to-be-tested requirement in the multiple to-be-tested requirements, and determining target configuration information of the target to-be-tested requirement; the target configuration information includes at least one of: a file directory, a first port number, a second port number, and an access address;
creating a target dock container based on the target configuration information, and installing the environment and related dependence required by the target to-be-tested requirement to obtain a target virtual test environment of the target to-be-tested requirement;
wherein, the first port number is the port number of the local system; the second port number is the port number of the target dock container; and the access address is the access address of the target to-be-tested requirement in the local area network.
5. The method for testing requirements according to claim 4, wherein creating a target dock container based on the target configuration information, and installing an environment and related dependencies required by the target requirements to be tested to obtain a target virtual testing environment of the target requirements to be tested, includes:
and when the target dock container is created, a mapping relation between the first port number and the second port number is established, and after the target dock container is successfully created, a node service corresponding to the target to-be-tested requirement is started based on the file directory.
6. The demand testing method according to claim 1, wherein after each of the plurality of demands under test is tested, publishing the plurality of demands under test to the production environment of the target item comprises:
changing the test state of the to-be-tested requirements which are tested to be finished in the plurality of to-be-tested requirements to a finished state;
and submitting manual verification under the condition that the testing state of each to-be-tested requirement in the plurality of to-be-tested requirements is changed to a finished state, and releasing the plurality of to-be-tested requirements into the production environment of the target project after the verification is passed.
7. A demand testing apparatus, the apparatus comprising:
the acquisition module is used for acquiring a plurality of requirements to be tested, and configuration files and test scripts corresponding to each requirement to be tested; the plurality of requirements to be tested are requirements with association relation on business in the target project;
the environment construction module is used for creating a virtual test environment corresponding to each requirement to be tested in the local environment according to the configuration file corresponding to each requirement to be tested;
the demand test module is used for testing each demand to be tested based on a test script corresponding to each demand to be tested in the virtual test environment;
And the release module is used for releasing the plurality of requirements to be tested into the production environment of the target project after each of the plurality of requirements to be tested is tested.
8. The demand test device of claim 7, wherein the demand test device comprises,
the acquisition module is also used for acquiring the occupancy rate of the local system resources and calculating the residual system resources according to the occupancy rate of the local system resources;
the environment construction module is specifically configured to determine a target item set according to the remaining system resources and system resources required by each requirement to be tested in the requirements which are not tested in the multiple requirements to be tested, and create a virtual test environment of each requirement to be tested in a local environment according to a configuration file corresponding to each requirement to be tested in the target item set;
the demand test module is specifically configured to test each demand to be tested in the target item set in a virtual test environment of each demand to be tested based on a test script corresponding to each demand to be tested in the target item set;
the target item set is a set of requirements to be tested, which has the highest utilization rate of the remaining system resources, among the requirements which are not tested.
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 demand test method of any one of claims 1 to 6.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to execute the demand test method of any one of claims 1 to 6 by means of the computer program.
CN202310361962.9A 2023-04-06 2023-04-06 Demand testing method and device, storage medium and electronic device Pending CN116521455A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310361962.9A CN116521455A (en) 2023-04-06 2023-04-06 Demand testing method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310361962.9A CN116521455A (en) 2023-04-06 2023-04-06 Demand testing method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN116521455A true CN116521455A (en) 2023-08-01

Family

ID=87403774

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310361962.9A Pending CN116521455A (en) 2023-04-06 2023-04-06 Demand testing method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN116521455A (en)

Similar Documents

Publication Publication Date Title
US9294296B2 (en) Automated test execution in a shared virtualized resource pool
US9870313B2 (en) Unit-level formal verification for vehicular software systems
US20150100829A1 (en) Method and system for selecting and executing test scripts
US20150100832A1 (en) Method and system for selecting and executing test scripts
JP6788178B2 (en) Setting support program, setting support method and setting support device
CN107145437B (en) Java annotation test method and device
CN111198695A (en) Automatic deployment method of micro-service administration management platform and electronic equipment
US20150100831A1 (en) Method and system for selecting and executing test scripts
US10146674B2 (en) Plugin-based software verification system
CN111258913A (en) Automatic algorithm testing method and device, computer system and readable storage medium
CN110221845A (en) Using dispositions method, device, equipment and medium
CN107179982B (en) Cross-process debugging method and device
CN115034173A (en) Test method of chip simulation model
CN103176903B (en) The test method and equipment of MapReduce distributed system program
CN110187890B (en) Project deployment method, electronic equipment and storage medium
CN117041111A (en) Vehicle cloud function test method and device, electronic equipment and storage medium
CN110971478B (en) Pressure measurement method and device for cloud platform service performance and computing equipment
CN110471828B (en) Operating system testing method, device and equipment thereof
CN115617668A (en) Compatibility testing method, device and equipment
CN115237441A (en) Upgrade test method, device and medium based on cloud platform
CN116521455A (en) Demand testing method and device, storage medium and electronic device
CN113868140A (en) Automatic testing method and storage medium
CN113672260A (en) CPU initialization method for processor
CN112015436A (en) Short message platform deployment method and device, computing equipment and computer storage medium
CN115373696B (en) Low code configuration method, system, equipment and storage medium for software resource generation

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