WO2019051714A1 - Test method and test apparatus for application memory of smart device - Google Patents

Test method and test apparatus for application memory of smart device Download PDF

Info

Publication number
WO2019051714A1
WO2019051714A1 PCT/CN2017/101744 CN2017101744W WO2019051714A1 WO 2019051714 A1 WO2019051714 A1 WO 2019051714A1 CN 2017101744 W CN2017101744 W CN 2017101744W WO 2019051714 A1 WO2019051714 A1 WO 2019051714A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
memory
test case
application
case
Prior art date
Application number
PCT/CN2017/101744
Other languages
French (fr)
Chinese (zh)
Inventor
刘银银
Original Assignee
深圳传音通讯有限公司
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 深圳传音通讯有限公司 filed Critical 深圳传音通讯有限公司
Priority to PCT/CN2017/101744 priority Critical patent/WO2019051714A1/en
Publication of WO2019051714A1 publication Critical patent/WO2019051714A1/en

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

Definitions

  • the present invention relates to the field of smart devices, and in particular, to a test method and a test device for an application memory of a smart device.
  • the entire script design is written based on uiautomator.
  • the entire script is written using the sh script.
  • Java is used to encapsulate the corresponding method, and the AndroidUiTool.jar package is built into the mobile phone.
  • Uitool is implanted into the mobile phone, and the uiautomator encapsulation method is used to obtain the command: dumpsys meminfo+ package name, respectively, to obtain detailed information of the memory and
  • the overall memory value the memory table obtained from this value is convenient to visually check the memory change trend.
  • the corresponding screenshots can be obtained, and the corresponding mtklog provides a certain basis for solving the problem.
  • Uiautomator as its name implies, is used for ui automation testing, mainly to simulate click, slide, input text and other operations without artificial manipulation. If a set of repeated operations is implemented with uiautomator, it will greatly improve efficiency. However, the scope of uiautomator is very limited. After learning, you will know that in uiautomator, each ui control is an object of UiObject, and does not provide an interface for obtaining the corresponding control class (android.widget.*) of the control. So in uiautomator, a Button and an ImageView are the same - both are UiObject objects.
  • test method for an application memory of a smart device, characterized in that the test method comprises:
  • the test scenario corresponding to the application is written to the application of the smart device, and at least one test case based on the application is set according to the test scenario, including:
  • configuring the test execution file based on the test case according to the information of the test case comprises:
  • the execution mode is recorded in the test execution file.
  • executing the test case according to the test execution file to obtain a memory output result of the test case includes:
  • the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result.
  • the memory output result is compared with the expected result of the memory, and the test result of the test case is obtained, including:
  • test device for an application memory of a smart device, wherein the test device comprises: a use case module, a configuration module, an execution module, a comparison module, wherein
  • the use case module is configured to write a test scenario corresponding to the application to an application of the smart device, and set at least one test case based on the application according to the test scenario;
  • the configuration module is communicatively coupled to the use case module, and configured to configure a test execution file based on the test case according to the information of the test case;
  • the execution module is communicatively coupled to the configuration module, and configured to execute the test case according to the test execution file to obtain a memory output result of the test case;
  • the comparison module is in communication with the execution module, and is configured to compare the memory output result with a memory expected result to obtain a test result of the test case.
  • the use case module includes:
  • a scene unit configured to write each operation flow of the application into a test scenario for the application
  • the use case unit is configured to be in communication with the scenario unit, configured to acquire the relationship of the test scenario according to the information about the test scenario of the application, and integrate the test scenario based on the relationship to generate the test case.
  • the configuration module includes:
  • An association unit configured to obtain information about the test case to obtain an association between the test cases, and configure an execution manner of the test case according to the association;
  • a configuration unit configured to communicate with the associated unit, to record the execution mode in the test execution file.
  • the execution module includes:
  • a time unit configured to set a preset time interval threshold
  • An execution unit configured to be in communication with the time unit, configured to record memory information of the smart device according to a preset time interval threshold and integrate the memory output result when the test case is executed according to the test execution file .
  • the comparison module comprises:
  • a storage unit configured to pre-store a correspondence between the test case and the expected result of the memory based on the test case
  • a comparison unit configured to communicate with the storage unit, to compare the information of the memory output result with the expected result of the memory, and analyze the information of the test result of the test case.
  • Improved memory test can be implemented: execute shell script test, simplify test case writing, maintenance; executable function test, stress test; timely log capture and save during test; select free module to test and obtain test memory anytime and anywhere Test Results;
  • script writing is simple, no need for testers to understand the code implementation details, based on Java, the test code structure is simple, interactive test can get the memory usage information of the specified application, separate from the third-party tools, completely apply Android itself
  • the command, offline test does not need to occupy PC resources, freely select the test module according to the test requirements, obtain memory information anytime and anywhere, does not affect the execution of the script.
  • FIG. 1 is a schematic flow chart in accordance with a preferred embodiment of the present invention.
  • FIG. 2 is a schematic flow chart of a specific implementation of step 101 shown in FIG. 1;
  • step 102 shown in FIG. 1 is a schematic flow chart of a specific implementation of step 102 shown in FIG. 1;
  • step 103 shown in FIG. 1;
  • FIG. 5 is a schematic flow chart of a specific implementation of step 104 shown in FIG. 1;
  • Figure 6 is a schematic view showing the structure in accordance with a preferred embodiment of the present invention.
  • Figure 7 is a schematic view of a structure in accordance with a preferred embodiment of the present invention.
  • Figure 8 is a schematic view of a structure in accordance with a preferred embodiment of the present invention.
  • Figure 9 is a schematic view showing the structure in accordance with a preferred embodiment of the present invention.
  • Figure 10 is a schematic view of the structure in accordance with a preferred embodiment of the present invention.
  • the smart device used herein includes a device of a wireless signal receiver, a device having only a wireless signal receiver without a transmitting capability, and a device for receiving and transmitting hardware, which has the capability to A device that performs bidirectional communication reception and transmission hardware on a two-way communication link.
  • Such a device may comprise: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may Combined voice, data processing, fax and/or data communication capabilities; PDA (Personal Digital Assistant), which can include radio frequency receivers, pagers, Internet/Intranet access, web browsers, notepads, calendars and / Or a GPS (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having a conventional laptop and/or palmtop computer or other including a radio frequency receiver or other device.
  • PCS Personal Communications Service
  • PDA Personal Digital Assistant
  • device may be portable, transportable, installed in a vehicle (aviation, sea and/or land), or adapted and/or configured to operate locally, and/or Run in any other location on the Earth and/or space in a distributed form.
  • the "device” and “smart device” used herein may also be a communication device, an internet device, a music/video playback device, such as a PDA, a MID (Mobile Internet Device), and/or have a music/video playback.
  • Functional mobile phones can also be smart TVs, set-top boxes and other devices.
  • first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as second information without departing from the scope of the present disclosure.
  • second information may also be referred to as first information.
  • word "if” as used herein may be interpreted as "when” or “when” or “in response to a determination.”
  • a flow diagram consistent with a preferred embodiment of the present invention includes:
  • Step 101 Write a test scenario corresponding to the application to the application of the smart device, and set at least one test case based on the application according to the test scenario;
  • test requirement for example, each operation flow to the application. If you need to drive the model, you need to constrain the test requirements, that is, we need to formalize the test requirements.
  • the formalization of test requirements is easy to convert to test requirements.
  • test requirements can include the transformation from natural language to UML.
  • test requirements can include the transformation from natural language to UML.
  • it is mainly expressed by, but not limited to, UML usecase diagrams and activity diagrams.
  • the input test requirements can include an activity graph that is formalized in UML form for the requirement.
  • the test requirements include a test activity map. More specifically, the basis of the conversion is to define test items, that is, to define test items in the test requirements, such as, but not limited to, which application operations need to be tested. Then, according to the test item, the activity graph is analyzed to see if it is necessary to increase the check node for the demand item (which will be converted into a checkpoint). If the original activity map has been able to meet the requirements, you can directly convert the demand activity map into a test activity map; if it is missing, you need to add checkpoints to the demand activity graph, mainly to increase the inspection function, the most typical is to increase the query. And can be verified according to the query results.
  • Corresponding test data is generated according to the test scenario, and the test data is added to the test scenario corresponding thereto to form a test case, and all the test cases are output.
  • test case design is required after the test scenario is established. From the perspective of model driving, the test cases are formed by adding test data to the test scenario, and there is a certain relationship between the test scenarios, namely: test scenario + test data - test case. Therefore, the focus of this method step is to design a test case, or add test data to the test case to form a test case. Obviously, the test case can include many test scenarios.
  • Step 102 Configure a test execution file based on the test case according to the information of the test case;
  • the code under test may be compiled to generate an executable file for code coverage analysis, ie, setting the compilation parameters
  • the executable file is generated according to the compilation parameters, that is, the test case parameters are added in the component compilation.
  • the test execution file with the test case information is packaged, that is, the information for identifying the test case is obtained, the information including the test case is generated, and the information of the test case is packaged into the test execution file.
  • the test execution file identifies the code during execution to be used for runtime memory usage analysis, that is, the test execution file, and the test execution file includes test case information, which is added during packaging.
  • the corresponding method is encapsulated to generate AndroidUiTool.jar.
  • Uitool is implanted in the phone, calling the encapsulation method of uiautomator.
  • the execution mode is recorded in the test execution file.
  • test execution file is deployed in the test environment, that is, the jar file is deployed in the test environment to deploy the test environment. This includes, but is not limited to, the operating environment of the smart device.
  • the executable file is deployed in the test environment, that is, after the test environment is deployed, the test case for the functional test is executed in the test environment, and the test execution file and the test case for the functional test are submitted to the test case execution management tool.
  • a custom sh file or the like is used to test the test cases configured in the test execution file.
  • Step 103 Execute the test case according to the test execution file to obtain a memory output result of the test case.
  • test execution files on a smart device When you run test execution files on a smart device to create test cases and automate these test cases, they take the test cases in order. Then, when the smart device executes the taken test, an execution time interval of the test case is set between each test case, so that the test case is executed according to the interval of the execution time, and the test frame used in this embodiment is preset to wait.
  • the period that is, the maximum tolerance time of the response after the test case is executed, and continuously detects whether the smart device returns a response to the test message within the preset waiting period; if the smart device returns a response within a preset waiting period, The test framework stops waiting, and the smart device receives the returned response and performs subsequent tests according to the returned response; if the smart device does not return a response within a predetermined waiting period, the test framework no longer waits, directly returns the timeout information to the smart The device notifies the smart device to skip testing the taken test case and perform the test of the next test case.
  • the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result;
  • the pushed test execution file can be received according to the operating principle of the above test framework.
  • the first thread of the test framework executes the test case, and the first thread can execute the test case by calling the relationship of the test case included in the test execution file, and at the same time, the second thread is created, and the memory monitoring is started in the second thread.
  • the test execution file finishes running the test case execution ends and the first thread terminates.
  • the termination signal is sent to the second thread, the termination signal indicates the end of the test case, and the second thread terminates.
  • the embodiment is not limited to only starting a pair of threads, for example, the first thread executes the test case, and the second The thread monitors the memory and records it in real time with the memory output.
  • the second thread is in operation, detecting whether the test case in the first thread is still executing, detecting whether a termination signal from the first thread is received, and if yes, determining that the execution of the test case in the first thread ends, otherwise determining Test cases in one thread are still executing. If it is determined that the execution of the test case in the first thread is finished, the memory can be stopped. Monitor and terminate the second thread. If it is determined that the test case in the first thread is still executing, the memory usage data of the tested application is collected. The application to be tested can be selected, and the memory occupation data of the tested application is collected from the memory monitoring data acquired by the smart device.
  • Step 104 Comparing the memory output result with the expected result of the memory to obtain a test result of the test case
  • the estimated memory expected result of the test case is pre-set.
  • the expected result of the memory is the memory usage of the application associated with the test case at runtime, and is mainly used to detect whether the application has a memory leak at runtime.
  • the memory occupancy growth rate can be obtained by dividing the sampling time interval. For example, for a music program, the maximum memory alert value can be 50MB, and the memory growth speed alert value can be 10KB/s.
  • the execution result of the test case is marked as normal completion.
  • an alarm signal is sent, and the memory information file of the tested application is simultaneously extracted, so as to locate the memory leak location of the tested application according to the memory information file.
  • the PID of the application under test can be passed.
  • the corresponding screenshots can be obtained, and the corresponding mtklog provides a certain basis for solving the problem.
  • memory occupancy data and memory growth rate can more accurately determine whether a memory leak occurs, and when a memory leak is found, the tester can be notified at the first time, and the file storing the complete memory information can be obtained without connecting to the PC. Through this file tester can more accurately locate the location where the memory leak occurs, and avoid the situation that the memory information is incomplete and difficult to locate due to the memory being released.
  • a device in accordance with the present invention can be implemented by a test device 10, including: a use case module 11, a configuration module 12, an execution module 13, and a comparison module 14.
  • the use case module 11 is configured to write a test scenario corresponding to the application to the application of the smart device, and set at least one test case based on the application according to the test scenario;
  • test requirement for example, each operation flow to the application. If you need to drive the model, you need to constrain the test requirements, that is, we need to formalize the test requirements.
  • the formalization of test requirements is easy to convert to test requirements.
  • test requirements can include the transformation from natural language to UML.
  • test requirements can include the transformation from natural language to UML.
  • it is mainly expressed by, but not limited to, UML usecase diagrams and activity diagrams.
  • the input test requirements can include an activity graph that is formalized in UML form for the requirement.
  • the test requirements include a test activity map. More specifically, the basis of the conversion is to define test items, that is, to define test items in the test requirements, such as, but not limited to, which application operations need to be tested. Then, according to the test item, the activity graph is analyzed to see if it is necessary to increase the check node for the demand item (which will be converted into a checkpoint). If the original activity map has been able to meet the requirements, you can directly convert the demand activity map into a test activity map; if it is missing, you need to add checkpoints to the demand activity graph, mainly to increase the inspection function, the most typical is to increase the query. And can be verified according to the query results.
  • Test cases are formed in the scene and all of the test cases are output.
  • test case design is required after the test scenario is established. From the perspective of model driving, the test cases are formed by adding test data to the test scenario, and there is a certain relationship between the test scenarios, namely: test scenario + test data - test case. Therefore, the focus of this method step is to design a test case, or add test data to the test case to form a test case. Obviously, the test case can include many test scenarios.
  • the configuration module 12 is communicatively coupled to the use case module, and configured to configure a test execution file based on the test case according to the information of the test case;
  • the code under test may be compiled to generate an executable file for code coverage analysis, ie, setting the compilation parameters
  • the executable file is generated according to the compilation parameters, that is, the test case parameters are added in the component compilation.
  • the test execution file with the test case information is packaged, that is, the information for identifying the test case is obtained, the information including the test case is generated, and the information of the test case is packaged into the test execution file.
  • the test execution file identifies the code during execution to be used for runtime memory usage analysis, that is, the test execution file, and the test execution file includes test case information, which is added during packaging.
  • the corresponding method is encapsulated to generate AndroidUiTool.jar.
  • Uitool is implanted in the phone, calling the encapsulation method of uiautomator.
  • the execution mode is recorded in the test execution file.
  • test execution file is deployed in the test environment, that is, the jar file is deployed in the test environment to deploy the test environment.
  • the test environment includes, but is not limited to, the operating environment of the smart device.
  • the executable file is deployed in the test environment, that is, after the test environment is deployed, the test case for the functional test is executed in the test environment, and the test execution file and the test case for the functional test are submitted to the test case execution management tool.
  • a custom sh file or the like is used to test the test cases configured in the test execution file.
  • the execution module 13 is in communication with the configuration module, and is configured to execute the test case according to the test execution file to obtain a memory output result of the test case;
  • Run test execution files on smart devices to create test cases and automate testing of these test cases When it is, the test cases are sequentially taken out in order. Then, when the smart device executes the taken test, an execution time interval of the test case is set between each test case, so that the test case is executed according to the interval of the execution time, and the test frame used in this embodiment is preset to wait.
  • the period that is, the maximum tolerance time of the response after the test case is executed, and continuously detects whether the smart device returns a response to the test message within the preset waiting period; if the smart device returns a response within a preset waiting period, The test framework stops waiting, and the smart device receives the returned response and performs subsequent tests according to the returned response; if the smart device does not return a response within a predetermined waiting period, the test framework no longer waits, directly returns the timeout information to the smart The device notifies the smart device to skip testing the taken test case and perform the test of the next test case.
  • the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result;
  • the pushed test execution file can be received according to the operating principle of the above test framework.
  • the first thread of the test framework executes the test case, and the first thread can execute the test case by calling the relationship of the test case included in the test execution file, and at the same time, the second thread is created, and the memory monitoring is started in the second thread.
  • the test execution file finishes running the test case execution ends and the first thread terminates.
  • the termination signal is sent to the second thread, the termination signal indicates the end of the test case, and the second thread terminates.
  • the embodiment is not limited to only starting a pair of threads, for example, the first thread executes the test case, and the second The thread monitors the memory and records it in real time with the memory output.
  • the second thread is in operation, detecting whether the test case in the first thread is still executing, detecting whether a termination signal from the first thread is received, and if yes, determining that the execution of the test case in the first thread ends, otherwise determining Test cases in one thread are still executing. If it is determined that the execution of the test case in the first thread is finished, the memory monitoring can be stopped and the second thread is terminated. If it is determined that the test case in the first thread is still executing, the memory usage data of the tested application is collected. The application to be tested can be selected, and the memory occupation data of the tested application is collected from the memory monitoring data acquired by the smart device.
  • the comparison module 14 is in communication with the execution module, and is configured to compare the memory output result with the expected result of the memory to obtain a test result of the test case;
  • the estimated memory expected result of the test case is pre-set.
  • the expected result of the memory is the memory usage of the application associated with the test case at runtime, and is mainly used to detect whether the application has a memory leak at runtime.
  • the memory occupancy growth rate can be obtained by dividing the sampling time interval. For example, for a music program, the maximum memory alert value can be 50MB, and the memory growth speed alert value can be 10KB/s.
  • the execution result of the test case is marked as normal completion.
  • an alarm signal is sent, and the memory information file of the tested application is simultaneously extracted, so as to locate the memory leak location of the tested application according to the memory information file.
  • the PID of the application under test can be passed.
  • the corresponding screenshots can be obtained, and the corresponding mtklog provides a certain basis for solving the problem.
  • memory occupancy data and memory growth rate can more accurately determine whether a memory leak occurs, and when a memory leak is found, the tester can be notified at the first time, and the file storing the complete memory information can be obtained without connecting to the PC. Through this file tester can more accurately locate the location where the memory leak occurs, and avoid the situation that the memory information is incomplete and difficult to locate due to the memory being released.
  • an embodiment of the present invention further provides a computer readable storage medium having stored therein computer executable instructions, such as a non-volatile memory such as an optical disk, a hard disk, or a flash memory.
  • computer executable instructions are for causing a computer or similar computing device to perform various operations in the above described test method for the application memory of the smart device.
  • the present invention includes apparatus related to performing one or more of the operations described herein. These devices may be specially designed and manufactured for the required purposes, or may also include known devices in a general purpose computer. These devices have computer programs stored therein that are selectively activated or reconfigured.
  • Such computer program can be stored in a device (eg, computer) readable medium or in any type of medium suitable for storing electronic instructions and separately coupled to a bus, the computer readable medium comprising But not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable) Read-Only Memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or light card. That is, a readable medium includes any medium that is stored or transmitted by a device (eg, a computer) in a readable form.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A test method for an application memory of a smart device. The test method comprises: writing, for an application of a smart device, a test scenario corresponding to the application, and configuring at least one test case based on the application according to the test scenario (101); configuring a test execution file based on the test case according to information of the test case (102); executing the test case according to the test execution file to obtain a memory output result of the test case (103); and comparing the memory output result with a memory expectation result to obtain a test result of the test case (104). The method simplifies the writing and maintenance of test cases.

Description

一种用于智能设备的应用程序内存的测试方法及测试装置Test method and test device for application memory of smart device 技术领域Technical field
本发明涉及智能设备领域,尤其涉及一种用于智能设备的应用程序内存的测试方法及测试装置。The present invention relates to the field of smart devices, and in particular, to a test method and a test device for an application memory of a smart device.
背景技术Background technique
设计相应的测试场景,模拟用户的使用习惯设计用例,执行测试,整个测试过程完全脱离pc使得手机独立运行,自由设置运行次数,对于运行中产生的功能问题及时进行信息保存并抓取截图。Design the corresponding test scenario, simulate the user's habit design use case, execute the test, the whole test process is completely separated from the pc to make the mobile phone run independently, freely set the number of runs, save the information and capture screenshots for the functional problems generated during the operation.
整个的脚本设计基于uiautomator进行编写,为了方便脚本的编写整个脚本使用sh脚本进行书写。用Java将对应的方法进行封装,生成AndroidUiTool.jar包植入手机,在写入接口文件:Uitool植入手机,调用uiautomator的封装方法使用获得命令:dumpsys meminfo+包名,分别获取内存的详细信息与整体的内存值,由该值获得内存表格方便直观查看内存的变化趋势对于运行中产生产生的功能性问题,可以获取对应截图,与相应的mtklog,为解决问题提供一定的依据。The entire script design is written based on uiautomator. To facilitate script writing, the entire script is written using the sh script. Java is used to encapsulate the corresponding method, and the AndroidUiTool.jar package is built into the mobile phone. In the interface file: Uitool is implanted into the mobile phone, and the uiautomator encapsulation method is used to obtain the command: dumpsys meminfo+ package name, respectively, to obtain detailed information of the memory and The overall memory value, the memory table obtained from this value is convenient to visually check the memory change trend. For the functional problems generated during the operation, the corresponding screenshots can be obtained, and the corresponding mtklog provides a certain basis for solving the problem.
Uiautomator,顾名思义,是用于ui自动化测试的,主要是仿真单击,滑动,输入文本等操作,而不用人为地进行操作,如果把一组反复进行的操作用uiautomator实现,那么将大大提高效率。但是uiautomator使用范围非常有限,学习之后会知道,在uiautomator中,每一个ui控件都是UiObject的对象,并没有提供获得控件对应控件类(android.widget.*)的接口。所以在uiautomator中,一个Button和ImageView都是一样的——都是UiObject的对象。Uiautomator, as its name implies, is used for ui automation testing, mainly to simulate click, slide, input text and other operations without artificial manipulation. If a set of repeated operations is implemented with uiautomator, it will greatly improve efficiency. However, the scope of uiautomator is very limited. After learning, you will know that in uiautomator, each ui control is an object of UiObject, and does not provide an interface for obtaining the corresponding control class (android.widget.*) of the control. So in uiautomator, a Button and an ImageView are the same - both are UiObject objects.
发明内容Summary of the invention
为了克服上述技术缺陷,本发明的目的在于提供一种用于智能设备的应用程序内存的测试方法及测试装置。 In order to overcome the above technical drawbacks, it is an object of the present invention to provide a test method and test apparatus for an application memory of a smart device.
本发明公开了一种用于智能设备的应用程序内存的测试方法,其特征在于,所述测试方法包括:The invention discloses a test method for an application memory of a smart device, characterized in that the test method comprises:
对所述智能设备的应用程序编写与所述应用程序对应的测试场景,根据所述测试场景设置基于所述应用程序的至少一个测试用例;Writing a test scenario corresponding to the application to an application of the smart device, and setting at least one test case based on the application according to the test scenario;
根据所述测试用例的信息配置基于所述测试用例的测试执行文件;Configuring a test execution file based on the test case according to the information of the test case;
根据所述测试执行文件执行所述测试用例获取所述测试用例的内存输出结果;Performing the test case according to the test execution file to obtain a memory output result of the test case;
将所述内存输出结果与内存预期结果比较,得到所述测试用例的测试结果。Comparing the memory output result with the expected result of the memory to obtain a test result of the test case.
优选地,对所述智能设备的应用程序编写与所述应用程序对应的测试场景,根据所述测试场景设置基于所述应用程序的至少一个测试用例,包括:Preferably, the test scenario corresponding to the application is written to the application of the smart device, and at least one test case based on the application is set according to the test scenario, including:
将所述应用程序的每一个操作流程编写成对所述应用程序的测试场景;Writing each operation flow of the application into a test scenario for the application;
根据所述应用程序的所述测试场景的信息获取所述测试场景的关系,基于所述关系排序整合所述测试场景生成所述测试用例。Acquiring the relationship of the test scenario according to the information about the test scenario of the application, and integrating the test scenario based on the relationship ranking to generate the test case.
优选地,根据所述测试用例的信息配置基于所述测试用例的测试执行文件,包括:Preferably, configuring the test execution file based on the test case according to the information of the test case comprises:
获取所述测试用例的信息得到所述测试用例之间的关联,根据所述关联配置所述测试用例的执行方式;Obtaining information about the test case to obtain an association between the test cases, and configuring an execution manner of the test case according to the association;
将所述执行方式记录于所述测试执行文件中。The execution mode is recorded in the test execution file.
优选地,根据所述测试执行文件执行所述测试用例获取所述测试用例的内存输出结果,包括:Preferably, executing the test case according to the test execution file to obtain a memory output result of the test case includes:
设置一预设的时间间隔阈值;Setting a preset time interval threshold;
当根据所述测试执行文件执行所述测试用例时,根据预设的时间间隔阈值记录所述智能设备的内存信息并整合成所述内存输出结果。When the test case is executed according to the test execution file, the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result.
优选地,将所述内存输出结果与内存预期结果比较,得到所述测试用例的测试结果,包括:Preferably, the memory output result is compared with the expected result of the memory, and the test result of the test case is obtained, including:
基于所述测试用例预存一所述测试用例与所述内存预期结果之间的对应关系;Pre-preserving a correspondence between the test case and the expected result of the memory based on the test case;
比较所述内存输出结果的信息与所述内存预期结果的信息,分析所述测试用例的所述测试结果的信息。Comparing the information of the memory output result with the information of the expected result of the memory, and analyzing information of the test result of the test case.
本发明还公开了一种用于智能设备的应用程序内存的测试装置,其特征在于,所述测试装置包括:用例模块,配置模块,执行模块,比较模块,其中,The invention also discloses a test device for an application memory of a smart device, wherein the test device comprises: a use case module, a configuration module, an execution module, a comparison module, wherein
所述用例模块,用于对所述智能设备的应用程序编写与所述应用程序对应的测试场景,根据所述测试场景设置基于所述应用程序的至少一个测试用例; The use case module is configured to write a test scenario corresponding to the application to an application of the smart device, and set at least one test case based on the application according to the test scenario;
所述配置模块,与所述用例模块通讯连接,用于根据所述测试用例的信息配置基于所述测试用例的测试执行文件;The configuration module is communicatively coupled to the use case module, and configured to configure a test execution file based on the test case according to the information of the test case;
所述执行模块,与所述配置模块通讯连接,用于根据所述测试执行文件执行所述测试用例获取所述测试用例的内存输出结果;The execution module is communicatively coupled to the configuration module, and configured to execute the test case according to the test execution file to obtain a memory output result of the test case;
所述比较模块,与所述执行模块通讯连接,用于将所述内存输出结果与内存预期结果比较,得到所述测试用例的测试结果。The comparison module is in communication with the execution module, and is configured to compare the memory output result with a memory expected result to obtain a test result of the test case.
优选地,所述用例模块,包括:Preferably, the use case module includes:
场景单元,用于将所述应用程序的每一个操作流程编写成对所述应用程序的测试场景;a scene unit, configured to write each operation flow of the application into a test scenario for the application;
用例单元,与所述场景单元通讯连接,用于根据所述应用程序的所述测试场景的信息获取所述测试场景的关系,基于所述关系排序整合所述测试场景生成所述测试用例。The use case unit is configured to be in communication with the scenario unit, configured to acquire the relationship of the test scenario according to the information about the test scenario of the application, and integrate the test scenario based on the relationship to generate the test case.
优选地,所述配置模块,包括:Preferably, the configuration module includes:
关联单元,用于获取所述测试用例的信息得到所述测试用例之间的关联,根据所述关联配置所述测试用例的执行方式;An association unit, configured to obtain information about the test case to obtain an association between the test cases, and configure an execution manner of the test case according to the association;
配置单元,与所述关联单元通讯连接,用于将所述执行方式记录于所述测试执行文件中。And a configuration unit, configured to communicate with the associated unit, to record the execution mode in the test execution file.
优选地,所述执行模块,包括:Preferably, the execution module includes:
时间单元,用于设置一预设的时间间隔阈值;a time unit, configured to set a preset time interval threshold;
执行单元,与所述时间单元通讯连接,用于当根据所述测试执行文件执行所述测试用例时,根据预设的时间间隔阈值记录所述智能设备的内存信息并整合成所述内存输出结果。An execution unit, configured to be in communication with the time unit, configured to record memory information of the smart device according to a preset time interval threshold and integrate the memory output result when the test case is executed according to the test execution file .
优选地,所述比较模块,包括:Preferably, the comparison module comprises:
存储单元,用于基于所述测试用例预存一所述测试用例与所述内存预期结果之间的对应关系;a storage unit, configured to pre-store a correspondence between the test case and the expected result of the memory based on the test case;
比较单元,与所述存储单元通讯连接,用于比较所述内存输出结果的信息与所述内存预期结果的信息,分析所述测试用例的所述测试结果的信息。And a comparison unit, configured to communicate with the storage unit, to compare the information of the memory output result with the expected result of the memory, and analyze the information of the test result of the test case.
采用了上述技术方案后,与现有技术相比,具有以下有益效果:After adopting the above technical solution, compared with the prior art, the following beneficial effects are obtained:
1.改进内存测试可以实现:执行Shell脚本测试,简化测试例编写,维护;可执行功能测试、压力测试;测试过程中及时的Log抓取,保存;选择自由模块进行测试随时随地获取测试内存的测试结果; 1. Improved memory test can be implemented: execute shell script test, simplify test case writing, maintenance; executable function test, stress test; timely log capture and save during test; select free module to test and obtain test memory anytime and anywhere Test Results;
2.改进内存测试优点:脚本编写简单,不需要测试人员了解代码实现细节,基于Java,测试代码结构简单,交互性测试可以获取指定应用的内存使用信息,脱离第三方的工具,完全应用Android自身的命令,脱机进行测试,不用专门占用PC资源,根据测试需求自由选择测试模块,随时随地获取内存信息,不影响脚本的执行。2. Improved memory test advantages: script writing is simple, no need for testers to understand the code implementation details, based on Java, the test code structure is simple, interactive test can get the memory usage information of the specified application, separate from the third-party tools, completely apply Android itself The command, offline test, does not need to occupy PC resources, freely select the test module according to the test requirements, obtain memory information anytime and anywhere, does not affect the execution of the script.
附图说明DRAWINGS
图1为符合本发明一优选实施例中的流程示意图;1 is a schematic flow chart in accordance with a preferred embodiment of the present invention;
图2为图1所示的步骤101的一种具体实施的流程示意图;2 is a schematic flow chart of a specific implementation of step 101 shown in FIG. 1;
图3为图1所示的步骤102的一种具体实施的流程示意图;3 is a schematic flow chart of a specific implementation of step 102 shown in FIG. 1;
图4为图1所示的步骤103的一种具体实施的流程示意图;4 is a schematic flow chart of a specific implementation of step 103 shown in FIG. 1;
图5为图1所示的步骤104的一种具体实施的流程示意图;FIG. 5 is a schematic flow chart of a specific implementation of step 104 shown in FIG. 1;
图6为符合本发明一优选实施例中的结构示意图;Figure 6 is a schematic view showing the structure in accordance with a preferred embodiment of the present invention;
图7为符合本发明一优选实施例中的结构示意图;Figure 7 is a schematic view of a structure in accordance with a preferred embodiment of the present invention;
图8为符合本发明一优选实施例中的结构示意图;Figure 8 is a schematic view of a structure in accordance with a preferred embodiment of the present invention;
图9为符合本发明一优选实施例中的结构示意图;Figure 9 is a schematic view showing the structure in accordance with a preferred embodiment of the present invention;
图10为符合本发明一优选实施例中的结构示意图。Figure 10 is a schematic view of the structure in accordance with a preferred embodiment of the present invention.
附图标记:Reference mark:
10-测试装置、11-用例模块、12-配置模块、13-执行模块、14-比较模块:10-test device, 11-use case module, 12-configuration module, 13-execution module, 14-comparison module:
具体实施方式Detailed ways
以下结合附图与具体实施例进一步阐述本发明的优点。Advantages of the present invention are further explained below in conjunction with the accompanying drawings and specific embodiments.
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. The following description refers to the same or similar elements in the different figures unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with aspects of the present disclosure as detailed in the appended claims.
本技术领域技术人员可以理解,这里所使用的智能设备,既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,进行双向通信的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(Personal Communications Service,个人通信系统),其可以 组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global Positioning System,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“设备”、“智能设备”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“设备”、“智能设备”还可以是通信设备、上网设备、音乐/视频播放设备,例如可以是PDA,MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。Those skilled in the art can understand that the smart device used herein includes a device of a wireless signal receiver, a device having only a wireless signal receiver without a transmitting capability, and a device for receiving and transmitting hardware, which has the capability to A device that performs bidirectional communication reception and transmission hardware on a two-way communication link. Such a device may comprise: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may Combined voice, data processing, fax and/or data communication capabilities; PDA (Personal Digital Assistant), which can include radio frequency receivers, pagers, Internet/Intranet access, web browsers, notepads, calendars and / Or a GPS (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having a conventional laptop and/or palmtop computer or other including a radio frequency receiver or other device. As used herein, "device", "smart device" may be portable, transportable, installed in a vehicle (aviation, sea and/or land), or adapted and/or configured to operate locally, and/or Run in any other location on the Earth and/or space in a distributed form. The "device" and "smart device" used herein may also be a communication device, an internet device, a music/video playback device, such as a PDA, a MID (Mobile Internet Device), and/or have a music/video playback. Functional mobile phones can also be smart TVs, set-top boxes and other devices.
应当理解,尽管在本公开可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在......时”或“当......时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, the first information may also be referred to as second information without departing from the scope of the present disclosure. Similarly, the second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to a determination."
在本发明的描述中,需要理解的是,术语“纵向”、“横向”、“上”、“下”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。In the description of the present invention, it is to be understood that the terms "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", The orientation or positional relationship of the indications of "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation or positional relationship shown in the drawings, only for the convenience of describing the present invention and simplifying the description, rather than It is to be understood that the device or elements referred to have a particular orientation, are constructed and operated in a particular orientation and are therefore not to be construed as limiting.
参阅图1-5,为符合本发明一优选实施例中的流程示意图,该方法包括:Referring to Figures 1-5, a flow diagram consistent with a preferred embodiment of the present invention includes:
步骤101:对该智能设备的应用程序编写与该应用程序对应的测试场景,根据该测试场景设置基于该应用程序的至少一个测试用例;Step 101: Write a test scenario corresponding to the application to the application of the smart device, and set at least one test case based on the application according to the test scenario;
将该应用程序的每一个操作流程编写成对该应用程序的测试场景Write each operation flow of the application as a test scenario for the application
在具体实施中,进行智能设备的应用程序的功能测试的时候,输入是测试需求,例如:对应用程序的每一个操作流程。如果需要进行模型驱动,则需要对测试需求进行约束,也就是我们需要对测试需求进行形式化。测试需求的形式化是便于转换为测试需求。In a specific implementation, when performing a functional test of an application of a smart device, the input is a test requirement, for example, each operation flow to the application. If you need to drive the model, you need to constrain the test requirements, that is, we need to formalize the test requirements. The formalization of test requirements is easy to convert to test requirements.
具体地,测试需求的形式化,就是需要对测试需求的表述,可以包括从自然语言转换成为UML的形式。在测试中,主要采用但不限于UML的usecase图和活动图来表述。Specifically, the formalization of test requirements is the need to express the test requirements, which can include the transformation from natural language to UML. In the test, it is mainly expressed by, but not limited to, UML usecase diagrams and activity diagrams.
此外,在对测试需求进行形式化以后,需要在输入测试需求的时候,导入对应的活 动图,否则就需要测试需求分析做更多的工作,由人为地来解决没有必要的测试需求,以及由人为来表述的问题。这样会导致理解的偏差和测试的不足。简单地来说,输入的测试需求可以包括对该需求采用UML形式来进行形式化表达得到的活动图。In addition, after formalizing the test requirements, you need to import the corresponding activities when you input the test requirements. Moving pictures, otherwise you need to test the requirements analysis to do more work, artificially solve the unnecessary test requirements, and the problems expressed by humans. This can lead to deviations in understanding and lack of testing. Briefly, the input test requirements can include an activity graph that is formalized in UML form for the requirement.
根据该应用程序的该测试场景的信息获取该测试场景的关系,基于该关系排序整合该测试场景生成该测试用例。Acquiring the relationship of the test scenario according to the information of the test scenario of the application, and integrating the test scenario based on the relationship to generate the test case.
从上述方法可以看出,测试需求包括测试活动图。更加具体地来说,转换的基础是定义测试项,也就是需要在测试需求中定义测试项,例如但不限于哪些应用程序的操作是需要进行测试的。进而根据测试项对活动图进行分析,察看是否需要增加为了需求项(会转换成检查点)来增加检查节点。如果原来的活动图己经能够满足要求,就可以直接把需求活动图转换成为测试活动图;如果缺少,就需要对需求活动图增加检查点,主要是增加检查功能,最典型的是增加查询,并且可以根据查询结果进行校验。As can be seen from the above method, the test requirements include a test activity map. More specifically, the basis of the conversion is to define test items, that is, to define test items in the test requirements, such as, but not limited to, which application operations need to be tested. Then, according to the test item, the activity graph is analyzed to see if it is necessary to increase the check node for the demand item (which will be converted into a checkpoint). If the original activity map has been able to meet the requirements, you can directly convert the demand activity map into a test activity map; if it is missing, you need to add checkpoints to the demand activity graph, mainly to increase the inspection function, the most typical is to increase the query. And can be verified according to the query results.
依据该测试场景生成对应的测试数据,并将该测试数据添加至与其对应的该测试场景中形成测试用例,并输出所有该测试用例。Corresponding test data is generated according to the test scenario, and the test data is added to the test scenario corresponding thereto to form a test case, and all the test cases are output.
具体地,测试场景建立完成后还需要进行测试用例设计。从模型驱动的角度,测试用例就是给测试场景增加了测试数据来形成的,并且测试场景之间有着一定的结合关系,即:测试场景+测试数据一测试用例。因此,本方法步骤的重点就是设计测试用例,或者添加测试数据给测试用例,形成测试用例,显然该测试用例可以包括很多个测试场景。Specifically, test case design is required after the test scenario is established. From the perspective of model driving, the test cases are formed by adding test data to the test scenario, and there is a certain relationship between the test scenarios, namely: test scenario + test data - test case. Therefore, the focus of this method step is to design a test case, or add test data to the test case to form a test case. Obviously, the test case can include many test scenarios.
步骤102:根据该测试用例的信息配置基于该测试用例的测试执行文件;Step 102: Configure a test execution file based on the test case according to the information of the test case;
获取该测试用例的信息得到该测试用例之间的关联,根据该关联配置该测试用例的执行方式;Obtaining information about the test case to obtain an association between the test cases, and configuring an execution manner of the test case according to the association;
具体地,当需要确定针对智能设备的应用程序的功能测试的运行时内存占用率时,可以将被测试的代码进行编译,以生成用于代码覆盖率分析的可执行文件,即设置编译参数,并根据编译参数生成可执行文件,也即在组件编译中添加用于测试用例参数。例如,打包带有测试用例信息的测试执行文件,即获取用于标识测试用例参数,生成包括测试用例的信息,将测试用例的信息打包为测试执行文件。其中,测试执行文件在执行过程中对代码进行标识用于运行时内存占用率分析,即测试执行文件,测试执行文件中包括测试用例的信息,是在打包时添加进去的。最后,对应的方法进行封装,生成AndroidUiTool.jar。在写入接口文件:Uitool植入手机,调用uiautomator的封装方法。Specifically, when it is required to determine the runtime memory usage of the functional test of the application for the smart device, the code under test may be compiled to generate an executable file for code coverage analysis, ie, setting the compilation parameters, The executable file is generated according to the compilation parameters, that is, the test case parameters are added in the component compilation. For example, the test execution file with the test case information is packaged, that is, the information for identifying the test case is obtained, the information including the test case is generated, and the information of the test case is packaged into the test execution file. The test execution file identifies the code during execution to be used for runtime memory usage analysis, that is, the test execution file, and the test execution file includes test case information, which is added during packaging. Finally, the corresponding method is encapsulated to generate AndroidUiTool.jar. In the write interface file: Uitool is implanted in the phone, calling the encapsulation method of uiautomator.
将该执行方式记录于该测试执行文件中。The execution mode is recorded in the test execution file.
由于进行测试时,需要在特定的环境下进行,因此,需要部署测试环境。因此,将 被测试的测试用例进行编译,以生成用于运行时内存占用率的测试执行文件之后,将测试执行文件部署在测试环境中,即将jar文件部署在测试环境中,以便部署测试环境,该测试环境包括但不限于智能设备的运行环境。Because testing needs to be performed in a specific environment, you need to deploy a test environment. Therefore, will After the tested test case is compiled to generate a test execution file for runtime memory usage, the test execution file is deployed in the test environment, that is, the jar file is deployed in the test environment to deploy the test environment. This includes, but is not limited to, the operating environment of the smart device.
将可执行文件部署在测试环境中,即部署好测试环境之后,在测试环境中执行用于功能测试的测试用例,即将测试执行文件和用于功能测试的测试用例提交给测试用例执行管理工具,本实施例中,使用自定义的sh文件等,以便对测试执行文件中配置的测试用例进行测试。The executable file is deployed in the test environment, that is, after the test environment is deployed, the test case for the functional test is executed in the test environment, and the test execution file and the test case for the functional test are submitted to the test case execution management tool. In this embodiment, a custom sh file or the like is used to test the test cases configured in the test execution file.
步骤103:根据该测试执行文件执行该测试用例获取该测试用例的内存输出结果;Step 103: Execute the test case according to the test execution file to obtain a memory output result of the test case.
设置一预设的时间间隔阈值;Setting a preset time interval threshold;
在智能设备上运行测试执行文件以创建测试用例并对这些测试用例进行自动测试时,其会按照顺序依次地取出测试用例。然后,智能设备执行取出的测试用时,每个测试用例之间会设置一测试用例的执行时间间隔,从而根据该执行时间的间隔执行测试用例,本实施例使用的测试框架中会预先设定等待周期,即执行测试用例后响应的最大容忍时间,并在上述预先设定等待周期内不断地检测智能设备是否返回对测试消息的响应;如在预先设定的等待周期内智能设备返回响应,则测试框架停止等待,智能设备接收返回的响应并根据返回的响应进行后续的测试;如在预先设定的等待周期内智能设备未返回响应,则测试框架不再进行等待,直接返回超时信息至智能设备,以通知智能设备跳过对取出的测试用例进行测试,并进行下一个测试用例的测试。When you run test execution files on a smart device to create test cases and automate these test cases, they take the test cases in order. Then, when the smart device executes the taken test, an execution time interval of the test case is set between each test case, so that the test case is executed according to the interval of the execution time, and the test frame used in this embodiment is preset to wait. The period, that is, the maximum tolerance time of the response after the test case is executed, and continuously detects whether the smart device returns a response to the test message within the preset waiting period; if the smart device returns a response within a preset waiting period, The test framework stops waiting, and the smart device receives the returned response and performs subsequent tests according to the returned response; if the smart device does not return a response within a predetermined waiting period, the test framework no longer waits, directly returns the timeout information to the smart The device notifies the smart device to skip testing the taken test case and perform the test of the next test case.
当根据该测试执行文件执行该测试用例时,根据预设的时间间隔阈值记录该智能设备的内存信息并整合成该内存输出结果;When the test case is executed according to the test execution file, the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result;
根据上述测试框架的运行原理可以接收推送的测试执行文件。测试框架的第一线程执行测试用例,可以通过调用该测试执行文件包含的测试用例的关系,来使该第一线程执行测试用例,同时,创建第二线程,在该第二线程中开启内存监控,当测试执行文件运行结束即测试用例执行结束、第一线程终止,此时发送终止信号至第二线程,该终止信号指示着测试用例的结束,第二线程终止。当有后续的测试用例需要执行时,将重复上述的执行步骤,当有多个测试用例需要同时执行时,本实施例并不限于只启动一对线程,例如第一线程执行测试用例,第二线程监控内存,并实时记录与内存输出结果内。The pushed test execution file can be received according to the operating principle of the above test framework. The first thread of the test framework executes the test case, and the first thread can execute the test case by calling the relationship of the test case included in the test execution file, and at the same time, the second thread is created, and the memory monitoring is started in the second thread. When the test execution file finishes running, the test case execution ends and the first thread terminates. At this time, the termination signal is sent to the second thread, the termination signal indicates the end of the test case, and the second thread terminates. When there are subsequent test cases that need to be executed, the above execution steps will be repeated. When multiple test cases need to be executed simultaneously, the embodiment is not limited to only starting a pair of threads, for example, the first thread executes the test case, and the second The thread monitors the memory and records it in real time with the memory output.
具体地,第二线程在运行中,检测第一线程中测试用例是否仍在执行,检测是否接收到来自第一线程的终止信号,若是,则确定第一线程中测试用例执行结束,否则确定第一线程中测试用例仍在执行。若确定第一线程中测试用例执行结束,则可以停止内存 监控,并终止第二线程。若确定第一线程中测试用例仍在执行,则采集被测应用的内存占用数据。可以选择被测应用程序,并从上述智能设备获取的内存监控数据中采集该被测应用的内存占用数据。Specifically, the second thread is in operation, detecting whether the test case in the first thread is still executing, detecting whether a termination signal from the first thread is received, and if yes, determining that the execution of the test case in the first thread ends, otherwise determining Test cases in one thread are still executing. If it is determined that the execution of the test case in the first thread is finished, the memory can be stopped. Monitor and terminate the second thread. If it is determined that the test case in the first thread is still executing, the memory usage data of the tested application is collected. The application to be tested can be selected, and the memory occupation data of the tested application is collected from the memory monitoring data acquired by the smart device.
步骤104:将该内存输出结果与内存预期结果比较,得到该测试用例的测试结果;Step 104: Comparing the memory output result with the expected result of the memory to obtain a test result of the test case;
基于该测试用例预存一该测试用例与该内存预期结果之间的对应关系;Pre-storing a correspondence between the test case and the expected result of the memory based on the test case;
预先设置有测试用例的预估的内存预期结果,该内存预期结果为测试用例所关联的应用程序在运行时的内存占用情况,主要用于检测该应用程序在运行时是否发生内存泄漏。The estimated memory expected result of the test case is pre-set. The expected result of the memory is the memory usage of the application associated with the test case at runtime, and is mainly used to detect whether the application has a memory leak at runtime.
比较该内存输出结果的信息与该内存预期结果的信息,分析该测试用例的该测试结果的信息;Comparing the information of the memory output result with the expected result of the memory, and analyzing the information of the test result of the test case;
获取该内存输出结果,即,内存占用数据后,可以根据该内存占用数据判断被测应用是否发生内存泄漏。具体地,可以判断该内存占用数据是否大于内存预期结果,即,最大内存警报值,若是,则确定被测应用发生内存泄漏;或者根据内存占用数据计算内存占用增长速度,相邻两个执行的时间间隔内的内存变化程度,通常是不正常的增长,判断内存占用增长速度是否大于内存增长速度警报值,若是,则确定被测应用发生内存泄漏。若以上二者均为否,则确定被测应用没有发生内存泄漏。其中将当次采集的内存占用数据减去前一次采集的内存占用数据后,除以采样时间间隔可以得到内存占用增长速度。例如,针对音乐程序,最大内存警报值可以为50MB,内存增长速度警报值可以为10KB/s。Obtaining the memory output result, that is, after the memory occupies the data, it can determine whether the tested application has a memory leak according to the memory occupation data. Specifically, it can be determined whether the memory occupation data is greater than the expected result of the memory, that is, the maximum memory alarm value, and if yes, determining that the tested application has a memory leak; or calculating the memory occupancy growth rate according to the memory occupation data, and performing the adjacent two executions. The degree of memory change in the time interval is usually abnormal growth. It is judged whether the memory occupancy growth rate is greater than the memory growth speed alarm value. If yes, it is determined that the tested application has a memory leak. If both of the above are negative, it is determined that no memory leak has occurred in the application under test. After subtracting the memory usage data collected in the previous time, the memory occupancy growth rate can be obtained by dividing the sampling time interval. For example, for a music program, the maximum memory alert value can be 50MB, and the memory growth speed alert value can be 10KB/s.
按照上述时间间隔阈值,若判断被测应用程序没有发生内存泄漏,则将该测试用例的执行结果标记为正常完成。According to the above time interval threshold, if it is determined that the tested application does not have a memory leak, the execution result of the test case is marked as normal completion.
当判断被测应用发生内存泄漏时,发出警报信号,并同时提取该被测应用的内存信息文件,以便根据该内存信息文件定位被测应用的内存泄漏位置。具体地,可以通过被测应用的PID。使用获得命令:dumpsys meminfo+包名,分别获取内存的详细信息与整体的内存值,由该值获得内存表格方便直观查看内存的变化趋势。对于运行中产生产生的功能性问题,可以获取对应截图,与相应的mtklog,为解决问题提供一定的依据。When it is determined that the tested application has a memory leak, an alarm signal is sent, and the memory information file of the tested application is simultaneously extracted, so as to locate the memory leak location of the tested application according to the memory information file. Specifically, the PID of the application under test can be passed. Use the get command: dumpsys meminfo+ package name to get the detailed information of the memory and the overall memory value. Obtain the memory table from this value to view the trend of the memory. For the functional problems generated during the operation, the corresponding screenshots can be obtained, and the corresponding mtklog provides a certain basis for solving the problem.
这样,通过内存占用数据和内存增长速度可以更准确的判断是否发生内存泄漏,并且在发现有内存泄漏时可以第一时间通知测试人员关注,同时不用连接PC即可获取保存有完整内存信息的文件,通过该文件测试人员可以更准确地定位具体发生内存泄露的位置,避兔了因内存被释放后造成的内存信息不全、难以定位的情况。 In this way, memory occupancy data and memory growth rate can more accurately determine whether a memory leak occurs, and when a memory leak is found, the tester can be notified at the first time, and the file storing the complete memory information can be obtained without connecting to the PC. Through this file tester can more accurately locate the location where the memory leak occurs, and avoid the situation that the memory information is incomplete and difficult to locate due to the memory being released.
现在将参考附图描述实现本发明各个实施例的智能设备。在后续的描述中,使用用于表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本发明的说明,其本身并没有特定的意义。因此,“模块”与“部件”可以混合地使用。A smart device embodying various embodiments of the present invention will now be described with reference to the accompanying drawings. In the following description, the use of suffixes such as "module", "component" or "unit" for indicating an element is merely an explanation for facilitating the present invention, and does not have a specific meaning per se. Therefore, "module" and "component" can be used in combination.
在本发明的描述中,除非另有规定和限定,需要说明的是,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是机械连接或电连接,也可以是两个元件内部的连通,可以是直接相连,也可以通过中间媒介间接相连,对于本领域的普通技术人员而言,可以根据具体情况理解上述术语的具体含义。In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "mounted", "connected", and "connected" are to be understood broadly, and may be, for example, mechanical or electrical, or both. The internal communication of the components may be directly connected or indirectly connected through an intermediate medium. For those skilled in the art, the specific meanings of the above terms may be understood according to specific circumstances.
参阅图6-10,为符合本发明装置,可以通过一测试装置10实现,在该装置内,包括:用例模块11、配置模块12、执行模块13、比较模块14。Referring to Figures 6-10, a device in accordance with the present invention can be implemented by a test device 10, including: a use case module 11, a configuration module 12, an execution module 13, and a comparison module 14.
用例模块11,用于对该智能设备的应用程序编写与该应用程序对应的测试场景,根据该测试场景设置基于该应用程序的至少一个测试用例;The use case module 11 is configured to write a test scenario corresponding to the application to the application of the smart device, and set at least one test case based on the application according to the test scenario;
将该应用程序的每一个操作流程编写成对该应用程序的测试场景Write each operation flow of the application as a test scenario for the application
在具体实施中,进行智能设备的应用程序的功能测试的时候,输入是测试需求,例如:对应用程序的每一个操作流程。如果需要进行模型驱动,则需要对测试需求进行约束,也就是我们需要对测试需求进行形式化。测试需求的形式化是便于转换为测试需求。In a specific implementation, when performing a functional test of an application of a smart device, the input is a test requirement, for example, each operation flow to the application. If you need to drive the model, you need to constrain the test requirements, that is, we need to formalize the test requirements. The formalization of test requirements is easy to convert to test requirements.
具体地,测试需求的形式化,就是需要对测试需求的表述,可以包括从自然语言转换成为UML的形式。在测试中,主要采用但不限于UML的usecase图和活动图来表述。Specifically, the formalization of test requirements is the need to express the test requirements, which can include the transformation from natural language to UML. In the test, it is mainly expressed by, but not limited to, UML usecase diagrams and activity diagrams.
此外,在对测试需求进行形式化以后,需要在输入测试需求的时候,导入对应的活动图,否则就需要测试需求分析做更多的工作,由人为地来解决没有必要的测试需求,以及由人为来表述的问题。这样会导致理解的偏差和测试的不足。简单地来说,输入的测试需求可以包括对该需求采用UML形式来进行形式化表达得到的活动图。In addition, after formalizing the test requirements, you need to import the corresponding activity diagram when inputting the test requirements. Otherwise, you need to test the requirements analysis to do more work, artificially solve the unnecessary test requirements, and The problem that is artificially expressed. This can lead to deviations in understanding and lack of testing. Briefly, the input test requirements can include an activity graph that is formalized in UML form for the requirement.
根据该应用程序的该测试场景的信息获取该测试场景的关系,基于该关系排序整合该测试场景生成该测试用例。Acquiring the relationship of the test scenario according to the information of the test scenario of the application, and integrating the test scenario based on the relationship to generate the test case.
从上述方法可以看出,测试需求包括测试活动图。更加具体地来说,转换的基础是定义测试项,也就是需要在测试需求中定义测试项,例如但不限于哪些应用程序的操作是需要进行测试的。进而根据测试项对活动图进行分析,察看是否需要增加为了需求项(会转换成检查点)来增加检查节点。如果原来的活动图己经能够满足要求,就可以直接把需求活动图转换成为测试活动图;如果缺少,就需要对需求活动图增加检查点,主要是增加检查功能,最典型的是增加查询,并且可以根据查询结果进行校验。As can be seen from the above method, the test requirements include a test activity map. More specifically, the basis of the conversion is to define test items, that is, to define test items in the test requirements, such as, but not limited to, which application operations need to be tested. Then, according to the test item, the activity graph is analyzed to see if it is necessary to increase the check node for the demand item (which will be converted into a checkpoint). If the original activity map has been able to meet the requirements, you can directly convert the demand activity map into a test activity map; if it is missing, you need to add checkpoints to the demand activity graph, mainly to increase the inspection function, the most typical is to increase the query. And can be verified according to the query results.
依据该测试场景生成对应的测试数据,并将该测试数据添加至与其对应的该测试场 景中形成测试用例,并输出所有该测试用例。Generating corresponding test data according to the test scenario, and adding the test data to the test field corresponding thereto Test cases are formed in the scene and all of the test cases are output.
具体地,测试场景建立完成后还需要进行测试用例设计。从模型驱动的角度,测试用例就是给测试场景增加了测试数据来形成的,并且测试场景之间有着一定的结合关系,即:测试场景+测试数据一测试用例。因此,本方法步骤的重点就是设计测试用例,或者添加测试数据给测试用例,形成测试用例,显然该测试用例可以包括很多个测试场景。Specifically, test case design is required after the test scenario is established. From the perspective of model driving, the test cases are formed by adding test data to the test scenario, and there is a certain relationship between the test scenarios, namely: test scenario + test data - test case. Therefore, the focus of this method step is to design a test case, or add test data to the test case to form a test case. Obviously, the test case can include many test scenarios.
配置模块12,与该用例模块通讯连接,用于根据该测试用例的信息配置基于该测试用例的测试执行文件;The configuration module 12 is communicatively coupled to the use case module, and configured to configure a test execution file based on the test case according to the information of the test case;
获取该测试用例的信息得到该测试用例之间的关联,根据该关联配置该测试用例的执行方式;Obtaining information about the test case to obtain an association between the test cases, and configuring an execution manner of the test case according to the association;
具体地,当需要确定针对智能设备的应用程序的功能测试的运行时内存占用率时,可以将被测试的代码进行编译,以生成用于代码覆盖率分析的可执行文件,即设置编译参数,并根据编译参数生成可执行文件,也即在组件编译中添加用于测试用例参数。例如,打包带有测试用例信息的测试执行文件,即获取用于标识测试用例参数,生成包括测试用例的信息,将测试用例的信息打包为测试执行文件。其中,测试执行文件在执行过程中对代码进行标识用于运行时内存占用率分析,即测试执行文件,测试执行文件中包括测试用例的信息,是在打包时添加进去的。最后,对应的方法进行封装,生成AndroidUiTool.jar。在写入接口文件:Uitool植入手机,调用uiautomator的封装方法。Specifically, when it is required to determine the runtime memory usage of the functional test of the application for the smart device, the code under test may be compiled to generate an executable file for code coverage analysis, ie, setting the compilation parameters, The executable file is generated according to the compilation parameters, that is, the test case parameters are added in the component compilation. For example, the test execution file with the test case information is packaged, that is, the information for identifying the test case is obtained, the information including the test case is generated, and the information of the test case is packaged into the test execution file. The test execution file identifies the code during execution to be used for runtime memory usage analysis, that is, the test execution file, and the test execution file includes test case information, which is added during packaging. Finally, the corresponding method is encapsulated to generate AndroidUiTool.jar. In the write interface file: Uitool is implanted in the phone, calling the encapsulation method of uiautomator.
将该执行方式记录于该测试执行文件中。The execution mode is recorded in the test execution file.
由于进行测试时,需要在特定的环境下进行,因此,需要部署测试环境。因此,将被测试的测试用例进行编译,以生成用于运行时内存占用率的测试执行文件之后,将测试执行文件部署在测试环境中,即将jar文件部署在测试环境中,以便部署测试环境,该测试环境包括但不限于智能设备的运行环境。Because testing needs to be performed in a specific environment, you need to deploy a test environment. Therefore, after the test case being tested is compiled to generate a test execution file for runtime memory usage, the test execution file is deployed in the test environment, that is, the jar file is deployed in the test environment to deploy the test environment. The test environment includes, but is not limited to, the operating environment of the smart device.
将可执行文件部署在测试环境中,即部署好测试环境之后,在测试环境中执行用于功能测试的测试用例,即将测试执行文件和用于功能测试的测试用例提交给测试用例执行管理工具,本实施例中,使用自定义的sh文件等,以便对测试执行文件中配置的测试用例进行测试。The executable file is deployed in the test environment, that is, after the test environment is deployed, the test case for the functional test is executed in the test environment, and the test execution file and the test case for the functional test are submitted to the test case execution management tool. In this embodiment, a custom sh file or the like is used to test the test cases configured in the test execution file.
执行模块13,与该配置模块通讯连接,用于根据该测试执行文件执行该测试用例获取该测试用例的内存输出结果;The execution module 13 is in communication with the configuration module, and is configured to execute the test case according to the test execution file to obtain a memory output result of the test case;
设置一预设的时间间隔阈值;Setting a preset time interval threshold;
在智能设备上运行测试执行文件以创建测试用例并对这些测试用例进行自动测试 时,其会按照顺序依次地取出测试用例。然后,智能设备执行取出的测试用时,每个测试用例之间会设置一测试用例的执行时间间隔,从而根据该执行时间的间隔执行测试用例,本实施例使用的测试框架中会预先设定等待周期,即执行测试用例后响应的最大容忍时间,并在上述预先设定等待周期内不断地检测智能设备是否返回对测试消息的响应;如在预先设定的等待周期内智能设备返回响应,则测试框架停止等待,智能设备接收返回的响应并根据返回的响应进行后续的测试;如在预先设定的等待周期内智能设备未返回响应,则测试框架不再进行等待,直接返回超时信息至智能设备,以通知智能设备跳过对取出的测试用例进行测试,并进行下一个测试用例的测试。Run test execution files on smart devices to create test cases and automate testing of these test cases When it is, the test cases are sequentially taken out in order. Then, when the smart device executes the taken test, an execution time interval of the test case is set between each test case, so that the test case is executed according to the interval of the execution time, and the test frame used in this embodiment is preset to wait. The period, that is, the maximum tolerance time of the response after the test case is executed, and continuously detects whether the smart device returns a response to the test message within the preset waiting period; if the smart device returns a response within a preset waiting period, The test framework stops waiting, and the smart device receives the returned response and performs subsequent tests according to the returned response; if the smart device does not return a response within a predetermined waiting period, the test framework no longer waits, directly returns the timeout information to the smart The device notifies the smart device to skip testing the taken test case and perform the test of the next test case.
当根据该测试执行文件执行该测试用例时,根据预设的时间间隔阈值记录该智能设备的内存信息并整合成该内存输出结果;When the test case is executed according to the test execution file, the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result;
根据上述测试框架的运行原理可以接收推送的测试执行文件。测试框架的第一线程执行测试用例,可以通过调用该测试执行文件包含的测试用例的关系,来使该第一线程执行测试用例,同时,创建第二线程,在该第二线程中开启内存监控,当测试执行文件运行结束即测试用例执行结束、第一线程终止,此时发送终止信号至第二线程,该终止信号指示着测试用例的结束,第二线程终止。当有后续的测试用例需要执行时,将重复上述的执行步骤,当有多个测试用例需要同时执行时,本实施例并不限于只启动一对线程,例如第一线程执行测试用例,第二线程监控内存,并实时记录与内存输出结果内。The pushed test execution file can be received according to the operating principle of the above test framework. The first thread of the test framework executes the test case, and the first thread can execute the test case by calling the relationship of the test case included in the test execution file, and at the same time, the second thread is created, and the memory monitoring is started in the second thread. When the test execution file finishes running, the test case execution ends and the first thread terminates. At this time, the termination signal is sent to the second thread, the termination signal indicates the end of the test case, and the second thread terminates. When there are subsequent test cases that need to be executed, the above execution steps will be repeated. When multiple test cases need to be executed simultaneously, the embodiment is not limited to only starting a pair of threads, for example, the first thread executes the test case, and the second The thread monitors the memory and records it in real time with the memory output.
具体地,第二线程在运行中,检测第一线程中测试用例是否仍在执行,检测是否接收到来自第一线程的终止信号,若是,则确定第一线程中测试用例执行结束,否则确定第一线程中测试用例仍在执行。若确定第一线程中测试用例执行结束,则可以停止内存监控,并终止第二线程。若确定第一线程中测试用例仍在执行,则采集被测应用的内存占用数据。可以选择被测应用程序,并从上述智能设备获取的内存监控数据中采集该被测应用的内存占用数据。Specifically, the second thread is in operation, detecting whether the test case in the first thread is still executing, detecting whether a termination signal from the first thread is received, and if yes, determining that the execution of the test case in the first thread ends, otherwise determining Test cases in one thread are still executing. If it is determined that the execution of the test case in the first thread is finished, the memory monitoring can be stopped and the second thread is terminated. If it is determined that the test case in the first thread is still executing, the memory usage data of the tested application is collected. The application to be tested can be selected, and the memory occupation data of the tested application is collected from the memory monitoring data acquired by the smart device.
比较模块14,与该执行模块通讯连接,用于将该内存输出结果与内存预期结果比较,得到该测试用例的测试结果;The comparison module 14 is in communication with the execution module, and is configured to compare the memory output result with the expected result of the memory to obtain a test result of the test case;
基于该测试用例预存一该测试用例与该内存预期结果之间的对应关系;Pre-storing a correspondence between the test case and the expected result of the memory based on the test case;
预先设置有测试用例的预估的内存预期结果,该内存预期结果为测试用例所关联的应用程序在运行时的内存占用情况,主要用于检测该应用程序在运行时是否发生内存泄漏。The estimated memory expected result of the test case is pre-set. The expected result of the memory is the memory usage of the application associated with the test case at runtime, and is mainly used to detect whether the application has a memory leak at runtime.
比较该内存输出结果的信息与该内存预期结果的信息,分析该测试用例的该测试结 果的信息;Comparing the information of the memory output result with the expected result of the memory, analyzing the test result of the test case Information
获取该内存输出结果,即,内存占用数据后,可以根据该内存占用数据判断被测应用是否发生内存泄漏。具体地,可以判断该内存占用数据是否大于内存预期结果,即,最大内存警报值,若是,则确定被测应用发生内存泄漏;或者根据内存占用数据计算内存占用增长速度,相邻两个执行的时间间隔内的内存变化程度,通常是不正常的增长,判断内存占用增长速度是否大于内存增长速度警报值,若是,则确定被测应用发生内存泄漏。若以上二者均为否,则确定被测应用没有发生内存泄漏。其中将当次采集的内存占用数据减去前一次采集的内存占用数据后,除以采样时间间隔可以得到内存占用增长速度。例如,针对音乐程序,最大内存警报值可以为50MB,内存增长速度警报值可以为10KB/s。Obtaining the memory output result, that is, after the memory occupies the data, it can determine whether the tested application has a memory leak according to the memory occupation data. Specifically, it can be determined whether the memory occupation data is greater than the expected result of the memory, that is, the maximum memory alarm value, and if yes, determining that the tested application has a memory leak; or calculating the memory occupancy growth rate according to the memory occupation data, and performing the adjacent two executions. The degree of memory change in the time interval is usually abnormal growth. It is judged whether the memory occupancy growth rate is greater than the memory growth speed alarm value. If yes, it is determined that the tested application has a memory leak. If both of the above are negative, it is determined that no memory leak has occurred in the application under test. After subtracting the memory usage data collected in the previous time, the memory occupancy growth rate can be obtained by dividing the sampling time interval. For example, for a music program, the maximum memory alert value can be 50MB, and the memory growth speed alert value can be 10KB/s.
按照上述时间间隔阈值,若判断被测应用程序没有发生内存泄漏,则将该测试用例的执行结果标记为正常完成。According to the above time interval threshold, if it is determined that the tested application does not have a memory leak, the execution result of the test case is marked as normal completion.
当判断被测应用发生内存泄漏时,发出警报信号,并同时提取该被测应用的内存信息文件,以便根据该内存信息文件定位被测应用的内存泄漏位置。具体地,可以通过被测应用的PID。使用获得命令:dumpsys meminfo+包名,分别获取内存的详细信息与整体的内存值,由该值获得内存表格方便直观查看内存的变化趋势。对于运行中产生产生的功能性问题,可以获取对应截图,与相应的mtklog,为解决问题提供一定的依据。When it is determined that the tested application has a memory leak, an alarm signal is sent, and the memory information file of the tested application is simultaneously extracted, so as to locate the memory leak location of the tested application according to the memory information file. Specifically, the PID of the application under test can be passed. Use the get command: dumpsys meminfo+ package name to get the detailed information of the memory and the overall memory value. Obtain the memory table from this value to view the trend of the memory. For the functional problems generated during the operation, the corresponding screenshots can be obtained, and the corresponding mtklog provides a certain basis for solving the problem.
这样,通过内存占用数据和内存增长速度可以更准确的判断是否发生内存泄漏,并且在发现有内存泄漏时可以第一时间通知测试人员关注,同时不用连接PC即可获取保存有完整内存信息的文件,通过该文件测试人员可以更准确地定位具体发生内存泄露的位置,避兔了因内存被释放后造成的内存信息不全、难以定位的情况。In this way, memory occupancy data and memory growth rate can more accurately determine whether a memory leak occurs, and when a memory leak is found, the tester can be notified at the first time, and the file storing the complete memory information can be obtained without connecting to the PC. Through this file tester can more accurately locate the location where the memory leak occurs, and avoid the situation that the memory information is incomplete and difficult to locate due to the memory being released.
此外,本发明实施例还提供一种计算机可读存储介质,其内存储有计算机可执行指令,上述的计算机可读存储介质例如为非易失性存储器例如光盘、硬盘、或者闪存。上述的计算机可执行指令用于让计算机或者类似的运算装置完成上述的用于智能设备的应用程序内存的测试方法中的各种操作。In addition, an embodiment of the present invention further provides a computer readable storage medium having stored therein computer executable instructions, such as a non-volatile memory such as an optical disk, a hard disk, or a flash memory. The above computer executable instructions are for causing a computer or similar computing device to perform various operations in the above described test method for the application memory of the smart device.
本技术领域技术人员可以理解,本发明包括涉及用于执行本申请中所述操作中的一项或多项的设备。这些设备可以为所需的目的而专门设计和制造,或者也可以包括通用计算机中的己知设备。这些设备具有存储在其内的计算机程序,这些计算机程序选择性地激活或重构。这样的计算机程序可以被存储在设备(例如,计算机)可读介质中或者存储在适于存储电子指令并分别藕联到总线的任何类型的介质中,所述计算机可读介质包括 但不限于任何类型的盘(包括软盘、硬盘、光盘、CD-ROM、和磁光盘),ROM(Read-Only Memory,只读存储器),RAM(Random Access Memory,随即存储器),EPROM(Erasable Programmable Read-Only Memory,可擦写可编程只读存储器),EEPROM(Electrically Erasable Programmable Read-Only Memory,电可擦可编程只读存储器)、闪存、磁性卡片或光线卡片。也就是,可读介质包括由设备(例如,计算机)以能够读的形式存储或传输信息的任何介质。Those skilled in the art will appreciate that the present invention includes apparatus related to performing one or more of the operations described herein. These devices may be specially designed and manufactured for the required purposes, or may also include known devices in a general purpose computer. These devices have computer programs stored therein that are selectively activated or reconfigured. Such computer program can be stored in a device (eg, computer) readable medium or in any type of medium suitable for storing electronic instructions and separately coupled to a bus, the computer readable medium comprising But not limited to any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable) Read-Only Memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or light card. That is, a readable medium includes any medium that is stored or transmitted by a device (eg, a computer) in a readable form.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of the present specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means a specific feature described in connection with the embodiment or example. A structure, material or feature is included in at least one embodiment or example of the invention. In the present specification, the schematic representation of the above terms does not necessarily mean the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples.
应当注意的是,本发明的实施例有较佳的实施性,且并非对本发明作任何形式的限制,任何熟悉该领域的技术人员可能利用上述揭示的技术内容变更或修饰为等同的有效实施例,但凡未脱离本发明技术方案的内容,依据本发明的技术实质对以上实施例所作的任何修改或等同变化及修饰,均仍属于本发明技术方案的范围内。 It should be noted that the embodiments of the present invention are preferred embodiments, and are not intended to limit the scope of the present invention. Any one skilled in the art may use the above-disclosed technical contents to change or modify the equivalent embodiments. Any modification or equivalent changes and modifications of the above embodiments in accordance with the technical spirit of the present invention are still within the scope of the technical solutions of the present invention.

Claims (10)

  1. 一种用于智能设备的应用程序内存的测试方法,其特征在于,所述测试方法包括:A test method for application memory of a smart device, characterized in that the test method comprises:
    对所述智能设备的应用程序编写与所述应用程序对应的测试场景,根据所述测试场景设置基于所述应用程序的至少一个测试用例;Writing a test scenario corresponding to the application to an application of the smart device, and setting at least one test case based on the application according to the test scenario;
    根据所述测试用例的信息配置基于所述测试用例的测试执行文件;Configuring a test execution file based on the test case according to the information of the test case;
    根据所述测试执行文件执行所述测试用例获取所述测试用例的内存输出结果;Performing the test case according to the test execution file to obtain a memory output result of the test case;
    将所述内存输出结果与内存预期结果比较,得到所述测试用例的测试结果。Comparing the memory output result with the expected result of the memory to obtain a test result of the test case.
  2. 如权利要求1所述的测试方法,其特征在于,对所述智能设备的应用程序编写与所述应用程序对应的测试场景,根据所述测试场景设置基于所述应用程序的至少一个测试用例,包括:The test method according to claim 1, wherein a test scenario corresponding to the application is written to an application of the smart device, and at least one test case based on the application is set according to the test scenario, include:
    将所述应用程序的每一个操作流程编写成对所述应用程序的测试场景;Writing each operation flow of the application into a test scenario for the application;
    根据所述应用程序的所述测试场景的信息获取所述测试场景的关系,基于所述关系排序整合所述测试场景生成所述测试用例。Acquiring the relationship of the test scenario according to the information about the test scenario of the application, and integrating the test scenario based on the relationship ranking to generate the test case.
  3. 如权利要求1所述的测试方法,其特征在于,根据所述测试用例的信息配置基于所述测试用例的测试执行文件,包括:The test method according to claim 1, wherein the test execution file based on the test case is configured according to the information of the test case, comprising:
    获取所述测试用例的信息得到所述测试用例之间的关联,根据所述关联配置所述测试用例的执行方式;Obtaining information about the test case to obtain an association between the test cases, and configuring an execution manner of the test case according to the association;
    将所述执行方式记录于所述测试执行文件中。The execution mode is recorded in the test execution file.
  4. 如权利要求1所述的测试方法,其特征在于,根据所述测试执行文件执行所述测试用例获取所述测试用例的内存输出结果,包括:The test method of claim 1, wherein executing the test case according to the test execution file to obtain a memory output result of the test case comprises:
    设置一预设的时间间隔阈值;Setting a preset time interval threshold;
    当根据所述测试执行文件执行所述测试用例时,根据预设的时间间隔阈值记录所述智能设备的内存信息并整合成所述内存输出结果。When the test case is executed according to the test execution file, the memory information of the smart device is recorded according to a preset time interval threshold and integrated into the memory output result.
  5. 如权利要求1所述的测试方法,其特征在于,将所述内存输出结果与内存预期结果比较,得到所述测试用例的测试结果,包括:The test method according to claim 1, wherein the memory output result is compared with an expected result of the memory, and the test result of the test case is obtained, including:
    基于所述测试用例预存一所述测试用例与所述内存预期结果之间的对应关系;Pre-preserving a correspondence between the test case and the expected result of the memory based on the test case;
    比较所述内存输出结果的信息与所述内存预期结果的信息,分析所述测试用例的所述测试结果的信息。 Comparing the information of the memory output result with the information of the expected result of the memory, and analyzing information of the test result of the test case.
  6. 一种用于智能设备的应用程序内存的测试装置,其特征在于,所述测试装置包括:用例模块,配置模块,执行模块,比较模块,其中,A test device for an application memory of a smart device, wherein the test device includes: a use case module, a configuration module, an execution module, and a comparison module, wherein
    所述用例模块,用于对所述智能设备的应用程序编写与所述应用程序对应的测试场景,根据所述测试场景设置基于所述应用程序的至少一个测试用例;The use case module is configured to write a test scenario corresponding to the application to an application of the smart device, and set at least one test case based on the application according to the test scenario;
    所述配置模块,与所述用例模块通讯连接,用于根据所述测试用例的信息配置基于所述测试用例的测试执行文件;The configuration module is communicatively coupled to the use case module, and configured to configure a test execution file based on the test case according to the information of the test case;
    所述执行模块,与所述配置模块通讯连接,用于根据所述测试执行文件执行所述测试用例获取所述测试用例的内存输出结果;The execution module is communicatively coupled to the configuration module, and configured to execute the test case according to the test execution file to obtain a memory output result of the test case;
    所述比较模块,与所述执行模块通讯连接,用于将所述内存输出结果与内存预期结果比较,得到所述测试用例的测试结果。The comparison module is in communication with the execution module, and is configured to compare the memory output result with a memory expected result to obtain a test result of the test case.
  7. 如权利要求6所述的装置,其特征在于,所述用例模块,包括:The device of claim 6, wherein the use case module comprises:
    场景单元,用于将所述应用程序的每一个操作流程编写成对所述应用程序的测试场景;a scene unit, configured to write each operation flow of the application into a test scenario for the application;
    用例单元,与所述场景单元通讯连接,用于根据所述应用程序的所述测试场景的信息获取所述测试场景的关系,基于所述关系排序整合所述测试场景生成所述测试用例。The use case unit is configured to be in communication with the scenario unit, configured to acquire the relationship of the test scenario according to the information about the test scenario of the application, and integrate the test scenario based on the relationship to generate the test case.
  8. 如权利要求6所述的装置,其特征在于,所述配置模块,包括:The device of claim 6, wherein the configuration module comprises:
    关联单元,用于获取所述测试用例的信息得到所述测试用例之间的关联,根据所述关联配置所述测试用例的执行方式;An association unit, configured to obtain information about the test case to obtain an association between the test cases, and configure an execution manner of the test case according to the association;
    配置单元,与所述关联单元通讯连接,用于将所述执行方式记录于所述测试执行文件中。And a configuration unit, configured to communicate with the associated unit, to record the execution mode in the test execution file.
  9. 如权利要求6所述的装置,其特征在于,所述执行模块,包括:The device of claim 6, wherein the execution module comprises:
    时间单元,用于设置一预设的时间间隔阈值;a time unit, configured to set a preset time interval threshold;
    执行单元,与所述时间单元通讯连接,用于当根据所述测试执行文件执行所述测试用例时,根据预设的时间间隔阈值记录所述智能设备的内存信息并整合成所述内存输出结果。An execution unit, configured to be in communication with the time unit, configured to record memory information of the smart device according to a preset time interval threshold and integrate the memory output result when the test case is executed according to the test execution file .
  10. 如权利要求6所述的装置,其特征在于,所述比较模块,包括:The device of claim 6, wherein the comparing module comprises:
    存储单元,用于基于所述测试用例预存一所述测试用例与所述内存预期结果之间的对应关系;a storage unit, configured to pre-store a correspondence between the test case and the expected result of the memory based on the test case;
    比较单元,与所述存储单元通讯连接,用于比较所述内存输出结果的信息与所述内存预期结果的信息,分析所述测试用例的所述测试结果的信息。 And a comparison unit, configured to communicate with the storage unit, to compare the information of the memory output result with the expected result of the memory, and analyze the information of the test result of the test case.
PCT/CN2017/101744 2017-09-14 2017-09-14 Test method and test apparatus for application memory of smart device WO2019051714A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/101744 WO2019051714A1 (en) 2017-09-14 2017-09-14 Test method and test apparatus for application memory of smart device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/101744 WO2019051714A1 (en) 2017-09-14 2017-09-14 Test method and test apparatus for application memory of smart device

Publications (1)

Publication Number Publication Date
WO2019051714A1 true WO2019051714A1 (en) 2019-03-21

Family

ID=65722411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/101744 WO2019051714A1 (en) 2017-09-14 2017-09-14 Test method and test apparatus for application memory of smart device

Country Status (1)

Country Link
WO (1) WO2019051714A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110837467A (en) * 2019-10-30 2020-02-25 深圳开立生物医疗科技股份有限公司 Software testing method, device and system
CN112327768A (en) * 2020-10-27 2021-02-05 深圳Tcl新技术有限公司 Intelligent scene building system, method and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101984416A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for generating test case
US8127275B1 (en) * 2007-04-18 2012-02-28 Parasoft Corporation System and method for recording the state of variables and objects when running unit tests
CN102541723A (en) * 2010-12-08 2012-07-04 上海杉达学院 Automated testing device for software testing
CN105786693A (en) * 2014-12-26 2016-07-20 展讯通信(天津)有限公司 Self-testing execution system and method as well as mobile terminal
CN105975394A (en) * 2016-05-06 2016-09-28 华为技术有限公司 Program testing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8127275B1 (en) * 2007-04-18 2012-02-28 Parasoft Corporation System and method for recording the state of variables and objects when running unit tests
CN101984416A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for generating test case
CN102541723A (en) * 2010-12-08 2012-07-04 上海杉达学院 Automated testing device for software testing
CN105786693A (en) * 2014-12-26 2016-07-20 展讯通信(天津)有限公司 Self-testing execution system and method as well as mobile terminal
CN105975394A (en) * 2016-05-06 2016-09-28 华为技术有限公司 Program testing method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110837467A (en) * 2019-10-30 2020-02-25 深圳开立生物医疗科技股份有限公司 Software testing method, device and system
CN110837467B (en) * 2019-10-30 2024-04-16 深圳开立生物医疗科技股份有限公司 Software testing method, device and system
CN112327768A (en) * 2020-10-27 2021-02-05 深圳Tcl新技术有限公司 Intelligent scene building system, method and computer readable storage medium
CN112327768B (en) * 2020-10-27 2023-09-19 深圳Tcl新技术有限公司 Intelligent scene building system, method and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN109302522B (en) Test method, test device, computer system, and computer medium
US9268670B1 (en) System for module selection in software application testing including generating a test executable based on an availability of root access
CA2915116C (en) Automated generation of scripted and manual test cases
US20160062876A1 (en) Automated software change monitoring and regression analysis
CN110768872B (en) Inspection method, system, device, computer equipment and storage medium
US9846636B1 (en) Client-side event logging for heterogeneous client environments
US10146658B2 (en) User device power consumption monitoring and analysis
CN109783388A (en) UI automated testing method, device and electronic equipment
CN104424089A (en) Terminal testing method and device
CN106126424B (en) A kind of visual automated testing method of script, device and mobile terminal
CN101930400A (en) SDK (Software Development Kit) automatic test system and method
CN103544100A (en) Method, system and client side for testing APP of portable data processing equipment
US9317398B1 (en) Vendor and version independent browser driver
CN107045475B (en) Test method and device
WO2020096665A2 (en) System error detection
CN110013672A (en) Method, unit and the computer readable storage medium of the automatic test of game for machine operation
CN113407393B (en) Chip verification method, terminal device, verification platform and storage medium
Akour et al. Mobile software testing: Thoughts, strategies, challenges, and experimental study
CN111190605A (en) Embedded platform deployment method, equipment and storage medium
US9430361B1 (en) Transition testing model for heterogeneous client environments
WO2019051714A1 (en) Test method and test apparatus for application memory of smart device
CN114661594A (en) Method, apparatus, medium, and program product for automated testing
KR20190084827A (en) Method for automatic test of program compatibility and apparatus using the same
CN113419932B (en) Equipment performance analysis method and device
US10169216B2 (en) Simulating sensors

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17925408

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17925408

Country of ref document: EP

Kind code of ref document: A1