Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to facilitate understanding of the testing method of the car networking service platform provided in the embodiment of the present application, first, an architecture of the car networking service platform and related terms in the software testing field are introduced below.
Referring to fig. 1, the service platform of the internet of vehicles includes a client 101, a car box 102 installed in a vehicle, and a business server 103. The car box 102 is also called a T-box, and is a vehicle-mounted terminal device that is connected to a control system of a vehicle through a Controller Area Network (CAN) bus of the vehicle and CAN be connected to a mobile Network.
It should be noted here that fig. 1 shows only the connection relationship among the three types of devices related to the car networking service platform, and in a specific use, each of the three types of devices may have a plurality of devices, that is, when the car networking service platform actually operates, a plurality of car boxes and clients may simultaneously access the service server, and meanwhile, the service server is not limited to one server, but may be a server cluster formed by a plurality of servers.
On one hand, under the condition that the user leaves the vehicle, the automobile box can collect the current vehicle condition parameters of the vehicle at certain time intervals and report the current vehicle condition parameters to the service server, and the service server sends the current vehicle condition parameters to the client side according to the condition or pushes early warning information. For example, the car box may collect and report current vehicle tire temperature, tire pressure, lock state, remaining oil amount, mileage and other vehicle condition parameters of the vehicle, and then the user may send a vehicle condition query request to the service server to remotely query the vehicle condition parameters in case of leaving the vehicle. For another example, the car box may report to the service server whether the car door is normally locked, and if the car door is not normally locked, the service server actively pushes car door abnormal information to the client to prompt the user that the car door is not normally locked.
On the other hand, the user can realize the remote control of the vehicle through the internet of vehicles service platform under the condition of leaving the vehicle. For example, before the user gets on the car, the user may send a remote control request to the service server in advance for instructing the car box to turn on the air conditioner, and then the service server issues the remote control request to the car box, so that the car box can automatically turn on the air conditioner in the car through the control system of the car.
It can be understood that the testing of the car networking service platform is required in both the testing environment before the car networking service platform is established and the production environment after the car networking service platform is established and actually operated. Furthermore, an important step in the test of the car networking service platform is to test whether each function of a service program for providing the service is abnormal or not, wherein the service server is operated. One of the commonly used testing methods is to operate a client according to a certain test case by a tester, so that the client interacts with a service server, and determine whether a service program is abnormal by observing a response of the service server.
The test case is a kind of example determined according to the function of the tested object and the test requirement. When a test case is used for testing the car networking service platform, the client sends a service request corresponding to the test case to the service server, then receives feedback data fed back by the service server aiming at the service request, a tester determines whether the service server can normally process the service request of the test case by observing the feedback data, and can determine whether various functions of the service server are normal by repeatedly executing various different types of test cases.
It should be noted that, when testing a service server of a service platform of the internet of vehicles, part of the test cases may involve interaction between the test service server and an automobile box, at this time, a vehicle-mounted terminal simulator for simulating the function of a real automobile box is generally accessed to the service server through a mobile network, and information interaction in the testing process is performed between the vehicle-mounted terminal simulator and the service server.
For example, it is now necessary to test whether the service server can receive and issue a remote control command for turning on an in-vehicle air conditioner to the in-vehicle terminal simulator. According to the existing test scheme, a tester operates a client to send a remote control request for starting an air conditioner to a service server, if the remote control function of a service program is normal, the service server receives the remote control request of the client, then sends a control instruction for controlling the starting of the air conditioner to a vehicle-mounted terminal simulator, the vehicle-mounted terminal simulator feeds back a vehicle condition parameter indicating the starting of the air conditioner to the service server after receiving the remote control request, and then the service server sends the vehicle condition parameter indicating the starting of the air conditioner to the client, otherwise, if the remote control function of the service program fails (for example, the remote control request of the client is not received, or the remote control request is not sent to the vehicle-mounted terminal simulator), the client does not receive the vehicle condition parameter indicating the starting of the air conditioner. Therefore, after the tester executes the operation, whether the remote control request for starting the air conditioner can be normally forwarded by the service program can be determined according to whether the vehicle condition parameter indicating the air conditioner starting is received after a certain time.
It can be understood that, based on the existing testing method, each test case needs to be implemented by a human operation client, the test result also needs to be manually analyzed and recorded, the testing efficiency is extremely low, and the requirement of frequently executing a large number of test cases in the testing environment and the production environment is difficult to meet.
To sum up, the application provides a scheme for carrying out automated testing to the business program that the business server of car networking service platform ran to improve efficiency of software testing, satisfy the demand of frequently carrying out a large amount of test cases in test environment and production environment.
Referring to fig. 2, fig. 2 is a test system for implementing a test method of a service platform in the internet of vehicles provided by the present application, where the test system includes three types of devices, namely a test server 201, a service server 202, and a vehicle-mounted terminal simulator (T-box simulator) 203.
The working principle of the test system is the test method of the vehicle networking service platform provided by the application. Specifically, the test server 201 stores a plurality of test cases, wherein the first type of test case does not relate to the test of the interaction process between the service server and the vehicle-mounted terminal simulator, and the test cases include service requests; the second type of test case relates to the testing of the interaction process between the service server and the vehicle-mounted terminal simulator, and comprises a service request and information for sending to the vehicle-mounted terminal simulator. The information sent to the vehicle-mounted terminal simulator may be vehicle condition information carrying a plurality of vehicle condition parameters and corresponding parameter values, or may be a specific abnormal message (for example, an abnormal message indicating that the vehicle door is not normally locked).
It can be understood that, for the test case of the previous category, the test server directly interacts with the service server, and then it is only necessary to check whether the feedback data of the service server to the service request matches with the service request. For the latter type of test case, the test server needs to communicate with the vehicle-mounted terminal simulator and the service server respectively, and finally checks the feedback data of the service server by combining the information sent to the vehicle-mounted terminal simulator and the service request.
The following describes a specific execution process of the test method provided by the embodiment of the present application with reference to the above two types of test cases, respectively:
referring to fig. 3, fig. 3 is a test flow of the test method provided by the present application for the aforementioned first type of test case, and the method includes the following steps:
s301, one of the multiple test cases stored in the test server is selected as a current test case.
The test cases stored in the test server can be edited in advance by a tester according to test requirements, and can also be automatically created by the test server after a certain creation rule is specified.
As described above, the current test case in the present embodiment is the aforementioned first type test case, that is, the test case that does not involve the test of the interaction between the service server and the in-vehicle terminal simulator.
In the car networking service platform, functions that can be realized without interaction with a vehicle-mounted terminal are generally user information management functions provided by a service server, including new user registration and user information editing of old users (e.g., changing bound telephone numbers, adding bound cars, etc.). Therefore, the test case for such functional configuration is to test whether the communication interface program configured by the service server and the client normally operates, and to test whether the relevant user information management function of the service server is normal.
S302, sending a service request of the current test case to a service server, and enabling the service server to provide feedback data corresponding to the service request.
Step S302 is equivalent to the process of executing the first type test case by the test server.
Each test case is configured for a specific function provided by the service server, for example, for the first type of test case related to this embodiment, the test case includes a plurality of test cases configured for managing each specific sub-function under this type of function according to user information, and meanwhile, the service request of each test case is also configured for a specific function that needs to be tested according to this test case.
For example, if the current test case is a test case for testing whether the function provided by the service server for creating the new user is normal, the service request of the current test case is a new user request for requesting the service server to create the new user. If the current test case is a test case for testing whether the function of replacing the bound vehicle provided by the service server is normal, the service request of the current test case is a vehicle replacement request for requesting the service server to replace the vehicle bound by the specified user.
It should be noted that the test scheme provided in the present application may be considered as replacing the client in the existing test scheme with the test server. Therefore, in order to ensure that the test server can test whether the communication function between the service server and the client is normal when sending the service request to the service server, the service request sending in step S302 should be that the test server sends the service request to a client communication interface configured by the service server based on a hypertext Transfer Protocol (http Protocol), and the situation that the service request is sent to the service server by the client that is actually operated by the car networking service platform is simulated in this way, so as to achieve the effect of testing whether the communication function between the service server and the client is normal.
And S303, verifying the feedback data according to the current test case to obtain the test result of the current test case.
The data carried by different types of service requests are different, the processing flow of the service server is also different, and the corresponding feedback data are also different.
A specific example is given below for reference. If the platform of the car networking server specifies that a new user needs to provide at least one mobile phone number of the new user, the new user request carries a preset mobile phone number (e.g., 11234567890) for testing, and correspondingly, if the platform specifies that information of other new users needs to be provided (e.g., an identity card number is also needed), when the new user request in the test case is created, virtual information for testing needs to be configured correspondingly (e.g., when the identity card number is needed, a number string as long as the identity card number is configured in advance).
For the newly-built user request mentioned in this example, the first aspect of the feedback data provided by the service server includes a return code for indicating whether the communication is normal, both the service server and the test server may agree in advance an expected value of the return code, for example, the agreed expected value is 200, when any one party sends a message to the other party, the content to be sent and the return code are sent to the other party together, and if the value of the return code received by the other party is not the agreed expected value in advance (for example, not 200), it is determined that the communication function of the other party is abnormal or down. In this example, if the return code carried by the feedback data provided by the service server is not equal to the preset expected value, the test server may consider that the client interface of the service server is abnormal.
In the second aspect, the feedback data may also carry user information of the newly-built user after the service server completes the operation of the newly-built user. For example, if the test server provides a mobile phone number for creating a new user, the feedback data provided by the service server includes the mobile phone number of the new user after the creation of the new user is completed, and may further include other information, such as a user nickname randomly assigned by the service server, a user ID, and the like.
In this embodiment, the verifying in step S303 includes: and judging whether the value of the return code carried by the feedback data is equal to a preset expected value or not, and matching the effective information carried by the feedback data provided by the service server with the service request in the current test case.
And if the value of the return code carried by the feedback data is not equal to the preset expected value, the client interface provided by the service server is considered to be abnormal, and the test of the current test case fails.
And if the value of the return code carried by the feedback data is equal to the preset expected value, but the matching between the effective information and the service request of the current test case fails, determining that the processing flow of the service server aiming at the service request is abnormal, and the test of the current test case fails.
And if the value of the return code carried by the feedback data is equal to the preset expected value and the effective information is successfully matched with the service request of the current test case, considering that the client interface provided by the service server is normal, the processing flow aiming at the service request is normal, and the test of the current test case is successful.
Specifically, in combination with the example of the new user request, the effective information carried in the feedback data is the user information of the user newly created by the service server, and the effective information is matched with the service request, that is, whether the user information carried in the feedback data is consistent with the user information in the service request is judged, for example, the service request carries a mobile phone number for the new user, the feedback data carries the mobile phone number of the new user, if the mobile phone number carried in the feedback data is consistent with the mobile phone number in the new user request, it is described that the effective information is successfully matched with the service request of the current test case, and if the mobile phone number carried in the feedback data is inconsistent with the mobile phone number in the new user request, it is described that the effective information is unsuccessfully matched with the service request of the current test case.
Further, referring to fig. 4, the test flow of the test solution provided by the present application for the second type of test case includes the following steps:
s401, selecting one of a plurality of test cases stored in the test server as a current test case.
The current test case in this embodiment is the aforementioned second type of test case, that is, a test case relating to interaction between the service server and the vehicle-mounted terminal simulator.
Specifically, the interaction between the service server and the car box in the car networking service platform is mainly to realize the following three functions:
the first item is to provide the client with a vehicle condition information refreshing function. In order to realize the function, the automobile box can report a plurality of current automobile condition parameters and values thereof to the service server at regular time, and certainly, the automobile box can not report the parameters actively but be pulled from the automobile box by the service server when needed; then the client sends a vehicle condition query request to the service server, a plurality of vehicle condition parameters needing to be queried are specified, and the service server feeds back the values of the specified vehicle condition parameters after receiving the vehicle condition query request, so that the client is displayed to a user.
The second item is to provide an exception alert function for the client. The automobile box can monitor various automobile condition parameters of the automobile in real time, determine whether the automobile has abnormal conditions according to the values of the automobile condition parameters, generate corresponding abnormal messages after the abnormal conditions are found, and report the abnormal messages to the service server. For example, after the user leaves the vehicle, the vehicle box may monitor the state of the vehicle door, if the state of the vehicle door is not normally locked, the vehicle box reports a vehicle door abnormal message to the service server to indicate that the vehicle door is not normally locked, and then the service server adds the vehicle door abnormal message to the message push list to actively push the vehicle door abnormal message to the client to prompt the user to close the vehicle door again.
The third item is to provide remote control functionality for the client. The client can send a remote control request to the service server, and then the service server sends the remote control request to the automobile box, so that a user can control certain functions of the vehicle when the user leaves the vehicle. For example, the air conditioner is remotely turned on or off after leaving the vehicle, the engine is started for preheating before getting on the vehicle, the lock is remotely unlocked or locked, the engine is remotely turned on or off, the window is turned on or off, the whistle and the flash lamp are remotely turned on or off, and the like.
The second type of test case includes a service request and simulator information used for being sent to the vehicle-mounted terminal simulator, and specifically, the simulator information includes a plurality of vehicle condition parameters and values corresponding to the vehicle condition parameters for the test case for testing the first function and the third function. And aiming at the test case of the second function, the simulator information comprises preset exception information.
It should be noted that, the vehicle condition parameters mentioned in the present application refer to variables used for describing the current state of the vehicle in programs configured in the vehicle box, the service server and the client, and the values of the vehicle condition parameters are the variable values of these variables.
For example, in the present application, the systemopower mode may be used to represent the vehicle power mode state, EngState may be used to represent the engine state, DrivDoorLockSts may be used to represent the door lock state, fltirefressure, frtirefressure, rltirefpressure, and rrtirefressure are four-wheel tire pressure values, FLTireTemp, FRTireTemp, RLTireTemp, and RRTireTemp are four-wheel tire temperature states, vehtotal range is the total mileage, and FuelLvl is the remaining fuel amount data.
S402, sending simulator information of the current test case to the vehicle-mounted terminal simulator.
If the current test case is a test case for the first function or the third function, the simulator information of the current test case is a plurality of vehicle condition parameters and corresponding values, and may include any one or a combination of any plurality of vehicle condition parameters, such as an engine state, a vehicle power mode state, a four-wheel tire pressure value, a four-wheel tire temperature state, a total mileage data, a remaining oil amount data, and the like, and preset values of the vehicle condition parameters.
Referring to fig. 5, fig. 5 is a schematic configuration diagram of an optional test case, where a string str is simulator information carried in the test case, and it can be found that the values of the vehicle condition parameters in fig. 5 are specifically configured as follows:
the vehicle power mode state systemopower mode value is 2, the engine state EngState value is 2, the door locking state DrivDoorLockSts value is 1, the current vehicle speed Vehiclespd value is 0, the four-wheel tire pressure values FLTirePressure, FRTirePressure, RLTirePressure and RRTirePressure are 222, 233, 189 and 166 in this order, the four-wheel tire temperature states fltirebemp, frtirebemp, rltirebemp and rrtirebemp are 95, 87, 99 and 66 in this order, the total mileage number VehTotalMileage is 123456, and the remaining fuel amount data FuelLvl is 24.
In the actual working process, the relationship between the values of the vehicle condition parameters and the actual vehicle state can be preset, for example, the values of the four-wheel tire pressure value and the four-wheel tire temperature state represent the current pressure value and temperature value of four tires of the vehicle, the value of SystemPowerMode is 2, which represents that the vehicle power supply is turned on, and the value of 1, which represents that the vehicle power supply is turned off; an EngState value of 2 indicates that the engine is in an on state, and a value of 1 indicates that the engine is in an off state.
If the current test case is a test case for the second function, the simulator information of the current test case is a specific exception message. For example, the current test case needs to test whether the service server can normally receive the abnormal car door message reported by the car box and push the message to the client, so that the simulator information of the current test case includes the abnormal car door message.
The test server can send the simulator information in the current test case to the vehicle-mounted terminal simulator based on the http protocol.
The response of the in-vehicle terminal simulator is different according to the difference of the information sent to the in-vehicle terminal simulator. On one hand, if the abnormal message is sent to the vehicle-mounted terminal simulator, the vehicle-mounted terminal simulator reports the abnormal message to the service server, and feeds back the reported information of the abnormal message to the test server after reporting.
On the other hand, if the vehicle-mounted terminal simulator receives the vehicle condition information comprising a plurality of vehicle condition parameters and corresponding parameter values, the vehicle-mounted terminal simulator adjusts the values of the corresponding vehicle condition parameters of the vehicle-mounted terminal simulator to the values in the vehicle condition information provided by the test server. For example, if the vehicle condition information sent by the test server includes a vehicle parameter, which is a vehicle power mode state, and the value is 2, the vehicle-mounted terminal simulator adjusts the value of the variable, which is the vehicle power mode state of the vehicle, to 2 after receiving the vehicle condition information. After the setting is completed, the vehicle-mounted terminal simulator can actively report the adjusted vehicle condition parameters and the values thereof to the service server, and can also report the vehicle condition parameters after the service server sends a vehicle condition parameter query request to the vehicle-mounted terminal simulator.
Optionally, the vehicle-mounted terminal simulator may feed back the adjusted information to the test server after adjusting the vehicle condition parameters according to the vehicle condition information provided by the test server.
S403, sending the service request of the current test case to the service server, and enabling the service server to provide feedback data corresponding to the service request.
Step S402 and step S403 correspond to a process in which the test server executes the second type test case.
Consistent with the previous embodiment, the test server sends the service request to a client communication interface configured by the service server based on a hypertext Transfer Protocol (http Protocol).
It should be noted that, for the test case in which an abnormal message or vehicle condition information needs to be sent to the vehicle-mounted terminal simulator in this embodiment, step S403 is executed after the test server determines that the vehicle-mounted terminal simulator has reported the abnormal message or has adjusted the corresponding vehicle condition parameter according to the vehicle condition information. That is, after executing step S402 and sending the abnormal message or the vehicle condition information to the vehicle-mounted terminal simulator, the test server may wait for the information that the abnormal message fed back by the vehicle-mounted terminal simulator has been reported or the vehicle condition parameter has been adjusted, and then execute step S403.
If the current test case is a test case for testing the vehicle condition query function provided by the service server, the service request contained in the current test case is a vehicle condition query request for querying the vehicle condition parameters, and if the vehicle-mounted terminal simulator adopts a mode of actively reporting the vehicle condition parameters, the service server directly provides a plurality of vehicle condition parameters and numerical values thereof which are requested to be queried as feedback data to the test server after receiving the vehicle condition query request of the test server. If the vehicle-mounted terminal simulator does not report actively, the service server actively acquires the vehicle condition parameters and the values thereof which need to be inquired by the vehicle condition inquiry request from the vehicle-mounted terminal simulator after receiving the vehicle condition inquiry request, and then sends the vehicle condition parameters and the values thereof serving as feedback data to the test server.
If the current test case is a test case for testing a remote control function provided by the service server, the service request of the current test case is a remote control request. In actual use, the remote control request is used for indicating the service server to control the vehicle terminal to control the vehicle by issuing a corresponding instruction, such as controlling the air conditioner to be turned on or turned off. During testing, the vehicle-mounted terminal simulator is not used for actually controlling the vehicle, so that the vehicle-mounted terminal simulator can correspondingly modify vehicle condition parameters after receiving a control instruction of the service server. And after the service server controls the vehicle-mounted terminal simulator to correspondingly modify the vehicle condition parameters according to the remote control request, the vehicle-mounted terminal simulator feeds the modified vehicle condition parameters and the values thereof back to the service server, and then the service server sends the modified vehicle condition parameters and the values thereof reported by the vehicle-mounted terminal simulator as feedback data to the test server.
For example, if the remote control function of the service server is normal, after receiving a remote control request for instructing to start the air conditioner, the service server sends an instruction for starting the air conditioner to the vehicle-mounted terminal simulator, the vehicle-mounted terminal simulator adjusts the value of the vehicle condition parameter for instructing the on-off state of the air conditioner to a value for indicating the on-off state of the air conditioner, and then reports the vehicle condition parameter and the value thereof to the service server, and the service server sends the vehicle condition parameter for instructing the on-off state of the air conditioner and the value thereof as feedback data to the test server.
And if the current test case is used for testing the abnormal state alarm function of the business server, the business request is an abnormal query request. And after receiving the abnormal query request, the service server sends the current message push list serving as feedback data to the test server, and if the abnormal state warning function of the service server is normal and the communication interface with the vehicle-mounted terminal is normal, the message push list fed back by the service server carries the abnormal message which is sent to the vehicle-mounted terminal simulator by the test server in the step S402 and reported to the service server by the vehicle-mounted terminal simulator.
S404, verifying the feedback data according to the current test case to obtain the test result of the current test case.
Similar to the previous embodiment, the verification in step S404 first judges whether the value of the return code carried by the feedback data is a preset expected value, if so, performs subsequent verification, and if not, determines that the client interface provided by the service server is abnormal, and the test of the current test case fails.
After the value of the return code is determined to be the expected value, according to the difference of the test cases, there are three different verification methods:
first, when the current test case is a test case for testing the vehicle condition query function provided by the service server, the verification of the feedback data is to determine whether the value of the vehicle condition parameter fed back by the service server is equal to the value recorded in the vehicle condition information sent by the test server to the vehicle-mounted terminal simulator in step S402, if the two values are equal, the feedback data passes the verification, the current test case is successfully tested, and if the two values are not equal, the feedback data fails the verification, which indicates that the interface function of the service server for receiving the vehicle condition parameter of the vehicle-mounted terminal is abnormal.
For example, after the vehicle-mounted terminal simulator obtains the vehicle condition information of fig. 5 from the test server and adjusts the vehicle condition parameters accordingly, if the value of the vehicle condition parameter obtained by the test server from the service server is not equal to the corresponding value in fig. 5, for example, the value of the vehicle condition parameter FLTirePressure representing the right front wheel tire pressure in fig. 5 is 222, and if the value of the vehicle condition parameter FLTirePressure of the right front wheel tire pressure obtained by the test server from the service server is not equal to 222, the feedback data is considered to be not verified.
Secondly, when the current test case is a test case for testing the abnormality early warning function provided by the service server, the verification of the feedback data is to determine whether the feedback message push list carries an abnormal message that the test server extracts from the current test case and sends the abnormal message to the vehicle-mounted terminal simulator in step S402, if the message push list fed back by the service server carries the abnormal message included in the current test case, the feedback data passes the verification, the current test case tests successfully, otherwise, if the message push list fed back by the service server does not carry the abnormal message included in the current test case, the feedback data fails the verification, and the current test case tests unsuccessfully.
For example, the current test case includes an abnormal message used for indicating that the vehicle door is not normally locked, the test server sends the abnormal message to the vehicle-mounted terminal simulator, and after the vehicle-mounted terminal simulator reports the abnormal message to the service server, the test server acquires a message push list from the service server, and then detects whether the message push list contains the abnormal message of the current test case, if the message push list contains the abnormal message, the feedback data passes the verification, the test of the current test case is successful, and if the message push list does not contain the abnormal message, the feedback data fails to pass the verification, and the test of the current test case fails.
Thirdly, when the current test case is a test case for testing a remote control function provided by the service server, the verification of the feedback data is to judge whether the numerical value of the fed-back vehicle condition parameter is equal to the numerical value indicated by the remote control request sent by the test server to the service server. For example, the test server sends a remote control request for requesting to start an air conditioner, if the remote control function of the service server is normal, the service server should send an instruction for starting the air conditioner to the vehicle-mounted terminal simulator, the vehicle-mounted terminal simulator sets a vehicle condition parameter indicating the air conditioner state to a value indicating the start after receiving the instruction, then reports the vehicle condition parameter and the value thereof to the service server, and then the service server feeds back the vehicle condition parameter and the value thereof to the test server to indicate that the air conditioner is started.
Therefore, taking the remote control request for starting the air conditioner as an example, the test server may determine whether the value of the vehicle condition parameter indicating the air conditioner state in the feedback data provided by the service server is the value indicating the air conditioner start, if so, the feedback data passes the verification, the test of the current test case is successful, and if not, the feedback data fails the verification, and the test of the current test case fails.
Optionally, the car networking service platform can also obtain a GPS signal of the vehicle through the car box, thereby providing an electronic fence function. The test case for testing the electronic fence function may include a vehicle position query request and a virtual GPS signal indicating that the vehicle has entered the electronic fence, and the test server may send the virtual GPS signal to the vehicle-mounted terminal simulator when step S402 is executed, and then send a position query request to the service server to query whether the vehicle has entered the electronic fence, where the test case is tested successfully if the query result is consistent with a condition set by the current test case, and otherwise, the test case is tested unsuccessfully if the query result is inconsistent with the condition set by the current test case.
It should be noted that, in the embodiment, the test cases are illustrated for convenience of understanding, and are only test cases configured for testing a plurality of optional functions provided by the service server, and the test method provided in any embodiment of the present application may further execute test cases configured for other functions, thereby implementing a test on the service server.
The application provides a test method of a car networking service platform, which is applied to a test server and comprises the following steps: selecting one test case from a plurality of test cases stored by a test server as a current test case; the test server executes the current test case, so that the service server generates corresponding feedback data, then receives the feedback data sent by the service server, and verifies the feedback data according to the current test case to obtain the test result of the current test case. According to the scheme provided by the application, the test server can replace the client to automatically execute the pre-stored test cases to obtain the test results of the test cases.
Further, for the test cases related to interaction between the service server and the vehicle-mounted terminal simulator, the test server provided by the application can automatically send vehicle condition information or abnormal messages needing to be configured in the vehicle-mounted terminal simulator to the vehicle-mounted terminal simulator through an http interface, the vehicle-mounted terminal simulator automatically configures and reports the vehicle condition information or abnormal messages, and the information needs to be manually configured in the vehicle-mounted terminal simulator in the existing test method, so that the method provided by the application can further improve the test efficiency for the test cases.
In an alternative embodiment of the present application, an execution time may be configured for each test case stored by the test server. For example, it may be specified that, for each test case, the test case is executed by the test server at certain times every day, for example, it is specified that one test case is executed once at 12 hours and 0 hours every day, or it may be specified that each test case is repeatedly executed by the test server at certain time intervals, for example, it is specified that one test case is executed once every 30 minutes.
Based on the above configuration, the test server may detect whether there is a test case that needs to be executed at the current time in real time, if so, determine the test case as the current test case, and then execute the method provided by the embodiment corresponding to the foregoing fig. 3 or fig. 4 according to the type of the current test case to test the service server, thereby obtaining the test result of the test case.
In another optional embodiment of the present application, the test server executes one test case each time, and after obtaining the test result of the test case, if it is determined that the test of the test case fails, the test server may output a failure prompt message to a relevant person in the form of an email to prompt the service server of a failure.
In another alternative embodiment of the present application, the test server may periodically collect test results of a plurality of test cases executed within a recent period of time (for example, the recent 30 minutes), record the test results of the test cases and related information in a table form, generate a test report reflecting the test conditions of the service server within the recent period of time, and then output the test report to related personnel.
Optionally, the test report output by the test server may be as shown in fig. 6, where each row in fig. 6 corresponds to a test case that is executed recently, and the first column is the name of each test case, followed by the test result, the executed number, and other associated information of each test case.
Finally, it should be noted that the test method provided in any embodiment of the present application may be executed in a test environment of the service platform in the car networking system to test whether a fault exists in the service to be released, and may also be executed in a production environment of the service platform in the car networking system at regular time, so as to implement inspection of the production environment. The test environment refers to a stage before a business program which is operated by the business server and used for providing the car networking service is issued, and the production environment refers to a stage when the business program which is used for providing the car networking service is issued to the business server and is accessed to a client and a car box in the system, and the car networking service is provided for a user.
In combination with the testing method for the service platform in the car networking provided in any embodiment of the present application, an embodiment of the present application further provides a testing apparatus for the service platform in the car networking, where the testing apparatus may be regarded as a testing server in the testing system shown in fig. 2, please refer to fig. 7, and the testing apparatus includes:
a selecting unit 701, configured to select one of the multiple test cases stored in the test server as a current test case.
Wherein the current test case at least comprises a service request.
The execution unit 702 is configured to execute the current test case, so that the service server generates feedback data corresponding to the service request included in the current test case.
A receiving unit 703 is configured to receive feedback data sent by the service server.
The verification unit 704 is configured to verify the feedback data according to the current test case to obtain a test result of the current test case.
Optionally, the testing apparatus provided in this embodiment further includes:
the prompting unit 705 is configured to output a failure prompt message to prompt the service server that a failure occurs if the test of the current test case fails.
Optionally, the testing apparatus provided in this embodiment further includes:
the integration unit 706 is configured to integrate the test result of each test case obtained within the preset time to obtain a test report within the preset time.
Specifically, the preset time here may be the last 30 minutes.
In a specific embodiment of the present application, the current test case includes a service request and vehicle condition information; the service request of the current test case comprises a vehicle condition query request;
when the execution unit 702 executes the current test case, it is specifically configured to:
sending the vehicle condition information of the current test case to a vehicle-mounted terminal simulator, so that the vehicle-mounted terminal simulator adjusts the current vehicle condition parameters according to the vehicle condition information of the current test case; the adjusted value of the vehicle condition parameter is matched with the value of the vehicle condition parameter carried by the vehicle condition information;
and sending the vehicle condition query request contained in the current test case to the service server, so that the service server generates feedback data corresponding to the vehicle condition query request.
When the checking unit 704 checks the feedback data, it is specifically configured to:
matching the vehicle condition parameters carried by the feedback data with the vehicle condition information of the current test case, and judging whether the value of the return code carried by the feedback data is equal to a preset expected value or not to obtain the test result of the current test case; and the vehicle condition parameters carried by the feedback data are the adjusted vehicle condition parameters reported to the service server by the vehicle-mounted terminal simulator.
In yet another alternative embodiment of the present application, the current test case includes vehicle condition information and a service request, the service request including a remote control request; the remote control request is used for indicating the service server to control the vehicle-mounted terminal simulator to adjust the vehicle condition parameters to a second numerical value carried by the remote control request;
when the execution unit 702 executes the current test case, it is specifically configured to:
sending the vehicle condition information of the current test case to a vehicle-mounted terminal simulator, and adjusting the vehicle condition parameters of the vehicle-mounted terminal simulator from the current numerical value to obtain a first numerical value carried by the vehicle condition information;
and sending a remote control request contained in the current test case to the service server, so that the service server generates feedback data corresponding to the remote control request.
When the checking unit 704 checks the feedback data, it is specifically configured to:
matching the vehicle condition parameters carried by the feedback data with the service request of the current test case, and judging whether the value of the return code carried by the feedback data is equal to a preset expected value or not to obtain the test result of the current test case; the vehicle condition parameters carried by the feedback data are vehicle condition parameters adjusted by the service server according to the service request control simulation vehicle-mounted terminal of the current test case.
In yet another optional embodiment of the present application, the current test case includes a service request and an exception message, and the service request includes an exception query request;
when the execution unit 702 executes the current test case, it is specifically configured to:
sending an abnormal message of the current test case to a vehicle-mounted terminal simulator, and reporting the abnormal message to a service server by the vehicle-mounted terminal simulator;
and sending an abnormal query request contained in the current test case to the service server, so that the service server generates feedback data corresponding to the abnormal query request.
When the checking unit 704 checks the feedback data, it is specifically configured to:
and detecting whether the message push list carried by the feedback data carries abnormal messages of the current test case, and judging whether the value of the return code carried by the feedback data is equal to a preset expected value to obtain the test result of the current test case.
Optionally, the test server may be configured with a test time of each test case;
the selecting unit 701 is specifically configured to:
and selecting a test case with the corresponding test time consistent with the current time from a plurality of test cases stored by the test server as the current test case.
For the specific working principle of the testing apparatus provided in this embodiment, reference may be made to corresponding steps in the testing method provided in any embodiment of the present application, which are not described herein again.
The application provides a testing device of a car networking service platform, which is applied to a testing server, wherein a selection unit 701 selects one of a plurality of test cases stored by the testing server as a current test case; the execution unit 702 executes the current test case to enable the service server to generate corresponding feedback data, and after the receiving unit 703 receives the feedback data, the verification unit 704 verifies the feedback data according to the current test case to obtain a test result of the current test case. According to the scheme provided by the application, the test server can replace the client to automatically execute the pre-stored test cases to obtain the test results of the test cases.
The embodiment of the present application further provides a computer storage medium, which is used for storing a program, and when the stored program is executed, the computer storage medium is used for implementing the testing method of the car networking service platform provided in any embodiment of the present application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
It should be noted that the terms "first", "second", and the like in the present invention are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
Those skilled in the art can make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.