CN112115060A - Audio test method and system based on terminal - Google Patents
Audio test method and system based on terminal Download PDFInfo
- Publication number
- CN112115060A CN112115060A CN202011038225.8A CN202011038225A CN112115060A CN 112115060 A CN112115060 A CN 112115060A CN 202011038225 A CN202011038225 A CN 202011038225A CN 112115060 A CN112115060 A CN 112115060A
- Authority
- CN
- China
- Prior art keywords
- terminal
- data
- audio
- tested
- test
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
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
本发明公开了一种基于终端的音频测试方法,包括:接收用户的音频播放请求,所述音频播放请求包括音频数据与测试包;根据所述音频播放请求启动终端的音频播放服务,以播放所述音频数据;获取所述终端的系统版本信息,根据所述系统版本信息确定捕获方式与传输方式;通过所述捕获方式获取所述终端播放的音频数据,作为待测试数据;通过所述传输方式接收所述待测试数据,根据所述测试包对所述待测试数据进行解析与测试,生成测试报告。本发明还公开了一种基于终端的音频测试系统。本发明通过系统版本信息确定不同的捕获方式,提高了远程真机的设备兼容性,且成本较低,减少了不同设备之间的音频数据的传输时间,提高了效率。
The invention discloses a terminal-based audio testing method, comprising: receiving an audio playing request from a user, wherein the audio playing request includes audio data and a test package; and starting an audio playing service of a terminal according to the audio playing request to play all obtain the system version information of the terminal, and determine the capture mode and transmission mode according to the system version information; obtain the audio data played by the terminal through the capture mode, as the data to be tested; through the transmission mode Receive the data to be tested, parse and test the data to be tested according to the test package, and generate a test report. The invention also discloses a terminal-based audio testing system. The present invention determines different capture modes through the system version information, improves the device compatibility of the remote real machine, has low cost, reduces the transmission time of audio data between different devices, and improves the efficiency.
Description
技术领域technical field
本发明实施例涉及音频测试技术领域,尤其涉及一种基于终端的音频测试方法与系统。Embodiments of the present invention relate to the technical field of audio testing, and in particular, to a terminal-based audio testing method and system.
背景技术Background technique
对移动开发者来说,无论是开发,调试,测试,还是上线前后检验效果,都离不开移动设备,除了开发者之外,产品及运营、客服同学,也时不时遇到需要使用真机进行产品体验、产品运营的时候。For mobile developers, whether it is development, debugging, testing, or testing the effect before and after going online, it is inseparable from mobile devices. In addition to developers, products, operations, and customer service students also need to use real machines from time to time. When it comes to product experience and product operation.
而对于用户群体庞大的移动端APP来说这些需求更为明显。最开始的时候通过统一采购统一机房放置来满足各个部门的要求。但是随着业务做大,部门增多,职场范围扩展,这种实体机的使用问题开始暴露,基本存在以下几个点:统一机房大小有限,不能够同时容纳几十个人在里面工作,降低了工作效率;跨职场设备不能共享,导致机型重复购买,浪费公司财务资源。特殊机型数量稀少,如果抢手的话很难及时拿到使用。For mobile apps with a huge user base, these needs are even more obvious. At the beginning, the requirements of various departments were met through unified procurement and placement of the equipment room. However, with the expansion of the business, the increase of departments, and the expansion of the scope of the workplace, the use of such physical machines has begun to be exposed. There are basically the following points: the size of the unified computer room is limited, and it cannot accommodate dozens of people to work in it at the same time, which reduces the workload. Efficiency; equipment across workplaces cannot be shared, resulting in repeated purchases of models and a waste of company financial resources. The number of special models is scarce, and it is difficult to obtain and use them in time if they are in demand.
因此开始在市场上寻找合适的远程真机厂商,在调研中发现鸟测、testin、UI等公司提供了远程真机服务,可以满足大部分业务需求,但是若APP需要进行语音播报,而他们的产品都不支持远程设备语音播报,因此部分业务只能自己在本地测试,而一些期望测试的机型如果在本地不能拿到,则不能测试,这可能间接导致服务兼容性测试覆盖不全,从而导致一些不可控的问题。Therefore, I began to look for suitable remote real machine manufacturers in the market. During the survey, it was found that companies such as Birdtest, testin, and UI provided remote real machine services, which could meet most business needs. However, if the APP needs to perform voice broadcast, and their None of the products support remote device voice broadcast, so some services can only be tested locally, and some models that are expected to be tested cannot be tested if they are not available locally, which may indirectly lead to incomplete service compatibility test coverage, resulting in some uncontrollable issues.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本发明实施例的目的是提供一种基于终端的音频测试方法与系统,通过系统版本信息确定不同的捕获方式,提高了远程真机的设备兼容性,且成本较低,减少了不同设备之间的音频数据的传输时间,提高了效率。In view of this, the purpose of the embodiments of the present invention is to provide a terminal-based audio testing method and system, which can determine different capture methods through system version information, improve the device compatibility of the remote real machine, and reduce the cost and reduce the cost. The transmission time of audio data between different devices improves the efficiency.
为实现上述目的,本发明实施例提供了一种基于终端的音频测试方法,包括:To achieve the above purpose, an embodiment of the present invention provides a terminal-based audio testing method, including:
接收用户的音频播放请求,所述音频播放请求包括音频数据与测试包;Receive the user's audio playback request, and the audio playback request includes audio data and a test package;
根据所述音频播放请求启动终端的音频播放服务,以播放所述音频数据;Start the audio playback service of the terminal according to the audio playback request to play the audio data;
获取所述终端的系统版本信息,根据所述系统版本信息确定捕获方式与传输方式;Obtain system version information of the terminal, and determine a capture mode and a transmission mode according to the system version information;
通过所述捕获方式获取所述终端播放的音频数据,作为待测试数据;Acquire the audio data played by the terminal through the capture method as the data to be tested;
通过所述传输方式接收所述待测试数据,根据所述测试包对所述待测试数据进行解析与测试,生成测试报告。The data to be tested is received through the transmission mode, and the data to be tested is parsed and tested according to the test package, and a test report is generated.
进一步地,所述根据所述音频播放请求启动终端的音频播放服务,以播放所述音频数据之前,包括:Further, before starting the audio playback service of the terminal according to the audio playback request to play the audio data, it includes:
接收终端的连接请求,所述连接请求包括设备状态信息;receiving a connection request from the terminal, where the connection request includes device status information;
根据连接请求获取所述终端的存储数据,并将所述存储数据存储至数据库中。Acquire storage data of the terminal according to the connection request, and store the storage data in a database.
进一步地,所述获取所述终端的系统版本信息,根据所述系统版本信息确定捕获方式与传输方式包括:Further, the acquiring the system version information of the terminal and determining the capture mode and the transmission mode according to the system version information include:
当所述终端的所述系统版本信息小于等于预设值时,确定所述捕获方式为录屏捕获方式以及所述传输方式为通讯接口;When the system version information of the terminal is less than or equal to a preset value, determine that the capture mode is a screen capture mode and the transmission mode is a communication interface;
当所述终端的所述系统版本信息大于预设值时,确定所述捕获方式为通过调试桥启动录屏捕获方式以及所述传输方式为映射端口。When the system version information of the terminal is greater than a preset value, it is determined that the capture mode is a screen recording capture mode started through a debug bridge and the transmission mode is a mapped port.
进一步地,所述通过所述传输方式接收所述待测试数据之前,包括Further, before receiving the data to be tested by the transmission method, including
当所述捕获方式为调试桥捕获方式时,获取所述用户的用户权限;When the capture mode is the debug bridge capture mode, obtain the user authority of the user;
根据所述用户权限获取所述终端的服务端口进行映射,得到映射端口;Obtain the service port of the terminal according to the user authority and perform mapping to obtain the mapped port;
通过所述映射端口传输所述待测试数据。The data to be tested is transmitted through the mapped port.
进一步地,所述根据所述测试包对所述待测试数据进行解析与测试,生成测试报告包括:Further, analyzing and testing the data to be tested according to the test package, and generating a test report includes:
获取所述测试包中的断言数据;obtain assertion data in the test package;
根据所述断言数据,将所述测试包中预存的音频数据与所述待测试数据进行对比,基于对比结果生成测试报告。According to the assertion data, the audio data pre-stored in the test package is compared with the data to be tested, and a test report is generated based on the comparison result.
进一步地,所述方法还包括:Further, the method also includes:
将所述测试报告上传至区块链中。Upload the test report to the blockchain.
为实现上述目的,本发明实施例还提供了一种基于终端的音频测试系统,包括:To achieve the above purpose, the embodiment of the present invention also provides a terminal-based audio testing system, including:
接收模块,用于接收用户的音频播放请求,所述音频播放请求包括音频数据与测试包;a receiving module for receiving a user's audio playback request, where the audio playback request includes audio data and a test package;
启动模块,用于根据所述音频播放请求启动终端的音频播放服务,以播放所述音频数据;a startup module, configured to start the audio playback service of the terminal according to the audio playback request to play the audio data;
确定模块,用于获取所述终端的系统版本信息,根据所述系统版本信息确定捕获方式与传输方式;a determining module, configured to acquire system version information of the terminal, and determine a capture mode and a transmission mode according to the system version information;
获取模块,用于通过所述捕获方式获取所述终端播放的音频数据,作为待测试数据;an acquisition module, configured to acquire the audio data played by the terminal through the capture method, as the data to be tested;
生成模块,用于通过所述传输方式接收所述待测试数据,根据所述测试包对所述待测试数据进行解析与测试,生成测试报告。The generating module is configured to receive the data to be tested through the transmission mode, parse and test the data to be tested according to the test package, and generate a test report.
进一步地,所述生成模块还用于:Further, the generation module is also used for:
获取所述测试包中的断言数据;obtain assertion data in the test package;
根据所述断言数据,将所述测试包中预存的音频数据与所述待测试数据进行对比,基于对比结果生成测试报告。According to the assertion data, the audio data pre-stored in the test package is compared with the data to be tested, and a test report is generated based on the comparison result.
为实现上述目的,本发明实施例还提供了一种计算机设备,所述计算机设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如上所述的基于终端的音频测试方法的步骤。To achieve the above object, an embodiment of the present invention further provides a computer device, the computer device includes a memory and a processor, and the memory stores a computer program that can run on the processor, and the computer program is The processor implements the steps of the above-mentioned terminal-based audio testing method when executed.
为实现上述目的,本发明实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序可被至少一个处理器所执行,以使所述至少一个处理器执行上所述的基于终端的音频测试方法的步骤。To achieve the above object, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program can be executed by at least one processor, so that the At least one processor executes the steps of the terminal-based audio testing method described above.
本发明实施例提供的基于终端的音频测试方法与系统,通过对音频数据进行播放,判断终端的系统版本信息,从而得到音频数据的捕获方式,捕获音频数据作为待测试数据,进而通过测试包对待测试数据进行解析与测试,最终生成测试报告,通过系统版本信息确定不同的捕获方式,提高了远程真机的设备兼容性,且成本较低,减少了不同设备之间的音频数据的传输时间,提高了效率。In the terminal-based audio testing method and system provided by the embodiments of the present invention, the system version information of the terminal is determined by playing the audio data, so as to obtain a capturing mode of the audio data, and the audio data is captured as the data to be tested, and then is treated by a test packet. The test data is analyzed and tested, and a test report is finally generated. Different capture methods are determined through the system version information, which improves the device compatibility of the remote real machine, and the cost is low, which reduces the transmission time of audio data between different devices. Increased efficiency.
附图说明Description of drawings
图1为本发明基于终端的音频测试方法实施例一的流程图。FIG. 1 is a flowchart of Embodiment 1 of a terminal-based audio testing method according to the present invention.
图2为本发明实施例一中步骤S110的流程图。FIG. 2 is a flowchart of step S110 in Embodiment 1 of the present invention.
图3为本发明实施例一中步骤S140的流程图。FIG. 3 is a flowchart of step S140 in Embodiment 1 of the present invention.
图4为本发明实施例一中步骤S170的流程图。FIG. 4 is a flowchart of step S170 in Embodiment 1 of the present invention.
图5为本发明实施例一中步骤S180的流程图。FIG. 5 is a flowchart of step S180 in Embodiment 1 of the present invention.
图6为本发明基于终端的音频测试系统实施例二的程序模块示意图。FIG. 6 is a schematic diagram of program modules of Embodiment 2 of the terminal-based audio testing system of the present invention.
图7为本发明计算机设备实施例三的硬件结构示意图。FIG. 7 is a schematic diagram of a hardware structure of Embodiment 3 of a computer device according to the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
实施例一Example 1
参阅图1,示出了本发明实施例一之基于终端的音频测试方法的步骤流程图。可以理解,本方法实施例中的流程图不用于对执行步骤的顺序进行限定。下面以计算机设备2为执行主体进行示例性描述。具体如下。Referring to FIG. 1 , a flow chart of steps of a terminal-based audio testing method according to an embodiment of the present invention is shown. It can be understood that the flowchart in this embodiment of the method is not used to limit the sequence of executing steps. The following description will be exemplified by taking the computer device 2 as the execution subject. details as follows.
步骤S100、接收用户的音频播放请求,所述音频播放请求包括音频数据与测试包。Step S100: Receive an audio playback request from a user, where the audio playback request includes audio data and a test package.
具体地,预先获取音频数据,将音频数据存入至音频文件中,并将音频文件存储至数据库中。测试包为jar文件,用于对终端进行音频测试。用户在计算机设备上的远程真机的操作界面进行选定,选定所需测试的终端的音频服务,得到音频播放请求。远程真机为网页版本的调试工具,用于测试手机设备的性能服务。音频数据可以为计算机设备上预先存储的音频数据,也可以为通过计算机设备的网页界面进行获取的音频数据,或者用户的语音音频数据。Specifically, the audio data is acquired in advance, the audio data is stored in the audio file, and the audio file is stored in the database. The test package is a jar file for audio testing of the terminal. The user selects on the operation interface of the remote real machine on the computer equipment, selects the audio service of the terminal to be tested, and obtains the audio playback request. The remote real machine is a debugging tool for the web version, which is used to test the performance services of mobile devices. The audio data may be audio data pre-stored on a computer device, or may be audio data acquired through a web interface of the computer device, or audio data of a user's voice.
步骤S120、根据所述音频播放请求启动终端的音频播放服务,以播放所述音频数据。Step S120: Start an audio playback service of the terminal according to the audio playback request to play the audio data.
具体地,终端为安卓手机或者苹果手机,并在安静的环境进行音频数据的播放。当终端接收到用户的音频播放请求后,通过服务器将音频播放指令发送给与服务器连接的终端,通过终端上的音频软件启动音频播放服务。音频播放服务时,当声音播放时具体选择由何通路输出,根据一系列路由策略来切换播放通路,例如:当蓝牙耳机连接时,声音切到蓝牙通路输出;当USB喇叭连接时,声音切到USB通路输出,播放音频数据。Specifically, the terminal is an Android mobile phone or an Apple mobile phone, and the audio data is played in a quiet environment. After the terminal receives the user's audio playing request, the server sends the audio playing instruction to the terminal connected to the server, and starts the audio playing service through the audio software on the terminal. For audio playback service, when the sound is played, the channel is selected for output, and the playback channel is switched according to a series of routing strategies. For example, when the Bluetooth headset is connected, the sound is switched to the Bluetooth channel output; when the USB speaker is connected, the sound is switched to USB channel output, play audio data.
示例性地,参阅图2,所述步骤S120之前,包括步骤S110:Exemplarily, referring to FIG. 2 , before the step S120, the step S110 is included:
步骤S111,接收终端的连接请求,所述连接请求包括设备状态信息。Step S111: Receive a connection request from the terminal, where the connection request includes device status information.
具体地,当用户进行终端测试时,建立终端与服务器的连接,打开终端的设备查询模式,以建立终端与服务器的连接,终端通过socket连接服务器获取音频数据,也可以说是远程真机之间的连接,设备状态信息包括设备的待连接状态以及设备的基础信息,终端为安卓手机或者苹果手机。Specifically, when the user performs a terminal test, the connection between the terminal and the server is established, and the device query mode of the terminal is turned on to establish the connection between the terminal and the server. The device status information includes the status of the device to be connected and the basic information of the device, and the terminal is an Android phone or an Apple phone.
步骤S112,根据连接请求获取所述终端的存储数据,并将所述存储数据存储至数据库中。Step S112: Acquire storage data of the terminal according to the connection request, and store the storage data in a database.
具体地,通过消息分发平台将设备状态信息发送给消息处理平台,以获取用户数据和设备数据,并将设备状态信息、用户数据以及设备数据存储至数据库中,数据库预先在计算机设备上进行建立,存储数据包括用户数据以及设备数据。将设备数据映射到服务器上,使用adb forward命令将服务端口映射到服务器,使用时,可直接通过adb(AndroidDebug Bridge,安卓调试桥)调用终端的设备信息,并根据音频播放请求启动终端的音频播放服务。Specifically, the device state information is sent to the message processing platform through the message distribution platform to obtain user data and device data, and the device state information, user data and device data are stored in a database, which is established on the computer equipment in advance, Stored data includes user data as well as device data. Map the device data to the server, and use the adb forward command to map the service port to the server. When using it, you can directly call the device information of the terminal through adb (AndroidDebug Bridge, Android Debug Bridge), and start the audio playback of the terminal according to the audio playback request. Serve.
步骤S140、获取所述终端的系统版本信息,根据所述系统版本信息确定捕获方式与传输方式。Step S140: Acquire system version information of the terminal, and determine a capture mode and a transmission mode according to the system version information.
具体地,通过终端的系统版本信息判断其与远程真机的连接方式,若系统版本太低,则进行USB音频(AOA)或者USB连接线连接,连接AOA捕获程序的socket获取音频数据;若系统版本高,可以使用无线网络连接,例如Playback Capture API,用以捕获第一终端播放的音频数据,使用adb工具启动服务捕获音频数据。Specifically, the terminal's system version information is used to determine the connection mode between the terminal and the remote real machine. If the system version is too low, connect a USB audio (AOA) or USB cable, and connect to the socket of the AOA capture program to obtain audio data; if the system With a higher version, you can use a wireless network connection, such as the Playback Capture API, to capture the audio data played by the first terminal, and use the adb tool to start the service to capture the audio data.
示例性地,参阅图3,所述步骤S140具体包括:Exemplarily, referring to FIG. 3 , the step S140 specifically includes:
步骤S141,当所述终端的所述系统版本信息小于等于预设值时,确定所述捕获方式为录屏捕获方式以及所述传输方式为通讯接口。Step S141, when the system version information of the terminal is less than or equal to a preset value, determine that the capture mode is a screen capture mode and the transmission mode is a communication interface.
具体地,预设值为8,若系统版本信息小于等于预设值,即android版本在8以及8以下,在服务器启动AOA音频捕获程序,通过远程真机连接AOA捕获程序的socket获取音频数据。Specifically, the default value is 8. If the system version information is less than or equal to the default value, that is, the android version is 8 and below, start the AOA audio capture program on the server, and connect the remote real machine to the socket of the AOA capture program to obtain audio data.
步骤S142,当所述终端的所述系统版本信息大于预设值时,确定所述捕获方式为通过调试桥启动录屏捕获方式以及所述传输方式为映射端口。Step S142, when the system version information of the terminal is greater than a preset value, it is determined that the capture mode is a screen recording capture mode started through a debug bridge and the transmission mode is a mapped port.
具体地,若android版本在10及以上,使用adb启动服务捕获音频数据,使用adbforward命令将服务端口映射到服务器,连接映射端口的socket获取音频数据。Specifically, if the Android version is 10 and above, use adb to start the service to capture audio data, use the adbforward command to map the service port to the server, and connect the socket of the mapped port to obtain audio data.
步骤S160、通过所述捕获方式获取所述终端播放的音频数据,作为待测试数据。Step S160: Acquire the audio data played by the terminal through the capture method as the data to be tested.
具体地,通过socket连接私有云服务并启动音频传输,将音频数据存入到待测试文件中(在测试流程中一直在运行,是一个异步线程),等到有女票播放执行完成后并sleep一段时间;停止终端上的音频数据监听,得到待测试数据。Specifically, connect to the private cloud service through the socket and start the audio transmission, store the audio data in the file to be tested (it has been running in the test process, it is an asynchronous thread), wait until the female ticket is played and executed and sleep for a while Time; stop the audio data monitoring on the terminal to obtain the data to be tested.
远程真机捕获播放的音频数据,通过AudioRecord类来进行对音频数据的捕获PCM数据,据此实现了远程真机的音频播放,以提供远程真机的听觉功能。即,首先构造AudioRecord实例后再调用startRecording(),开始录取终端播放的音频数据,并通过read()方法不断获取录音数据记录下来,生成PCM文件。The remote real machine captures and plays the audio data, and uses the AudioRecord class to capture the PCM data of the audio data, so as to realize the audio playback of the remote real machine and provide the hearing function of the remote real machine. That is, first construct an AudioRecord instance and then call startRecording() to start recording the audio data played by the terminal, and continuously obtain and record the recorded data through the read() method to generate a PCM file.
示例性地,参阅图4,所述步骤S180之前,包括步骤S170:Exemplarily, referring to FIG. 4 , before step S180, step S170 is included:
步骤S171,当所述捕获方式为调试桥捕获方式时,获取所述用户的用户权限。Step S171, when the capture mode is the debug bridge capture mode, obtain the user authority of the user.
具体地,当捕获方式为Android调试桥捕获方式(adb)时,获取用户的用户权限,根据用户权限确定是否同意远程真机对终端的操作,即是否同意远程操作启动终端的播放权限和数据传输权限。Specifically, when the capture mode is the Android debug bridge capture mode (adb), the user's user authority is obtained, and according to the user authority, it is determined whether to agree to the operation of the terminal by the remote real machine, that is, whether to agree to the remote operation to start the terminal's playback authority and data transmission. permissions.
步骤S172,根据所述用户权限获取所述终端的服务端口进行映射,得到映射端口。Step S172: Obtain and map the service port of the terminal according to the user authority to obtain the mapped port.
具体地,用adb forward命令将服务端口映射到服务器,再连接映射端口的socket获取音频数据。Specifically, use the adb forward command to map the service port to the server, and then connect the socket of the mapped port to obtain audio data.
步骤S173,通过所述映射端口传输所述待测试数据。Step S173, transmitting the data to be tested through the mapping port.
具体地,将待测试数据通过映射端口从终端传输给服务器。Specifically, the data to be tested is transmitted from the terminal to the server through the mapped port.
步骤S180、通过所述传输方式接收所述待测试数据,根据所述测试包对所述待测试数据进行解析与测试,生成测试报告。Step S180: Receive the data to be tested through the transmission mode, parse and test the data to be tested according to the test package, and generate a test report.
具体地,测试包中预先存储有音频文件,音频文件为之前传输的音频数据。将语音播放的音频数据获取后通过人工智能识别其声音进而转化为文本数据,然后通过在测试包的脚本中设置校验断言对文本数据进行测试,生成测试报告,并将测试报告推送至远程真机的前端页面上进行显示,这样就可以完成语音自动化测试的功能。Specifically, an audio file is pre-stored in the test package, and the audio file is the previously transmitted audio data. After acquiring the audio data of the voice playback, the voice is recognized by artificial intelligence and then converted into text data, and then the text data is tested by setting a check assertion in the script of the test package, a test report is generated, and the test report is pushed to the remote real It can be displayed on the front-end page of the computer, so that the function of automatic voice test can be completed.
示例性地,参阅图5,所述步骤S180具体包括:Exemplarily, referring to FIG. 5 , the step S180 specifically includes:
步骤S181,获取所述测试包中的断言数据。Step S181, acquiring the assertion data in the test package.
具体地,预先在测试包中根据音频数据编写断言程序,即断言数据。Specifically, an assertion program, that is, assertion data, is written in advance in the test package according to the audio data.
步骤S182,根据所述断言数据,将所述测试包中预存的音频数据与所述待测试数据进行对比,基于对比结果生成测试报告。Step S182, according to the assertion data, compare the audio data pre-stored in the test package with the data to be tested, and generate a test report based on the comparison result.
具体地,调用人工智能API进行音频数据转文字的工作,使用获取到的音频文字和测试案例中的断言进行对比,若达到要求则认为通过,否则失败。Specifically, the artificial intelligence API is called to convert audio data into text, and the obtained audio text is compared with the assertion in the test case. If the requirements are met, it is considered to pass, otherwise it fails.
示例性地,所述方法还包括:Exemplarily, the method further includes:
将所述测试报告上传至区块链中。Upload the test report to the blockchain.
具体地,将测试报告上传至区块链可保证其安全性和对用户的公正透明性。用户设备可以从区块链中下载得该测试报告,以便查证测试报告是否被篡改。本示例所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。Specifically, uploading the test report to the blockchain ensures its security and fairness and transparency to users. The user device can download the test report from the blockchain to verify whether the test report has been tampered with. The blockchain referred to in this example is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
实施例二Embodiment 2
请继续参阅图6,示出了本发明基于终端的音频测试系统实施例二的程序模块示意图。在本实施例中,基于终端的音频测试系统20可以包括或被分割成一个或多个程序模块,一个或者多个程序模块被存储于存储介质中,并由一个或多个处理器所执行,以完成本发明,并可实现上述基于终端的音频测试方法。本发明实施例所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序本身更适合于描述基于终端的音频测试系统20在存储介质中的执行过程。以下描述将具体介绍本实施例各程序模块的功能:Please continue to refer to FIG. 6 , which shows a schematic diagram of program modules in Embodiment 2 of the terminal-based audio testing system of the present invention. In this embodiment, the terminal-based
接收模块200,用于接收用户的音频播放请求,所述音频播放请求包括音频数据与测试包。The receiving module 200 is configured to receive an audio playback request from a user, where the audio playback request includes audio data and a test package.
具体地,预先获取音频数据,将音频数据存入至音频文件中,并将音频文件存储至数据库中。测试包为jar文件,用于对终端进行音频测试。用户在计算机设备上的远程真机的操作界面进行选定,选定所需测试的终端的音频服务,得到音频播放请求。远程真机为网页版本的调试工具,用于测试手机设备的性能服务。音频数据可以为计算机设备上预先存储的音频数据,也可以为通过计算机设备的网页界面进行获取的音频数据,或者用户的语音音频数据。Specifically, the audio data is acquired in advance, the audio data is stored in the audio file, and the audio file is stored in the database. The test package is a jar file for audio testing of the terminal. The user selects on the operation interface of the remote real machine on the computer equipment, selects the audio service of the terminal to be tested, and obtains the audio playback request. The remote real machine is a debugging tool for the web version, which is used to test the performance services of mobile devices. The audio data may be audio data pre-stored on a computer device, or may be audio data acquired through a web interface of the computer device, or audio data of a user's voice.
启动模块202,用于根据所述音频播放请求启动终端的音频播放服务,以播放所述音频数据。The starting module 202 is configured to start an audio playing service of the terminal according to the audio playing request, so as to play the audio data.
具体地,终端为安卓手机或者苹果手机,并在安静的环境进行音频数据的播放。当终端接收到用户的音频播放请求后,通过服务器将音频播放指令发送给与服务器连接的终端,通过终端上的音频软件启动音频播放服务。音频播放服务时,当声音播放时具体选择由何通路输出,根据一系列路由策略来切换播放通路,例如:当蓝牙耳机连接时,声音切到蓝牙通路输出;当USB喇叭连接时,声音切到USB通路输出,播放音频数据。Specifically, the terminal is an Android mobile phone or an Apple mobile phone, and the audio data is played in a quiet environment. After the terminal receives the user's audio playing request, the server sends the audio playing instruction to the terminal connected to the server, and starts the audio playing service through the audio software on the terminal. For audio playback service, when the sound is played, the channel is selected for output, and the playback channel is switched according to a series of routing strategies. For example, when the Bluetooth headset is connected, the sound is switched to the Bluetooth channel output; when the USB speaker is connected, the sound is switched to USB channel output, play audio data.
确定模块204,用于获取所述终端的系统版本信息,根据所述系统版本信息确定捕获方式与传输方式。The determining module 204 is configured to acquire system version information of the terminal, and determine a capture mode and a transmission mode according to the system version information.
具体地,通过终端的系统版本信息判断其与远程真机的连接方式,若系统版本太低,则进行USB音频(AOA)或者USB连接线连接,连接AOA捕获程序的socket获取音频数据;若系统版本高,可以使用无线网络连接,例如Playback Capture API,用以捕获第一终端播放的音频数据,使用adb启动服务捕获音频数据。Specifically, the terminal's system version information is used to determine the connection mode between the terminal and the remote real machine. If the system version is too low, connect a USB audio (AOA) or USB cable, and connect to the socket of the AOA capture program to obtain audio data; if the system With a higher version, you can use a wireless network connection, such as the Playback Capture API, to capture the audio data played by the first terminal, and use adb to start the service to capture the audio data.
示例性地,所述确定模块204具体用于:Exemplarily, the determining module 204 is specifically configured to:
当所述终端的所述系统版本信息小于等于预设值时,确定所述捕获方式为录屏捕获方式以及所述传输方式为通讯接口。When the system version information of the terminal is less than or equal to a preset value, it is determined that the capture mode is a screen capture mode and the transmission mode is a communication interface.
具体地,预设值为8,若系统版本信息小于等于预设值,即android版本在8以及8以下,在服务器启动AOA音频捕获程序,通过远程真机连接AOA捕获程序的socket获取音频数据。Specifically, the default value is 8. If the system version information is less than or equal to the default value, that is, the android version is 8 and below, start the AOA audio capture program on the server, and connect the remote real machine to the socket of the AOA capture program to obtain audio data.
当所述终端的所述系统版本信息大于预设值时,确定所述捕获方式为通过调试桥启动录屏捕获方式以及所述传输方式为映射端口。When the system version information of the terminal is greater than a preset value, it is determined that the capture mode is a screen recording capture mode started through a debug bridge and the transmission mode is a mapped port.
具体地,若android版本在10及以上,使用adb启动服务捕获音频数据,使用adbforward命令将服务端口映射到服务器,连接映射端口的socket获取音频数据。Specifically, if the Android version is 10 and above, use adb to start the service to capture audio data, use the adbforward command to map the service port to the server, and connect the socket of the mapped port to obtain audio data.
获取模块206,用于通过所述捕获方式获取所述终端播放的音频数据,作为待测试数据。The acquiring module 206 is configured to acquire the audio data played by the terminal through the capturing method, as the data to be tested.
具体地,通过socket连接私有云服务并启动音频传输,将音频数据存入到待测试文件中(在测试流程中一直在运行,是一个异步线程),等到有女票播放执行完成后并sleep一段时间;停止终端上的音频数据监听,得到待测试数据。Specifically, connect to the private cloud service through the socket and start the audio transmission, store the audio data in the file to be tested (it has been running in the test process, it is an asynchronous thread), wait until the female ticket is played and executed and sleep for a while Time; stop the audio data monitoring on the terminal to obtain the data to be tested.
远程真机捕获播放的音频数据,通过AudioRecord类来进行对音频数据的捕获PCM数据,据此实现了远程真机的音频播放,以提供远程真机的听觉功能。即,首先构造AudioRecord实例后再调用startRecording(),开始录取终端播放的音频数据,并通过read()方法不断获取录音数据记录下来,生成PCM文件。The remote real machine captures and plays the audio data, and uses the AudioRecord class to capture the PCM data of the audio data, so as to realize the audio playback of the remote real machine and provide the hearing function of the remote real machine. That is, first construct an AudioRecord instance and then call startRecording() to start recording the audio data played by the terminal, and continuously obtain and record the recorded data through the read() method to generate a PCM file.
生成模块208,用于通过所述传输方式接收所述待测试数据,根据所述测试包对所述待测试数据进行解析与测试,生成测试报告。The generating module 208 is configured to receive the data to be tested through the transmission mode, parse and test the data to be tested according to the test package, and generate a test report.
具体地,测试包中预先存储有音频文件,音频文件为之前传输的音频数据。将语音播放的音频数据获取后通过人工智能识别其声音进而转化为文本数据,然后通过在测试包的脚本中设置校验断言对文本数据进行测试,生成测试报告,并将测试报告推送至远程真机的前端页面上进行显示,这样就可以完成语音自动化测试的功能。Specifically, an audio file is pre-stored in the test package, and the audio file is the previously transmitted audio data. After acquiring the audio data of the voice playback, the voice is recognized by artificial intelligence and then converted into text data, and then the text data is tested by setting a check assertion in the script of the test package, a test report is generated, and the test report is pushed to the remote real It can be displayed on the front-end page of the computer, so that the function of automatic voice test can be completed.
示例性地,所述生成模块208具体用于:Exemplarily, the generating module 208 is specifically configured to:
获取所述测试包中的断言数据。Get assertion data in the test suite.
具体地,预先在测试包中根据音频数据编写断言程序,即断言数据。Specifically, an assertion program, that is, assertion data, is written in advance in the test package according to the audio data.
根据所述断言数据,将所述测试包中预存的音频数据与所述待测试数据进行对比,基于对比结果生成测试报告。According to the assertion data, the audio data pre-stored in the test package is compared with the data to be tested, and a test report is generated based on the comparison result.
具体地,调用人工智能API进行音频数据转文字的工作,使用获取到的音频文字和测试案例中的断言进行对比,若达到要求则认为通过,否则失败。Specifically, the artificial intelligence API is called to convert audio data into text, and the obtained audio text is compared with the assertion in the test case. If the requirements are met, it is considered to pass, otherwise it fails.
实施例三Embodiment 3
参阅图7,是本发明实施例三之计算机设备的硬件架构示意图。本实施例中,所述计算机设备2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。该计算机设备2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图7所示,所述计算机设备2至少包括,但不限于,可通过系统总线相互通信连接存储器21、处理器22、网络接口23、以及基于终端的音频测试系统20。其中:Referring to FIG. 7 , it is a schematic diagram of a hardware architecture of a computer device according to Embodiment 3 of the present invention. In this embodiment, the computer device 2 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions. The computer equipment 2 may be a rack-type server, a blade-type server, a tower-type server or a cabinet-type server (including an independent server, or a server cluster composed of multiple servers) and the like. As shown in FIG. 7 , the computer device 2 at least includes, but is not limited to, a
本实施例中,存储器21至少包括一种类型的计算机可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器21可以是计算机设备2的内部存储单元,例如该计算机设备2的硬盘或内存。在另一些实施例中,存储器21也可以是计算机设备2的外部存储设备,例如该计算机设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器21还可以既包括计算机设备2的内部存储单元也包括其外部存储设备。本实施例中,存储器21通常用于存储安装于计算机设备2的操作系统和各类应用软件,例如实施例二的基于终端的音频测试系统20的程序代码等。此外,存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。In this embodiment, the
处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制计算机设备2的总体操作。本实施例中,处理器22用于运行存储器21中存储的程序代码或者处理数据,例如运行基于终端的音频测试系统20,以实现实施例一的基于终端的音频测试方法。In some embodiments, the
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述服务器2与其他电子装置之间建立通信连接。例如,所述网络接口23用于通过网络将所述服务器2与外部终端相连,在所述服务器2与外部终端之间的建立数据传输通道和通信连接等。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband CodeDivision Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。需要指出的是,图7仅示出了具有部件20-23的计算机设备2,但是应理解的是,并不要求实施所有示出的部件,可以替代的实施更多或者更少的部件。The
在本实施例中,存储于存储器21中的所述基于终端的音频测试系统20还可以被分割为一个或者多个程序模块,所述一个或者多个程序模块被存储于存储器21中,并由一个或多个处理器(本实施例为处理器22)所执行,以完成本发明。In this embodiment, the terminal-based
例如,图6示出了所述实现基于终端的音频测试系统20实施例二的程序模块示意图,该实施例中,所述基于终端的音频测试系统20可以被划分为接收模块200、启动模块202、确定模块204、获取模块206以及生成模块208。其中,本发明所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述基于终端的音频测试系统20在所述计算机设备2中的执行过程。所述程序模块200-208的具体功能在实施例二中已有详细描述,在此不再赘述。For example, FIG. 6 shows a schematic diagram of program modules for implementing the second embodiment of the terminal-based
实施例四Embodiment 4
本实施例还提供一种计算机可读存储介质,如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等等,其上存储有计算机程序,程序被处理器执行时实现相应功能。本实施例的计算机可读存储介质用于计算机程序,被处理器执行时实现实施例一的基于终端的音频测试方法。This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), only Read-only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Programmable Read-Only Memory (PROM), magnetic memory, magnetic disk, optical disk, server, App application mall, etc., on which computer programs are stored, When the program is executed by the processor, the corresponding function is realized. The computer-readable storage medium of this embodiment is used for a computer program, and when executed by a processor, implements the terminal-based audio testing method of Embodiment 1.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in other related technical fields , are similarly included in the scope of patent protection of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011038225.8A CN112115060A (en) | 2020-09-28 | 2020-09-28 | Audio test method and system based on terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011038225.8A CN112115060A (en) | 2020-09-28 | 2020-09-28 | Audio test method and system based on terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112115060A true CN112115060A (en) | 2020-12-22 |
Family
ID=73797118
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011038225.8A Pending CN112115060A (en) | 2020-09-28 | 2020-09-28 | Audio test method and system based on terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112115060A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112769645A (en) * | 2020-12-29 | 2021-05-07 | 视联动力信息技术股份有限公司 | Terminal testing method and device, terminal equipment and storage medium |
CN112788193A (en) * | 2020-12-30 | 2021-05-11 | 北京达佳互联信息技术有限公司 | Image transmission method, image transmission device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100058409A1 (en) * | 2008-08-29 | 2010-03-04 | Comarco Wireless Technologies, Inc. | Audio and video testing methodology |
CN103036966A (en) * | 2012-12-10 | 2013-04-10 | 周玲玲 | Mobile terminal remote interaction test system and remote interaction test method |
CN104538042A (en) * | 2014-12-22 | 2015-04-22 | 南京声准科技有限公司 | Intelligent voice test system and method for terminal |
CN107342877A (en) * | 2016-04-29 | 2017-11-10 | 展讯通信(上海)有限公司 | The method of testing and system of audio frequency of mobile terminal quality |
CN109918306A (en) * | 2019-03-08 | 2019-06-21 | 深圳市腾讯网络信息技术有限公司 | Audio processing equipment, system, method, apparatus and storage medium |
-
2020
- 2020-09-28 CN CN202011038225.8A patent/CN112115060A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100058409A1 (en) * | 2008-08-29 | 2010-03-04 | Comarco Wireless Technologies, Inc. | Audio and video testing methodology |
CN103036966A (en) * | 2012-12-10 | 2013-04-10 | 周玲玲 | Mobile terminal remote interaction test system and remote interaction test method |
CN104538042A (en) * | 2014-12-22 | 2015-04-22 | 南京声准科技有限公司 | Intelligent voice test system and method for terminal |
CN107342877A (en) * | 2016-04-29 | 2017-11-10 | 展讯通信(上海)有限公司 | The method of testing and system of audio frequency of mobile terminal quality |
CN109918306A (en) * | 2019-03-08 | 2019-06-21 | 深圳市腾讯网络信息技术有限公司 | Audio processing equipment, system, method, apparatus and storage medium |
Non-Patent Citations (1)
Title |
---|
ZHANGZHUO1024: "Q版本安卓手机录制系统声音的方法", pages 1 - 2, Retrieved from the Internet <URL:https://blog.csdn.net/zhangzhuo1024/article/details/100065474> * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112769645A (en) * | 2020-12-29 | 2021-05-07 | 视联动力信息技术股份有限公司 | Terminal testing method and device, terminal equipment and storage medium |
CN112769645B (en) * | 2020-12-29 | 2024-03-19 | 视联动力信息技术股份有限公司 | Terminal testing method and device, terminal equipment and storage medium |
CN112788193A (en) * | 2020-12-30 | 2021-05-11 | 北京达佳互联信息技术有限公司 | Image transmission method, image transmission device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111782492B (en) | Page first screen loading duration testing method and device, computer equipment and medium | |
WO2021003818A1 (en) | Interface test case generating method and apparatus, computer device, and storage medium | |
CN113778897B (en) | Automatic test method, device and equipment for interface and storage medium | |
CN108255735B (en) | Associated environment testing method, electronic device and computer readable storage medium | |
CN112631924A (en) | Automatic testing method and device, computer equipment and storage medium | |
CN112115060A (en) | Audio test method and system based on terminal | |
CN108170600A (en) | The coverage rate statistical method of front-end code test, apparatus and system | |
CN111352851A (en) | Program testing method and device, computer equipment and storage medium | |
CN113051178A (en) | Test data construction method, device, equipment and medium | |
WO2019100690A1 (en) | Electronic device, testing method, system and computer readable storage medium | |
CN111259364B (en) | A method, device, device and storage medium for using a national secret encryption card | |
CN116107781A (en) | Log tracking method, device, electronic equipment and computer program product | |
CN105207829B (en) | Intrusion detection data processing method, device and system | |
CN113535578A (en) | CTS (clear to send) testing method, device and testing equipment | |
CN113900893B (en) | Log acquisition method and related equipment thereof | |
CN114218191B (en) | System function migration method, device, computer equipment and storage medium | |
CN110262856B (en) | Application program data acquisition method, device, terminal and storage medium | |
CN114968725A (en) | Task dependency relationship correction method and device, computer equipment and storage medium | |
CN114780412A (en) | Page testing method, system, equipment and medium | |
CN112579448A (en) | Debugging method and system for hybrid application | |
CN111124907A (en) | A mobile game testing method, device and server | |
CN114218098B (en) | Software system testing method, device, computer equipment and readable storage medium | |
CN113904945B (en) | Internet of things equipment simulation debugging method and device, electronic device and storage medium | |
WO2024066622A1 (en) | Cloud system testing method and apparatus | |
CN115002014B (en) | Methods, devices, storage media and electronic devices for determining test results |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |