CN114116495A - Test method and device, electronic equipment and storage medium - Google Patents

Test method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114116495A
CN114116495A CN202111445470.5A CN202111445470A CN114116495A CN 114116495 A CN114116495 A CN 114116495A CN 202111445470 A CN202111445470 A CN 202111445470A CN 114116495 A CN114116495 A CN 114116495A
Authority
CN
China
Prior art keywords
test
service
code block
file
server
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.)
Withdrawn
Application number
CN202111445470.5A
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 Sensetime Lingang Intelligent Technology Co Ltd
Original Assignee
Shanghai Sensetime Lingang 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 Sensetime Lingang Intelligent Technology Co Ltd filed Critical Shanghai Sensetime Lingang Intelligent Technology Co Ltd
Priority to CN202111445470.5A priority Critical patent/CN114116495A/en
Publication of CN114116495A publication Critical patent/CN114116495A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management

Abstract

The present disclosure relates to a testing method and apparatus, an electronic device, and a storage medium, where the method is applied to a client, and includes: sending a test request to a server so that the server starts a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user; responding to a message that the service starting is successful and sent by the server, sending a test task to the server so that the server executes the test task through the test service and at least one running service, wherein the test task comprises position information of a test file to be executed of at least one user, and the test file comprises at least one code block; and receiving and storing a first test result sent by the server, wherein the first test result comprises a first execution time length of each code block in the test file and/or first resource occupation information of each code block. The embodiment of the disclosure can realize the performance test of the test file.

Description

Test method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a test method and apparatus, an electronic device, and a storage medium.
Background
With the popularization of artificial intelligence, the artificial intelligence online programming education gradually becomes an important component of primary and secondary schools and higher education. Program files in online programming education are typically written on a Web page (Web) running on a remote cluster of servers. In the related art, when a program file in online programming education is tested, the program file usually runs locally, and the testing mode has a large difference between a testing environment and a real operating environment and cannot meet testing requirements such as performance testing and the like.
Disclosure of Invention
The present disclosure provides a testing solution.
According to an aspect of the present disclosure, there is provided a testing method applied to a client, including: sending a test request to a server so that the server starts a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user; responding to a message that service starting is successful and sent by the server, sending a test task to the server, so that the server executes the test task through the test service and the at least one running service, wherein the test task comprises position information of a test file to be executed of the at least one user, and the test file comprises at least one code block; and receiving and storing a first test result sent by the server, wherein the first test result comprises a first execution time length of each code block in the test file and/or first resource occupation information of each code block.
According to the test method of the embodiment, based on a client-server architecture, when a test file is tested, a client can send a test request including resource configuration information and at least one user identity information to a server and a test task including position information of the test file, so that the server starts a test service and at least one operation service to simulate a real operation environment of the test file, and executes the test task through the test service and the at least one operation service to obtain a performance test result including a first execution duration and/or first resource occupation information of each code block in the test file, and performance test of the test file is achieved.
In one possible implementation, the method further includes: and carrying out statistical analysis on the first test result to obtain a second test result.
In the embodiment of the application, the first test result can be subjected to statistical analysis to obtain the second test result, and the second test result can be regarded as a performance test result after statistical analysis, so that the test is convenient to check and can be used for guiding the deployment of a real operating environment.
In a possible implementation manner, the performing a statistical analysis on the first test result to obtain a second test result includes: for any test file, determining a second execution time length of the test file according to the first execution time length of each code block in the test file; and/or for any test file, determining second resource occupation information of the test file according to the first resource occupation information of each code block in the test file; wherein the second test result includes the second execution duration and/or the second resource occupation information.
In the embodiment of the application, the second execution duration and/or the second resource occupation information of each test file can be determined, so that a performance test result when the test files are taken as a whole is obtained.
In one possible implementation, the method further includes: receiving a third test result sent by the server, wherein the third test result is used for indicating whether the function of each code block in the test file is correct or not; and determining a function test result of the test file according to the third test result.
In the embodiment of the application, the function test result of the test file can be determined according to the third test result which is used for indicating whether the function of each code block in the test file is correct, so that the function test of the test file can be realized.
In one possible implementation, the method further includes: and sending a test stopping request to the server under the condition that a preset test finishing condition is met, so that the server stops executing the test task.
In the embodiment of the application, the client sends the test stop request to the server to stop the execution of the test task under the condition that the preset test end condition is met, so that the client can control the test process.
According to an aspect of the present disclosure, there is provided a testing method applied to a server, including: responding to a test request sent by a client, starting a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user; after the test service and at least one running service are started successfully, sending a message that the service is started successfully to the client; responding to a test task sent by the client, executing the test task through the test service and the at least one running service to obtain a first test result, wherein the test task comprises position information of a test file to be executed by the at least one user, the test file comprises at least one code block, and the first test result comprises first execution duration of each code block and/or first resource occupation information of each code block; and sending the first test result to the client.
According to the testing method disclosed by the embodiment of the disclosure, the server can start the testing service and the at least one running service to simulate the real running environment of the test file according to the testing request which is sent by the client and comprises the resource configuration information and the identity information of the at least one user, execute the testing task through the testing service and the at least one running service when receiving the testing task sent by the client, obtain the first testing result (namely the performance testing result) comprising the first execution duration and/or the first resource occupation information of each code block in the test file, and send the first testing result to the client, so that the performance testing of the test file is realized.
In a possible implementation manner, the starting at least one running service according to the test request includes: starting at least one container according to the resource configuration information in the test request; initiating a running service in the at least one container.
In the embodiment of the disclosure, the server can start at least one container according to the resource configuration information in the test request, and start the running service in the at least one container, which is not only convenient for the server to schedule and manage the running service, but also makes the test environment of the running service closer to the real running environment.
In a possible implementation manner, the executing the test task through the test service and the at least one running service to obtain a first test result includes: establishing a network connection for the test service and the at least one running service; obtaining a test file to be executed indicated by the test task through the test service, and determining a target user to which the test file belongs from the at least one user; sending each code block in the test file to an operation service corresponding to the target user through the test service; and executing each code block in the test file through the running service corresponding to the target user to obtain a first test result.
In the embodiment of the disclosure, the execution of the code block on the real server cluster can be simulated through the interaction of the test service and at least one running service, so that the performance indexes such as the first execution duration and/or the first resource occupation information of the code block can be tested.
In a possible implementation manner, the first test result further includes an execution result of each code block in the test file, and the method further includes:
for any code block, determining a third test result of the code block according to an expected execution result of the code block and an execution result of the code block in the first test result, wherein the third test result is used for indicating whether the function of the code block is correct or not; and sending the third test result to the client.
In the embodiment of the disclosure, whether the function of each code block is correct can be determined according to the execution result and the expected execution result of each code block in the first test result, and a third test result, that is, a function test result of each code block, is obtained, so that the function test of each code block can be realized while the performance test of each code block of the test file is performed.
In one possible implementation, the method further includes: and stopping executing the test task in response to a test stop request sent by the client.
In the embodiment of the application, the server stops executing the test task to finish the test when receiving the test stop request sent by the client, so that the client can control the test process.
According to an aspect of the present disclosure, there is provided a testing apparatus applied to a client, including: the system comprises a first sending module, a second sending module and a third sending module, wherein the first sending module is used for sending a test request to a server so that the server starts a test service and at least one running service according to the test request, and the test request comprises resource configuration information and identity information of at least one user; the second sending module is used for responding to a message that the service starting is successful and sent by the server, sending a test task to the server, so that the server executes the test task through the test service and the at least one running service, wherein the test task comprises position information of a test file to be executed by the at least one user, and the test file comprises at least one code block; the first receiving module is configured to receive and store a first test result sent by the server, where the first test result includes a first execution duration of each code block in the test file and/or first resource occupation information of each code block.
According to an aspect of the present disclosure, there is provided a testing apparatus applied to a server, including: the service starting module responds to a test request sent by a client, starts a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user, and the running service corresponds to the user one to one; the third sending module is used for sending a message that the service is successfully started to the client after the test service and at least one running service are successfully started; the test execution module is used for responding to a test task sent by a client, executing the test task through the test service and the at least one running service, and obtaining a first test result, wherein the test task comprises position information of a test file to be executed by the at least one user, the test file comprises at least one code block, and the first test result comprises first execution duration of each code block and/or first resource occupation information of each code block; and the fourth sending module is used for sending the first test result to the client.
According to an aspect of the present disclosure, there is provided an electronic device including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described method.
According to the test method, based on a client-server architecture, when a test file is tested, a client can send a test request to a server, wherein the test request comprises resource configuration information and identity information of at least one user, so that the server starts a test service and at least one running service according to the test request; responding to a message that the service starting is successful and sent by the server, sending a test task to the server by the client, wherein the test task comprises position information of a test file (comprising at least one code block) to be executed of at least one user, so that the server executes the test task through the test service and at least one running service; the method comprises the steps of receiving and storing a first test result sent by a server, wherein the first test result comprises first execution time length of each code block and/or first resource occupation information of each code block, so that a test request comprising resource configuration information and identity information of at least one user and a test task comprising position information of a test file can be sent to the server, the server starts a test service and at least one operation service to simulate a real operation environment of the test file, the test task is executed through the test service and the at least one operation service, a performance test result comprising the first execution time length and/or the first resource occupation information of each code block in the test file is obtained, and performance test on the test file is achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 shows a flow diagram of a testing method according to an embodiment of the present disclosure.
FIG. 2 shows a flow diagram of a testing method according to an embodiment of the present disclosure.
Fig. 3 shows a schematic diagram of an application scenario of a testing method according to an embodiment of the present disclosure.
FIG. 4 shows a block diagram of a test apparatus according to an embodiment of the present disclosure.
FIG. 5 shows a block diagram of a test apparatus according to an embodiment of the present disclosure.
Fig. 6 illustrates a block diagram of an electronic device in accordance with an embodiment of the disclosure.
Fig. 7 shows a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
In one possible implementation, online programming education is conducted through an online programming system. When in class, users (including teachers, students and the like) log in the online programming system and write program files on webpages; after the program file is written, the source code in the program file is sent to a server cluster which is centrally deployed at a remote end to be executed; after the server cluster completes execution, an execution result is returned so that a user can view the execution result on a webpage.
In order to better simulate the writing and running of a program file based on a webpage in online programming education so as to perform function and performance tests on the program file, the test method of the embodiment of the disclosure adopts a test framework of a Client-Server (Server). The client may be configured to manage a test, for example, send a test request, a test task, analyze a test result, and the like; the server can be used for simulating the running environment of the tested object (such as a webpage-based program file in online programming education) and executing the test.
In a possible implementation manner, the client of the embodiment of the disclosure may be deployed on a terminal device such as a desktop computer, a notebook computer, a tablet computer, and an industrial personal computer, and the disclosure does not limit the specific type of the terminal device. In one possible implementation, the testing method of the embodiments of the present disclosure may be implemented by a processor calling computer-readable instructions stored in a memory.
In one possible implementation, the client and the server in the embodiments of the present disclosure may be physically connected through a wired network (e.g., a network connected through a coaxial cable, a twisted pair, an optical fiber, etc.), or may be physically connected through a Wireless network (e.g., a Wireless Local Area Network (WLAN), a Wireless Fidelity (Wi-Fi) network, etc.). The network connection mode between the client and the server can be set by those skilled in the art according to practical situations, and the present disclosure does not limit this.
In a possible implementation manner, the client and the server in the embodiment of the present disclosure may communicate with each other through a web socket Protocol (WebSocket) or a hypertext Transfer Protocol (HTTP). Those skilled in the art can set the communication mode between the client and the server according to the actual situation, and the application is not limited to this.
Fig. 1 shows a flowchart of a testing method according to an embodiment of the present disclosure, the method is applied to a client, as shown in fig. 1, the testing method includes:
in step S11, sending a test request to a server, so that the server starts a test service and at least one running service according to the test request, where the test request includes resource configuration information and identity information of at least one user;
in step S12, in response to the message that the service start is successful, sending a test task to the server, so that the server executes the test task through the test service and the at least one running service, where the test task includes location information of a test file to be executed by the at least one user, and the test file includes at least one code block;
in step S13, a first test result sent by the server is received and stored, where the first test result includes a first execution duration of each code block and/or first resource occupation information of each code block.
In one possible implementation, the test file of the disclosed embodiment may be a program file written locally, executed on a remote cluster of servers. The server cluster may execute program files for multiple users simultaneously. The test files may include web-based program files, i.e., program files written on local web pages that execute on a remote cluster of servers.
In one possible implementation, the test files may include web-based program files in online programming education. For example, the test file may be a program file created in a Jupyter notebook environment, the Jupyter notebook environment is a web-based interactive computing notebook environment, which facilitates users to create and share program files, supports real-time codes (including real-time writing codes, real-time execution codes, etc.), mathematical equations, visualizations (e.g., pictures, diagrams, etc.), and markup languages (e.g., markdown, etc.), and the program file created in the Jupyter notebook environment may be referred to as a notebook file (i.e., a Jupyter notebook file, hereinafter, simply referred to as a notebook file), and the notebook file is widely used in the fields of artificial intelligence online programming education, machine learning, etc.
In one possible implementation, the test files may also include web-based program files in the fields of artificial intelligence education, online programming platforms, artificial intelligence platforms, and the like. It should be noted that the present disclosure does not limit the specific field to which the test file belongs. The test method of the embodiment of the present disclosure will be exemplarily described below by taking a test file as a network-based program file in the online programming education field as an example.
In one possible implementation, the test file may include at least one code block. The source code in the test file may be determined to be at least one code block according to the test requirements. For example, a special comment for marking a code block may be added to the test file, and then the source code between two special comments may be determined as one code block.
And determining the source code in the test file into at least one code block according to the structure of the test file and a preset rule. For example, when the test file is a notebook file, since the notebook file supports mixed writing of code and non-code content (e.g., text, pictures, data formulas, etc.), a source code block that is continuously written (i.e., contains no non-code content in the middle) in the notebook can be regarded as one code block.
It should be noted that, a person skilled in the art may determine the test file as at least one code block according to actual test requirements, and the present disclosure does not limit the determination manner of the code blocks in the test file, the number of the code blocks, and the like.
In a possible implementation manner, when testing the test file, in step S11, a test request may be sent to the server, where the test request includes the resource configuration information and the identity information of at least one user. The resource configuration information may be used to indicate hardware resource information such as a processor and a memory (memory) when executing the test file, where the processor may be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a Neural Network Processing Unit (NPU), or the like. For example, the resource configuration information may be 1 CPU, 2 GPUs, and 1G memory. Those skilled in the art can set the resource configuration information according to actual test requirements, which is not limited by the present disclosure.
In order to better simulate a real use scenario, during testing, at least one user can be simulated to log in the online programming system simultaneously/concurrently, and therefore, the test request sent by the client to the server includes IDentity information (e.g., an IDentity (ID) of the at least one user, etc.) of the at least one user, which is convenient for the server to simulate the at least one user to log in the online programming system simultaneously/concurrently according to the IDentity information.
After receiving the test request sent by the client, the server can start the test service, create at least one user according to the identity information of at least one user in the test request to simulate the simultaneous/concurrent login of at least one user to the online programming system, and start at least one running service according to the resource configuration information in the test request. And after the test service and at least one running service are started successfully, the server sends a message that the service is started successfully to the client.
In a possible implementation manner, after receiving the message sent by the server that the service start is successful, the client may execute step S12 to send a test task to the server, where the test task may include location information of a test file to be executed by at least one user.
The server has access to the test file, which may be stored at the server or elsewhere accessible to the server. When the client sends the test task to the server, the client may indicate, in the test task, identity information of a user to which the test file to be executed belongs (i.e., a correspondence between the test file to be executed and the user) and location information of the test file to be executed (e.g., a file directory, etc.). I.e. the test task may comprise location information of the test files to be executed by the at least one user.
The server responds to the test task sent by the client, and can execute the test task through the test service and at least one running service to obtain a first test result, wherein the first test result can comprise a first execution time length of each code block in the test file and/or first resource occupation information of each code block.
The first execution duration may be used to indicate that the execution of the code block is time consuming, i.e., the time it takes (or takes) the code block to execute from the beginning to the end. The first resource occupation information may include at least one of CPU usage, GPU usage, NPU usage, memory usage, and the like when the code block is executed. In one possible implementation, the information category in the first resource occupation information may correspond to a hardware resource in the resource configuration information. The information category in the first resource occupation information may be set by a person skilled in the art according to practical situations, and the disclosure does not limit this.
In a possible implementation manner, after obtaining the first test result, the server may send the first test result to the client, and the client may receive and store the first test result sent by the server in step S13. The first test result may include the first execution duration of each code block in the test file and/or the first resource occupation information of each code block, and thus, the first test result may be regarded as a performance test result of the test file.
In a possible implementation manner, when performing a performance test on a test file, in order to perform the test under different resource restriction conditions, different resource information may be configured in the resource configuration information in the test request and then sent to the server, so that the server may simulate different resource conditions and perform the test on the test file under different resource conditions.
According to the test method, based on a client-server architecture, when a test file is tested, a client can send a test request to a server, wherein the test request comprises resource configuration information and identity information of at least one user, so that the server starts a test service and at least one running service according to the test request; responding to a message that the service starting is successful and sent by the server, sending a test task to the server by the client, wherein the test task comprises position information of a test file (comprising at least one code block) to be executed of at least one user, so that the server executes the test task through the test service and at least one running service; the method comprises the steps of receiving and storing a first test result sent by a server, wherein the first test result comprises first execution time length of each code block and/or first resource occupation information of each code block, so that a test request comprising resource configuration information and identity information of at least one user and a test task comprising position information of a test file can be sent to the server, the server starts a test service and at least one operation service to simulate a real operation environment of the test file, the test task is executed through the test service and the at least one operation service, a performance test result comprising the first execution time length and/or the first resource occupation information of each code block in the test file is obtained, and performance test on the test file is achieved.
In one possible implementation, when performing a performance test on a test file, a client may send multiple identical or different test tasks to a server. And the server executes the test tasks after receiving the plurality of test tasks sent by the client, and finishes the performance test after the plurality of test tasks are executed. For example, after receiving a plurality of test tasks, the server does not receive the test tasks more than a preset time, or after executing a preset number of test tasks, the server automatically ends the test.
In a possible implementation manner, when performing a performance test on a test file, a client may periodically send a plurality of identical or different test tasks to a server, so that the server is always in a state of executing the test tasks. In the testing process, the client can also judge whether a preset testing end condition is met.
For example, in the performance test, the test end condition may be that the test duration reaches a preset duration threshold, where the duration threshold may be, for example, 2 hours, 6 hours, 12 hours, and the like, and the client may determine whether the test duration is greater than or equal to the duration threshold, or may determine whether the countdown of the test duration from the duration threshold is ended; the test ending condition may also be that the execution turn of the test task reaches a preset turn threshold, where the turn threshold may be, for example, 10, 20, 50, and the like, and the client may determine whether the execution turn of the test task is greater than or equal to the turn threshold. It should be noted that, a person skilled in the art may set the specific content of the test termination condition according to the actual situation, and the disclosure does not limit this.
In a possible implementation manner, the client may send a test stop request to the server in a case that a preset test end condition is met, so that the server stops executing the test task. In this way, the client can control the testing process.
In one possible implementation, the method may further include: and carrying out statistical analysis on the first test result to obtain a second test result.
After a first test result (i.e., a performance test result) including the first execution duration of each code block and/or the first resource occupation information of each code block in the test file is obtained, the first test result is subjected to statistical analysis in the modes of averaging, summing, selecting a maximum value, selecting a minimum value and the like to obtain a second test result. The second test result can be regarded as a performance test result after statistical analysis and can be represented by a report.
In one possible implementation, the second test result may include a performance test result of each code block in the test file after statistical analysis. For example, assuming that the first test result includes the first execution duration of each code block in the test file, and each code block is executed for multiple times, for any code block, the first test result includes multiple first execution durations of the code block, and the multiple first execution durations of the code block may be statistically analyzed by averaging, selecting a maximum value, and selecting a minimum value, to obtain a statistical result, where the statistical result may include an average value, a maximum value, and a minimum value of the first execution durations of the code block; the statistical result may be used as a second test result. When the first test result includes the first resource occupation information of each code block in the test file, the statistical analysis manner is similar to that of the first execution duration, and details are not repeated here.
In a possible implementation manner, the first test result may be statistically analyzed according to different resource configurations to obtain a second test result. In this example, the second test result may include a statistically analyzed performance test result of each code block in the test file under different resource configurations.
It should be noted that, a person skilled in the art can perform statistical analysis on the first test result according to actual needs, and the disclosure does not limit the specific manner of the statistical analysis.
By the method, the performance test result after statistical analysis can be obtained, so that the user can conveniently check the performance test result, and the performance test result can also be used for guiding the deployment of a real operating environment.
In a possible implementation manner, performing a statistical analysis on the first test result to obtain a second test result may include: for any test file, determining a second execution time length of the test file according to the first execution time length of each code block in the test file; and/or for any test file, determining second resource occupation information of the test file according to the first resource occupation information of each code block in the test file; wherein the second test result includes the second execution duration and/or the second resource occupation information.
And when the first test result is subjected to statistical analysis, the second execution duration of each test file can be determined. The second execution duration may be used to indicate that the execution of the test file is time consuming, i.e., the time it takes (or spent) for the test file to execute from the beginning to the end of execution.
For example, for any test file, when the test file includes a plurality of code blocks, and the second execution duration of the test file is determined, the first execution duration of each code block of the test file may be selected from the first test result, the average value, the minimum value, and the maximum value of the first execution duration of each code block may be determined, and then the average value, the minimum value, and the maximum value of the first execution duration of each code block may be summed respectively to obtain the average value, the minimum value, and the maximum value of the second execution duration of the test file. The second test result may include a second execution duration of the test file.
And when the first test result is subjected to statistical analysis, second resource occupation information of the test file can be determined. For example, for any test file, when the test file includes a plurality of code blocks and the second resource occupation information of the test file is determined, the first resource occupation information of each code block of the test file may be selected from the first test result, and a maximum value (for example, a maximum value of CPU utilization, a maximum value of memory usage, and the like) in the first resource occupation information of each code block may be determined, and then the maximum value in the first resource occupation information of each code block may be determined as the second resource occupation information of the test file. The second test result may include second resource occupation information of the test file.
By the method, the second execution time length and/or the second resource occupation information of each test file can be determined, so that a performance test result when the test files are taken as a whole is obtained. It should be noted that, the specific manner of statistical analysis is described above only by taking averaging, summing, selecting a maximum value, selecting a minimum value, etc. as examples, and in practical applications, a person skilled in the art may select a suitable statistical analysis manner, which is not limited by the present disclosure.
In one possible implementation, the method may further include: receiving a third test result sent by the server, wherein the third test result is used for indicating whether the function of each code block in the test file is correct or not; and determining a function test result of the test file according to the third test result.
When the client receives a third test result which is sent by the server and used for indicating whether the function of each code block in the test file is correct or not, whether the function of the test file is correct or not can be judged according to the third test result, and therefore the function test result of the test file is obtained.
For example, the test file is a notebook file, the notebook file includes 5 code blocks, and in the third test result, when the functions of the 5 code blocks of the notebook file are all correct, the function of the notebook file can be considered to be correct, and the function test result is that the test is passed, otherwise, the function of the notebook file can be considered to be incorrect, and the function test result is that the test is failed.
In this way, the function test result of the test file can be determined according to the third test result for indicating whether the function of each code block in the test file is correct, so that the function test of the test file is realized.
Fig. 2 shows a flowchart of a testing method according to an embodiment of the present disclosure, the method is applied to a server, and as shown in fig. 2, the testing method includes:
in step S21, in response to a test request sent by a client, according to the test request, starting a test service and at least one running service, where the test request includes resource configuration information and identity information of at least one user;
in step S22, after the test service and the at least one running service are successfully started, sending a message that the service is successfully started to the client;
in step S23, in response to a test task sent by the client, executing the test task through the test service and the at least one running service to obtain a first test result, where the test task includes location information of a test file to be executed by the at least one user, the test file includes at least one code block, and the first test result includes a first execution duration of each code block and/or first resource occupation information of each code block;
in step S24, the first test result is sent to the client.
In a possible implementation manner, in the case that the server receives the test request sent by the client, the server may start the test service and start at least one running service according to the test request in step S21. The test request may include resource configuration information and identity information of at least one user.
The server can create at least one user according to the identity information of the at least one user in the test request to simulate the simultaneous/concurrent login of the at least one user to the online programming system, and start the test service and the at least one running service according to the resource configuration information in the test request. The execution environment of each execution service is based on the hardware resources indicated in the resource configuration information. The running services are isolated from each other and do not interfere with each other.
In one possible implementation manner, the number of running services started by the server is consistent with the number of users, that is, the running services correspond to the users one to one. The correspondence between the running service and the user may be established based on the identity information of the user. In this way, an independent operating environment can be provided for each user, so that the operating environments of each user are mutually isolated and interfere complementarily.
In a possible implementation manner, the number of running services started by the server may also be smaller than the number of users, that is, a plurality of users correspond to one running service. The correspondence between the running service and the user may be established based on the identity information of the user. In this way system resources can be saved. It should be noted that, the number of the running services can be determined by those skilled in the art according to actual situations, and the disclosure is not limited thereto.
In one possible implementation, the testing service on the server may be used to simulate the client in a real online programming education scenario, and the at least one running service on the server may be used to simulate the running service on the server cluster in the real online programming education scenario.
In one possible implementation, step S21 may include: starting at least one container according to the resource configuration information in the test request; initiating a running service in the at least one container.
The server may create a container based on the resource configuration information in the test request and initiate a run service in the container. For example, the server may launch at least one container based on kubernet (K8S), the resource configuration of each container being consistent with the resource configuration information in the test request; after the at least one container is started, a running service may be started in each container.
By the method, the server can start at least one container according to the resource configuration information in the test request, and start the running service in the at least one container, so that the server can conveniently schedule and manage the running service, and the test environment of the running service is closer to the real running environment.
In a possible implementation manner, after the test service and the at least one running service are successfully started, the server may send a message that the service is successfully started to the client in step S22, so that the client performs subsequent processing.
In a possible implementation manner, when the server receives the test task sent by the client, the server may execute step S23, and execute the test task through the test service and the running service to obtain a first test result. The test task may include location information of a test file to be executed by at least one user.
When the testing task is executed, the testing service is used for simulating the testing service of the client in a real online programming education scene, the testing file can be read according to the position information of the testing file to be executed of at least one user, and the code block in the testing file is identified. Wherein the test file may be, for example, a web-based program file in online programming education, and the test file may include at least one code block.
For example, when a special comment for marking a code block is contained in a test file, the test service may recognize the source code between two special comments as one code block. For another example, when the test file is a notebook file written in a mixture of supporting code and non-code content (e.g., text, pictures, data formulas, etc.), the test service may identify a source code block written continuously (i.e., without non-code content in the middle) in the notebook as one code block.
It should be noted that, a person skilled in the art may determine the identification manner of the code blocks in the test file according to the actual test requirement, and the disclosure does not limit this.
After the test service identifies the code blocks in the test file, the identified code blocks can be sent to at least one running service for execution to obtain a first test result, wherein the at least one running service can be used for simulating running services on a server cluster in a real online programming education scene.
In one possible implementation manner, the first test result may include a first execution duration of each code block and/or first resource occupation information of each code block. The first execution duration may be used to indicate that the execution of the code block is time consuming, i.e., the time it takes (or takes) the code block to execute from the beginning to the end.
The first execution duration of the code block may be recorded by the test service, for example, when the running service executes the code block, the test service may determine and record the first execution duration of the code block according to the execution information such as the start execution time, the end execution time, and the like of the code block.
The first resource occupation information of the code block may also be obtained by the test service from a service performing resource management or monitoring. For example, when the running service runs in the container of K8S, K8S may monitor the system resources used during the execution of each code block, and the testing service may obtain the first resource occupation information of each code block from the monitoring service of K8S.
In one possible implementation, step S23 may include: establishing a network connection for the test service and the at least one running service; obtaining a test file to be executed indicated by the test task through the test service, and determining a target user to which the test file belongs from the at least one user; sending each code block in the test file to an operation service corresponding to the target user through the test service; and executing each code block in the test file through the running service corresponding to the target user to obtain a first test result.
When a test task is executed, in order to simulate a real online programming education scene, network connection can be established between a test service on a server and at least one running service in a mode of a WebSocket protocol and the like; after the network connection is established, the test service can read the test file to be executed indicated by the test task according to the position information of the test file to be executed of at least one user in the test task, determine a target user to which the test file belongs from the at least one user, and then send each code block in the test file to the running service corresponding to the target user through the network; and executing each received code block by the running service corresponding to the target user to obtain a first test result.
By the method, the execution of the code block on the real server cluster can be simulated through the interaction of the test service and at least one running service, so that the performance indexes such as the first execution duration and/or the first resource occupation information of the code block can be tested.
In one possible implementation, the first test result may further include an execution result of each code block, and the client/server may determine whether the function of the code block is correct based on the execution result.
In a possible implementation manner, after obtaining the first test result, the server may send the first test result to the client in step S24, so that the client performs statistical analysis on the first test result to obtain a second test result.
In a possible implementation manner, when performing a performance test on a test file, in order to perform the test under different resource restriction conditions, a client may configure different resource information in the resource configuration information in the test request and then send the resource configuration information to a server, and the server may simulate different resource conditions according to the resource configuration information in the test request and perform the performance test on the test file under different resource conditions.
The testing method of the embodiment is based on a client-server architecture, when a test file is tested, a client can send a testing request comprising resource configuration information and identity information of at least one user to a server, the server responds to the testing request sent by the client, can start testing service and at least one running service according to the testing request, and sends a message that the service is started successfully to the client after the testing service and the at least one running service are started successfully; and responding to the test task sent by the client, executing the test task through the test service and at least one running service to obtain a first test result, wherein the first test result comprises the first execution duration of each code block and/or the first resource occupation information of each code block.
In this way, the server can start the test service and the at least one running service to simulate the real running environment of the test file according to the test request which is sent by the client and comprises the resource configuration information and the identity information of the at least one user, execute the test task through the test service and the at least one running service when receiving the test task sent by the client, obtain the first execution duration and/or the first test result of the first resource occupation information of each code block in the test file, and send the first test result (namely the performance test result) to the client, so that the performance test of the test file can be realized.
In one possible implementation, the first test result may further include an execution result of each code block, and the method may further include: for any code block, determining a third test result of the code block according to an expected execution result of the code block and an execution result of the code block in the first test result; and sending the third test result to the client.
Prior to testing, expected execution results for individual blocks of code in the test file may be determined. In the case that the first test result includes the execution result of each code block, for any code block, a third test result of the code block may be determined according to the execution result of the code block and the expected execution result thereof in the first test result, where the third test result is used to indicate whether the function of the code block is correct.
For example, for any code block, it may be determined whether the execution result of the code block in the first test result is consistent with its expected execution result, and if the two are consistent, the function of the code block may be considered to be correct; if the two are not consistent, the function of the code block can be considered to be incorrect, and the user can be prompted to have the code block wrong and needs to be modified in the modes of prompting information, highlighting the code block and the like.
In this way, whether the function of each code block is correct can be determined according to the execution result and the expected execution result of each code block in the first test result, and a third test result, that is, the function test result of each code block, is obtained, so that the function test of each code block can be realized while the performance test of each code block of the test file is performed.
In one possible implementation, the method further includes: and stopping executing the test task in response to a test stop request sent by the client. That is, the server may stop executing the test task to end the test when receiving the test stop request sent by the client, so that the client may control the test process.
An application scenario and a processing procedure of the testing method according to the embodiment of the present application will be exemplarily described below with reference to fig. 3, taking the test file as a notebook file in online programming education as an example.
Fig. 3 shows a schematic diagram of an application scenario of a testing method according to an embodiment of the present disclosure. As shown in fig. 3, the testing method implemented in the present application can be used for performing performance testing and function testing on a program file based on a web page.
As shown in fig. 3, the test system architecture applying the test method of the embodiment of the present application includes a client 100 and a server 200, and a test service 210 and a plurality of running services 220 run on the server 200. The number of the running services 220 may be at least one, and a plurality of running services 220 are illustrated as an example in fig. 3.
Wherein the client 100 can be used to manage the testing, the testing service 210 on the server 200 can be used to simulate the client in a real online programming education scenario, and the plurality of running services 220 on the server 200 can be used to simulate the running services on a server cluster in a real online programming education scenario.
When the performance of the test file notebook file is carried out, the specific process is as follows:
(1) the client 100 sends a test request to the server 200, where the test request includes resource configuration information preset according to a test requirement and identity information of multiple users, where the number of the users may be at least one, and the example is described with 50 as an example.
When performing the performance test, the client 100 may send a plurality of test requests to the server, where resource configuration information in the plurality of test requests may be the same or different, and may be determined according to actual situations.
(2) The server 200 responds to the test request sent by the client 100, and starts 50 running services (i.e. notebook server)220 at the test service 210 level according to the test request. For example, in the case where the running service 220 on the server 200 is implemented based on the container of K8S, when 50 test services 220 are started, 50 containers corresponding to the resource configuration information may be started through the scheduling system in K8S according to the resource configuration information in the test request, and one running service 220 may be started in each container. In this example, the number of running services is the same as the number of users, i.e., the running services correspond one-to-one to the users.
(3) After the test service 210 and the 50 running services 220 are successfully started, the server 200 sends a message that the service start is successful to the client 100.
(4) The client 100 sends a test task to the server 200 in response to the message sent by the server 200 that the service start is successful, where the test task includes location information of test files (i.e., notebook files) to be executed by 50 users, and each test file includes at least one code block.
(5) The server 200 responds to the test task sent by the client 100, and executes the test task through the test service 210 and the 50 running services 220 to obtain a first test result, where the first test result includes a first execution duration and/or first resource occupation information (i.e., a performance test result) of each code block in a notebook file (i.e., a test file), and the first test result may also include an execution result of each code block.
In the case that the test file is a notebook file, the process of executing the test task by the test service 210 and the 50 running services 220 may be:
the test service 210 acquires the notebook file to be executed according to the position information of the notebook file to be executed indicated by the test task;
for any notebook file, the test service 210 may determine a target user to which the notebook file belongs from 50 users, then request a running service (notebook server)220 corresponding to the target user to establish a kernel (kernel) required for running a notebook code, and then send each code block (cell) in the notebook file to the running service 220 corresponding to the target user;
after receiving each code block sent by the test service, the running service corresponding to the target object executes each code block through kernel to obtain an execution result of each code block;
during the execution of each code block, the test service 210 may obtain the first execution duration of each code block, and obtain the first resource occupation information of each code block from K8S, so as to obtain a first test result, that is, a performance test result of each code block.
The first execution duration of each code block, the first resource occupation information of each code block, and the execution result of each code block may be used as the first test result.
(6) For any code block, the test service 210 may further determine a third test result of the code block according to the expected execution result of the code block and the execution result of the code block in the first test result, where the third test result is used to indicate whether the function of the code block is correct.
(7) After obtaining the first test result and the third test result, the server 200 sends the first test result and the third test result to the client 100.
(8) The client 100 receives and stores the first test result and the third test result, and completes the performance test and the function test of the notebook file.
In addition, the client 100 may further perform statistical analysis on the first execution duration and the first resource occupation information of each code block in the first test result to obtain a second test result, where the second test result is used to indicate a performance test result subjected to statistical analysis, so that the performance test result is not only convenient to view, but also may be used to guide the deployment of the real operating environment.
The client 100 may further determine the function test result of the test file according to a third test result indicating whether the function of each code block in the test file is correct.
It is understood that the above-mentioned method embodiments of the present disclosure can be combined with each other to form a combined embodiment without departing from the logic of the principle, which is limited by the space, and the detailed description of the present disclosure is omitted. Those skilled in the art will appreciate that in the above methods of the specific embodiments, the specific order of execution of the steps should be determined by their function and possibly their inherent logic.
In addition, the present disclosure also provides a testing apparatus, an electronic device, a computer-readable storage medium, and a computer program product, which can be used to implement any one of the testing methods provided by the present disclosure, and the corresponding technical solutions and descriptions and corresponding descriptions in the methods section are not repeated.
FIG. 4 shows a block diagram of a test apparatus according to an embodiment of the present disclosure. The testing device is applied to a client. As shown in fig. 4, the apparatus includes:
a first sending module 410, configured to send a test request to a server, so that the server starts a test service and at least one running service according to the test request, where the test request includes resource configuration information and identity information of at least one user;
a second sending module 420, configured to send, in response to a message that service start is successful, a test task to the server, so that the server executes the test task through the test service and the at least one running service, where the test task includes location information of a test file to be executed by the at least one user, and the test file includes at least one code block;
a first receiving module 430, configured to receive and store a first test result sent by the server, where the first test result includes a first execution duration of each code block in the test file and/or first resource occupation information of each code block.
In one possible implementation, the apparatus further includes: and the statistical module is used for performing statistical analysis on the first test result to obtain a second test result.
In one possible implementation, the statistics module is configured to: for any test file, determining a second execution time length of the test file according to the first execution time length of each code block in the test file; and/or for any test file, determining second resource occupation information of the test file according to the first resource occupation information of each code block in the test file; wherein the second test result includes the second execution duration and/or the second resource occupation information.
In one possible implementation, the apparatus further includes: a second receiving module, configured to receive a third test result sent by the server, where the third test result is used to indicate whether a function of each code block in the test file is correct; and the first result determining module is used for determining the function test result of the test file according to the third test result.
In one possible implementation, the apparatus further includes: and the fifth sending module is used for sending a test stopping request to the server under the condition that a preset test finishing condition is met so as to enable the server to stop executing the test task.
FIG. 5 shows a block diagram of a test apparatus according to an embodiment of the present disclosure. The testing device is applied to the server. As shown in fig. 5, the apparatus includes:
a service starting module 510, configured to respond to a test request sent by a client, and start a test service and at least one running service according to the test request, where the test request includes resource configuration information and identity information of at least one user, and the running service corresponds to the user one to one;
a third sending module 520, configured to send a message that the service start is successful to the client after the test service and the at least one running service are successfully started;
the test execution module 530, configured to respond to a test task sent by a client, execute the test task through the test service and the at least one running service, and obtain a first test result, where the test task includes location information of a test file to be executed by the at least one user, the test file includes at least one code block, and the first test result includes a first execution duration of each code block and/or first resource occupation information of each code block;
a fourth sending module 540, configured to send the first test result to the client.
In one possible implementation, the service initiation module 510 is configured to: starting at least one container according to the resource configuration information in the test request; initiating a running service in the at least one container.
In one possible implementation, the test execution module 530 is configured to: establishing a network connection for the test service and the at least one running service; obtaining a test file to be executed indicated by the test task through the test service, and determining a target user to which the test file belongs from the at least one user; sending each code block in the test file to an operation service corresponding to the target user through the test service; and executing each code block in the test file through the running service corresponding to the target user to obtain a first test result.
In a possible implementation manner, the first test result further includes an execution result of each code block in the test file, and the apparatus further includes: a second result determining module, configured to determine, for any code block, a third test result of the code block according to an expected execution result of the code block and an execution result of the code block in the first test result, where the third test result is used to indicate whether a function of the code block is correct; and the sixth sending module is used for sending the third test result to the client.
In one possible implementation, the apparatus further includes: and the stopping module is used for responding to a test stopping request sent by the client and stopping executing the test task.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the above-mentioned method. The computer readable storage medium may be a volatile or non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
The disclosed embodiments also provide a computer program product comprising computer readable code or a non-transitory computer readable storage medium carrying computer readable code, which when run in a processor of an electronic device, the processor in the electronic device performs the above method.
The electronic device may be provided as a terminal device, a server, or other modality of device.
Fig. 6 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure. For example, the electronic device 800 may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or other terminal device.
Referring to fig. 6, electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge Coupled Device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as a wireless network (Wi-Fi), a second generation mobile communication technology (2G), a third generation mobile communication technology (3G), a fourth generation mobile communication technology (4G), a long term evolution of universal mobile communication technology (LTE), a fifth generation mobile communication technology (5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
Fig. 7 illustrates a block diagram of an electronic device 1900 in accordance with an embodiment of the disclosure. For example, the electronic device 1900 may be provided as a server. Referring to fig. 7, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system, such as the Microsoft Server operating system (Windows Server), stored in the memory 1932TM) Apple Inc. of the present application based on the graphic user interface operating System (Mac OS X)TM) Multi-user, multi-process computer operating system (Unix)TM) Free and open native code Unix-like operating System (Linux)TM) Open native code Unix-like operating System (FreeBSD)TM) Or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (12)

1. A testing method is applied to a client side and comprises the following steps:
sending a test request to a server so that the server starts a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user;
responding to a message that service starting is successful and sent by the server, sending a test task to the server, so that the server executes the test task through the test service and the at least one running service, wherein the test task comprises position information of a test file to be executed of the at least one user, and the test file comprises at least one code block;
and receiving and storing a first test result sent by the server, wherein the first test result comprises a first execution time length of each code block in the test file and/or first resource occupation information of each code block.
2. The method of claim 1, further comprising:
and carrying out statistical analysis on the first test result to obtain a second test result.
3. The method of claim 2, wherein statistically analyzing the first test result to obtain a second test result comprises:
for any test file, determining a second execution time length of the test file according to the first execution time length of each code block in the test file; and/or
For any test file, determining second resource occupation information of the test file according to the first resource occupation information of each code block in the test file;
wherein the second test result includes the second execution duration and/or the second resource occupation information.
4. The method according to any one of claims 1-3, further comprising:
receiving a third test result sent by the server, wherein the third test result is used for indicating whether the function of each code block in the test file is correct or not;
and determining a function test result of the test file according to the third test result.
5. A testing method is applied to a server and comprises the following steps:
responding to a test request sent by a client, starting a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user;
after the test service and at least one running service are started successfully, sending a message that the service is started successfully to the client;
responding to a test task sent by the client, executing the test task through the test service and the at least one running service to obtain a first test result, wherein the test task comprises position information of a test file to be executed by the at least one user, the test file comprises at least one code block, and the first test result comprises first execution duration of each code block and/or first resource occupation information of each code block;
and sending the first test result to the client.
6. The method of claim 5, wherein the initiating at least one operational service according to the test request comprises:
starting at least one container according to the resource configuration information in the test request;
initiating a running service in the at least one container.
7. The method according to claim 5 or 6, wherein said executing the test task by the test service and the at least one running service to obtain a first test result comprises:
establishing a network connection for the test service and the at least one running service;
obtaining a test file to be executed indicated by the test task through the test service, and determining a target user to which the test file belongs from the at least one user;
sending each code block in the test file to an operation service corresponding to the target user through the test service;
and executing each code block in the test file through the running service corresponding to the target user to obtain a first test result.
8. The method of any of claims 5-7, wherein the first test result further comprises results of execution of individual blocks of code in the test file, the method further comprising:
for any code block, determining a third test result of the code block according to an expected execution result of the code block and an execution result of the code block in the first test result, wherein the third test result is used for indicating whether the function of the code block is correct or not;
and sending the third test result to the client.
9. A testing device is applied to a client side and comprises:
the system comprises a first sending module, a second sending module and a third sending module, wherein the first sending module is used for sending a test request to a server so that the server starts a test service and at least one running service according to the test request, and the test request comprises resource configuration information and identity information of at least one user;
the second sending module is used for responding to a message that the service starting is successful and sent by the server, sending a test task to the server, so that the server executes the test task through the test service and the at least one running service, wherein the test task comprises position information of a test file to be executed by the at least one user, and the test file comprises at least one code block;
the first receiving module is configured to receive and store a first test result sent by the server, where the first test result includes a first execution duration of each code block in the test file and/or first resource occupation information of each code block.
10. A testing device is applied to a server and comprises:
the service starting module responds to a test request sent by a client, starts a test service and at least one running service according to the test request, wherein the test request comprises resource configuration information and identity information of at least one user, and the running service corresponds to the user one to one;
the third sending module is used for sending a message that the service is successfully started to the client after the test service and at least one running service are successfully started;
the test execution module is used for responding to a test task sent by a client, executing the test task through the test service and the at least one running service, and obtaining a first test result, wherein the test task comprises position information of a test file to be executed by the at least one user, the test file comprises at least one code block, and the first test result comprises first execution duration of each code block and/or first resource occupation information of each code block;
and the fourth sending module is used for sending the first test result to the client.
11. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the method of any of claims 1 to 4, or to perform the method of any of claims 5 to 8.
12. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any one of claims 1 to 4 or the method of any one of claims 5 to 8.
CN202111445470.5A 2021-11-30 2021-11-30 Test method and device, electronic equipment and storage medium Withdrawn CN114116495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111445470.5A CN114116495A (en) 2021-11-30 2021-11-30 Test method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111445470.5A CN114116495A (en) 2021-11-30 2021-11-30 Test method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114116495A true CN114116495A (en) 2022-03-01

Family

ID=80368973

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111445470.5A Withdrawn CN114116495A (en) 2021-11-30 2021-11-30 Test method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114116495A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794477A (en) * 2023-02-03 2023-03-14 北京智芯微电子科技有限公司 Time constraint method, device, chip, electronic device and storage medium of program
CN116126737A (en) * 2023-04-11 2023-05-16 阿里云计算有限公司 Container testing method and device
CN116955208A (en) * 2023-09-18 2023-10-27 荣耀终端有限公司 Test method, terminal equipment, chip and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794477A (en) * 2023-02-03 2023-03-14 北京智芯微电子科技有限公司 Time constraint method, device, chip, electronic device and storage medium of program
CN116126737A (en) * 2023-04-11 2023-05-16 阿里云计算有限公司 Container testing method and device
CN116126737B (en) * 2023-04-11 2023-09-26 阿里云计算有限公司 Container testing method and device
CN116955208A (en) * 2023-09-18 2023-10-27 荣耀终端有限公司 Test method, terminal equipment, chip and storage medium
CN116955208B (en) * 2023-09-18 2024-03-15 荣耀终端有限公司 Test method, terminal equipment, chip and storage medium

Similar Documents

Publication Publication Date Title
CN114116495A (en) Test method and device, electronic equipment and storage medium
US9021507B2 (en) Dynamic use of data across multiple programs
US20210209962A1 (en) Teaching system and method, electronic device, and storage medium
EP4181505A1 (en) Screen sharing method and apparatus, and electronic device
CN110069919B (en) Information acquisition method and device
CN110781408A (en) Information display method and device
CN112311841A (en) Information pushing method and device, electronic equipment and computer readable medium
CN111309617A (en) Application program control method and device, storage medium and electronic equipment
CN110737415A (en) Screen sharing method and device, computer equipment and storage medium
US20230124149A1 (en) Method and apparatus for establishing multimedia call, and electronic device
CN113326013A (en) Information interaction method and device and electronic equipment
CN114741292A (en) Test script management method and device, electronic equipment and storage medium
CN113377664A (en) Model testing method and device, electronic device and storage medium
CN114020369A (en) Programming education experiment method and device, electronic equipment and storage medium
CN106790683B (en) Network data display method and device based on mobile terminal
CN113705653A (en) Model generation method and device, electronic device and storage medium
CN110221978B (en) Test case generation method and device
CN115098390A (en) Automatic testing method and device, storage medium and electronic equipment
CN113504903A (en) Experiment generation method and device, electronic equipment and storage medium
CN111162960B (en) Method and server for starting debugging panel
CN113238944A (en) Test method, device and system
CN107145441B (en) Page display method and device
CN112306858A (en) Test method and device and electronic equipment
CN112306596A (en) Information interaction method and device and electronic equipment
CN113095485B (en) Performance index determination method, device, system, electronic equipment and storage medium

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20220301