Search

CN-121996553-A - Data acquisition method and electronic equipment

CN121996553ACN 121996553 ACN121996553 ACN 121996553ACN-121996553-A

Abstract

The embodiment of the application relates to the technical field of computers, and provides a data acquisition method and electronic equipment, wherein a first application and a first testing tool are installed on the electronic equipment, and the first application comprises a reflection proxy service and a reflection interface. The electronic device determines a first reflection parameter through the reflection proxy service in response to a first data request of the first test tool. Wherein the first data request is for requesting acquisition of characteristic data of the first object, and the first reflection parameter includes an identification of the first object. And then, the electronic equipment transmits the first reflection parameter to the reflection interface through the reflection proxy service, and calls the reflection interface to acquire first data generated by the operation of the first application, wherein the first data comprises characteristic data of the first object. Finally, the electronic device returns the first data to the first test tool through the reflection proxy service. By the method, the complexity of cross-process communication interaction can be effectively reduced, and the efficiency of data acquisition is improved.

Inventors

  • GUAN SONG
  • DENG CHAO
  • Xiao Xuyun

Assignees

  • 深圳市创梦天地科技有限公司

Dates

Publication Date
20260508
Application Date
20260121

Claims (13)

  1. 1. A data acquisition method, applied to an electronic device, on which a first application and a first test tool are installed, the first application including a reflection proxy service and a reflection interface, the method comprising: determining, by the reflection proxy service, a first reflection parameter in response to a first data request of the first test tool, the first data request being for requesting acquisition of feature data of a first object, the first reflection parameter including an identification of the first object; transmitting the first reflection parameter to the reflection interface through the reflection proxy service, and calling the reflection interface to acquire first data generated by the first application operation, wherein the first data comprises characteristic data of the first object; And returning the first data to the first test tool through the reflection proxy service.
  2. 2. The method of claim 1, wherein the identification of the first object includes an object name of the first object, an attribute name of a first attribute of the first object, and the feature data of the first object includes an attribute value of the first attribute, and wherein the transmitting the first reflection parameter to the reflection interface through the reflection proxy service, and invoking the reflection interface to obtain first data generated by the first application running specifically includes: transmitting the object name of the first object to the reflection interface through the reflection proxy service, and calling the reflection interface to acquire the identification of the first instance of the first object; And transmitting the identification of the first instance and the attribute name of the first attribute to the reflection interface through the reflection proxy service, and calling the reflection interface to acquire the attribute value of the first attribute of the first instance.
  3. 3. The method of claim 2, wherein the first data request includes a first filter condition, wherein the invoking the identity obtained by the reflection interface includes the identity of a plurality of instances of the first object, and wherein invoking the reflection interface to obtain the attribute value of the first attribute of the first instance further comprises, prior to communicating the identity of the first instance and the attribute name of the first attribute to the reflection interface by the reflection proxy service: And calling the reflection interface through the reflection proxy service, and screening the first instance from the plurality of instances according to the first filtering condition.
  4. 4. A method as claimed in any one of claims 1 to 3, wherein the first data request is generated by the first test tool from a first test case describing the acquisition of the first data.
  5. 5. The method of claim 4, wherein the method further comprises: and judging whether the first data accords with the test conditions in the first test case or not through the first test tool to obtain a first test result.
  6. 6. The method of any of claims 1-5, wherein the reflection proxy service comprises a reflection parameter configuration table comprising a mapping of a first data request to a first reflection parameter.
  7. 7. The method of any one of claims 1-6, wherein the method further comprises: The reflection proxy service returns first warning information to the first testing tool, wherein the first warning information is used for indicating that the first data does not exist or the authority of the first data is not requested.
  8. 8. The method according to any of claims 1-7, wherein said returning said first data to said first test tool via said reflection proxy service, in particular comprises: compressing the first data through the reflection proxy service to obtain compressed first data; And returning the compressed first data to the first testing tool through the reflection proxy service.
  9. 9. The method of any of claims 1-8, wherein the feature data of the first object includes data of a first feature and data of a second feature, and wherein after the returning the first data to the first test tool by the reflection proxy service, further comprises: Responding to a second data request of the first test tool, calling the reflection interface through the reflection proxy service to acquire the characteristic data of the first object, wherein the data of the first characteristic changes when responding to the first data request, and the data of the second characteristic does not change when responding to the first data request; And returning the data of the first feature to the first test tool through the reflection proxy service.
  10. 10. The method of claims 1-9, wherein the configuration file of the first application includes a first statement corresponding to the reflection proxy service, and the electronic device loads the program of the reflection proxy service into the running memory of the first application according to the first statement in the running process of the first application.
  11. 11. An electronic device comprising a memory, a processor and a computer program stored on the memory, the processor executing the computer program to perform the steps of the method of any one of claims 1-10.
  12. 12. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, realizes the steps of the method according to any of claims 1-10.
  13. 13. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any of claims 1-10.

Description

Data acquisition method and electronic equipment Technical Field The present application relates to the field of computer technologies, and in particular, to a data acquisition method and an electronic device. Background In the development and testing of applications, it is often necessary to acquire and analyze data of the application during its operation in order to ensure that its functions, performance, interface display, etc. meet design expectations. For example, during a game application test, various data in a game pair, such as a character experience value, a character blood volume, a knapsack object, etc., are usually acquired according to a test requirement, and then whether each function logic of the game operates normally is judged by analyzing the data, such as whether the experience value of the character increases according to a preset experience value after a clearance, whether the blood volume decreases according to a preset injury value after an attack, whether the object enters a knapsack list after picking up the object, etc. However, current methods for acquiring data at the time of application run have limitations. Disclosure of Invention In a first aspect, an embodiment of the present application provides a data acquisition method, which is applied to an electronic device. The electronic device is provided with a first application and a first testing tool, wherein the first application comprises a reflection proxy service and a reflection interface. The data acquisition method includes that the electronic device responds to a first data request of a first testing tool and determines a first reflection parameter through a reflection proxy service. Wherein the first data request is for requesting acquisition of characteristic data of the first object, and the first reflection parameter includes an identification of the first object. And then, the electronic equipment transmits the first reflection parameter to the reflection interface through the reflection proxy service, and calls the reflection interface to acquire first data generated by the operation of the first application, wherein the first data comprises characteristic data of the first object. Finally, the electronic device returns the first data to the first test tool through the reflection proxy service. The method provided by the first aspect is implemented, the reflection proxy service is used as an intermediate, the complex reflection operation inside the first application is packaged into a standard interface, the functions of analyzing the data request and calling the reflection interface are undertaken, and the cross-process communication interaction between the first test tool and the first application only comprises the steps of sending the request and receiving the data, so that the complexity of the cross-process interaction is reduced, and the efficiency of data acquisition is improved. And the data is directly acquired from the running memory of the first application through the reflection interface, so that the data acquisition is more convenient and faster compared with the data acquisition through packet capture, the data acquisition is more accurate compared with image recognition, and the data acquisition is more flexible and non-invasive compared with the data acquisition of a printing log. In combination with the first aspect, in some embodiments, the identification of the first object includes an object name of the first object, an attribute name of a first attribute of the first object, and the characteristic data of the first object includes an attribute value of the first attribute. The electronic equipment can transmit the object name of the first object to the reflecting interface through the reflecting proxy service, call the reflecting interface to acquire the identification of the first instance of the first object, and then transmit the identification of the first instance and the attribute name of the first attribute to the reflecting interface through the reflecting proxy service, and call the reflecting interface to acquire the attribute value of the first attribute of the first instance. In some embodiments, the identification of the first object may further include a method name of the first method, and the feature data of the first object further includes a method return value of the first method, the first method being a method of the first object. The electronic device may communicate the method name of the first method to the reflection interface, and invoke the reflection interface to obtain a method return value of the first method of the first instance. By transferring the object name, the attribute name and/or the method name, the target data can be rapidly positioned and acquired by utilizing the reflection proxy service of the first application, and the data acquisition efficiency and the data instantaneity are improved. In combination with the first aspect, in some embodiments, th