CN114328189A - Fault recurrence method, device, terminal and computer readable storage medium - Google Patents
Fault recurrence method, device, terminal and computer readable storage medium Download PDFInfo
- Publication number
- CN114328189A CN114328189A CN202111506353.5A CN202111506353A CN114328189A CN 114328189 A CN114328189 A CN 114328189A CN 202111506353 A CN202111506353 A CN 202111506353A CN 114328189 A CN114328189 A CN 114328189A
- Authority
- CN
- China
- Prior art keywords
- test
- fault
- log
- case
- test case
- 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
Landscapes
- Debugging And Monitoring (AREA)
Abstract
本申请提供了一种故障复现方法、装置、终端及计算机可读存储介质,涉及故障检测领域,该方法应用于终端。首先,终端根据操作步骤生成相应的测试用例,然后运行测试用例以生成测试日志,并将测试日志显示于终端使得用户能够对测试日志的正确性进行验证,在用户验证测试日志正确的情况下将预先设置的定位标识符添加至测试用例中,进而得到标识用例,终端运行标识用例,当出现故障时便生成故障日志并发送。通过在测试用例中添加定位标识符得到标识用例,并不断运行标识用例来找出程序中的偶现故障,能够快速地对偶现故障进行复现,减小了偶现故障修复过程的难度,有效地节约了时间成本。
The present application provides a fault recurrence method, device, terminal and computer-readable storage medium, which relate to the field of fault detection, and the method is applied to a terminal. First, the terminal generates the corresponding test case according to the operation steps, then runs the test case to generate the test log, and displays the test log on the terminal so that the user can verify the correctness of the test log. The preset location identifier is added to the test case, and then the identification case is obtained. The terminal runs the identification case, and when a fault occurs, a fault log is generated and sent. By adding the location identifier to the test case to obtain the identification use case, and running the identification use case continuously to find out the occasional fault in the program, the occasional fault can be quickly reproduced, and the difficulty of the repair process of the occasional fault can be reduced, effectively Save time cost.
Description
技术领域technical field
本申请涉及故障检测领域,具体而言,涉及一种故障复现方法、装置、终端及计算机可读存储介质。The present application relates to the field of fault detection, and in particular, to a fault reproduction method, device, terminal, and computer-readable storage medium.
背景技术Background technique
随着信息技术的不断发展,终端安装的应用程序越来越多,而在应用程序运行及开发过程当中会出现一些故障,大部分故障是可以再现的,但其中有一些故障是偶尔出现的或是很难复现的,这种故障就叫做偶现故障。偶现故障的出现没有任何的规律可寻,完全是随机的,这就导致测试人员与研发人员很难发现问题所在,即便偶现故障再次发生也很难引起重视,导致其一直存在于应用程序当中。With the continuous development of information technology, more and more applications are installed on the terminal, and some faults will occur during the operation and development of the application. Most of the faults can be reproduced, but some of them are occasional or It is difficult to reproduce, and this kind of failure is called an occasional failure. Occasional failures do not have any regularity and are completely random, which makes it difficult for testers and R&D personnel to find the problem. among.
测试人员为了查找出现偶现故障的原因,只有通过不断地测试来获取对应的测试步骤,并且偶现故障出现之后难以快速复现,这对于测试人员与研发人员来说,在复现和修复偶现故障的过程中增加了难度,也耗费了大量时间。因此,如何对应用程序的偶现故障进行复现成为亟待解决的技术问题。In order to find the cause of the occasional failure, the tester can only obtain the corresponding test steps through continuous testing, and it is difficult to quickly reproduce the occasional failure after the occurrence of the occasional failure. The process of failure increases the difficulty and also consumes a lot of time. Therefore, how to reproduce the occasional failure of the application has become an urgent technical problem to be solved.
发明内容SUMMARY OF THE INVENTION
为了克服现有技术中的上述不足,本申请实施例提供了一种故障复现方法、装置、终端及计算机可读存储介质,其能够达到对应用程序的偶现故障进行复现的目的。In order to overcome the above deficiencies in the prior art, the embodiments of the present application provide a method, device, terminal, and computer-readable storage medium for reproducing faults, which can achieve the purpose of reproducing occasional faults of application programs.
为了实现上述目的,本申请实施例采用的技术方案如下:In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
第一方面,本申请实施例提供了一种故障复现方法,应用于终端,所述方法包括:In a first aspect, an embodiment of the present application provides a fault recurrence method, which is applied to a terminal, and the method includes:
根据操作步骤生成相应的测试用例,所述操作步骤预先根据外部反馈或功能测试确定;Generate corresponding test cases according to the operation steps, and the operation steps are determined in advance according to external feedback or functional testing;
运行所述测试用例生成测试日志,并将所述测试日志显示于终端以使用户验证所述测试日志的正确性;Running the test case to generate a test log, and displaying the test log on the terminal so that the user can verify the correctness of the test log;
在所述测试日志正确的情况下,添加预先设置的定位标识符至所述测试用例中以得到标识用例;In the case that the test log is correct, adding a preset location identifier to the test case to obtain an identification case;
运行所述标识用例,当所述标识用例出现故障时生成故障日志并发送。The identification use case is run, and a failure log is generated and sent when the identification use case fails.
进一步地,在根据操作步骤生成相应的测试用例之前,还包括:Further, before the corresponding test case is generated according to the operation steps, it also includes:
获取用户输入的系统信息;Get system information entered by the user;
根据所述系统信息登陆相应的待测系统,所述待测系统与所述测试用例对应。Log in to the corresponding system to be tested according to the system information, and the system to be tested corresponds to the test case.
进一步地,所述操作步骤包括操作类型、定位方法及操作方式,所述根据操作步骤生成相应的测试用例的步骤包括:Further, the operation steps include an operation type, a positioning method and an operation mode, and the step of generating a corresponding test case according to the operation steps includes:
根据所述操作类型、所述定位方法及所述操作方式生成测试用例脚本;Generate a test case script according to the operation type, the positioning method and the operation mode;
运行所述测试用例脚本以得到所述测试用例。The test case script is run to obtain the test case.
进一步地,所述方法还包括:Further, the method also includes:
在所述测试日志错误的情况下发送所述测试日志。The test log is sent if the test log is erroneous.
第二方面,本申请实施例还提供了一种故障复现装置,应用于终端,所述装置包括:In a second aspect, an embodiment of the present application further provides a fault reproduction device, which is applied to a terminal, and the device includes:
生成模块,用于根据操作步骤生成相应的测试用例,所述操作步骤预先根据外部反馈或功能测试确定;a generation module, configured to generate corresponding test cases according to the operation steps, the operation steps are determined in advance according to external feedback or functional tests;
运行模块,用于运行所述测试用例生成测试日志,并将所述测试日志显示于终端以使用户验证所述测试日志的正确性;a running module, configured to run the test case to generate a test log, and display the test log on the terminal so that the user can verify the correctness of the test log;
添加模块,用于在所述测试日志正确的情况下,添加预先设置的定位标识符至所述测试用例中以得到标识用例;An adding module is used to add a preset location identifier to the test case to obtain an identification case when the test log is correct;
运行模块,还用于运行所述标识用例,当所述标识用例出现故障时生成故障日志并发送。The running module is further configured to run the identification use case, and generate and send a fault log when the identification use case fails.
进一步地,所述装置还包括:Further, the device also includes:
获取模块,用于获取用户输入的系统信息;The acquisition module is used to acquire the system information input by the user;
登陆模块,用于根据所述系统信息登陆相应的待测系统,所述待测系统与所述测试用例对应。The login module is used to log in to the corresponding system under test according to the system information, and the system under test corresponds to the test case.
进一步地,所述操作步骤包括操作类型、定位方法及操作方式,所述生成模块包括:Further, the operation step includes an operation type, a positioning method and an operation mode, and the generating module includes:
生成子模块,用于根据所述操作类型、所述定位方法及所述操作方式生成测试用例脚本;generating a submodule for generating a test case script according to the operation type, the positioning method and the operation mode;
运行子模块,用于运行所述测试用例脚本以得到所述测试用例。The running submodule is used for running the test case script to obtain the test case.
进一步地,所述装置还包括:Further, the device also includes:
发送模块,用于在所述测试日志错误的情况下发送所述测试日志。A sending module, configured to send the test log when the test log is wrong.
第三方面,本申请实施例还提供了一种终端,包括:处理器、存储器和总线,所述存储器存储有所述处理器可执行的程序指令,当所述客户端运行时,所述处理器与所述存储器之间通过总线通信,所述处理器执行所述程序指令,以执行时执行如第一方面中任一所述的故障复现方法。In a third aspect, an embodiment of the present application further provides a terminal, including: a processor, a memory, and a bus, where the memory stores program instructions executable by the processor, and when the client runs, the processing The processor communicates with the memory through a bus, and the processor executes the program instructions, so as to execute the fault recovery method according to any one of the first aspects when executed.
第四方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器运行时执行如第一方面中任意一项所述的故障复现方法。In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor when any one of the first aspect is executed. The described failure reproduction method.
本申请提供了一种故障复现方法、装置、终端及计算机可读存储介质,应用于终端。首先,终端根据操作步骤生成相应的测试用例,然后运行测试用例以生成测试日志,并将测试日志显示于终端使得用户能够对测试日志的正确性进行验证,在用户验证测试日志正确的情况下将预先设置的定位标识符添加至测试用例中,进而得到标识用例,终端运行标识用例,当出现故障时便生成故障日志并发送。通过在测试用例中添加定位标识符得到标识用例,并不断运行标识用例来找出程序中的偶现故障,能够快速地对偶现故障进行复现,减小了偶现故障修复过程的难度,有效地节约了时间成本。The present application provides a fault reproduction method, device, terminal and computer-readable storage medium, which are applied to a terminal. First, the terminal generates the corresponding test case according to the operation steps, then runs the test case to generate the test log, and displays the test log on the terminal so that the user can verify the correctness of the test log. The preset location identifier is added to the test case, and then the identification case is obtained. The terminal runs the identification case, and when a fault occurs, a fault log is generated and sent. By adding the location identifier to the test case to obtain the identification use case, and running the identification use case continuously to find out the occasional fault in the program, the occasional fault can be quickly reproduced, and the difficulty of the repairing process of the occasional fault is reduced, effectively Save time cost.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following drawings will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore do not It should be regarded as a limitation of the scope, and for those of ordinary skill in the art, other related drawings can also be obtained according to these drawings without any creative effort.
图1示出了本申请实施例提供的故障复现方法的流程示意图。FIG. 1 shows a schematic flowchart of a fault reproduction method provided by an embodiment of the present application.
图2示出了本申请实施例提供的故障复现方法的另一种流程示意图。FIG. 2 shows another schematic flowchart of a fault reproduction method provided by an embodiment of the present application.
图3示出了本申请实施例提供的故障复现方法中步骤S130的流程示意图。FIG. 3 shows a schematic flowchart of step S130 in the fault reproduction method provided by the embodiment of the present application.
图4示出了本申请实施例提供的测试用例脚本生成示意图。FIG. 4 shows a schematic diagram of generating a test case script provided by an embodiment of the present application.
图5示出了本申请实施例提供的故障复现装置的结构示意图。FIG. 5 shows a schematic structural diagram of a fault reproduction apparatus provided by an embodiment of the present application.
图6示出了本申请实施例提供的终端的结构示意图。FIG. 6 shows a schematic structural diagram of a terminal provided by an embodiment of the present application.
图标:100-故障复现装置;110-生成模块;120-添加模块;130-运行模块;11-处理器;12-存储器;13-总线。Icons: 100-fault reproduction device; 110-generating module; 120-adding module; 130-running module; 11-processor; 12-memory; 13-bus.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of the present application, but not all of the embodiments. The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations.
因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。Thus, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the application as claimed, but is merely representative of selected embodiments of the application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
需要说明的是,在不冲突的情况下,本申请的实施例中的特征可以相互结合。It should be noted that the features in the embodiments of the present application may be combined with each other under the condition of no conflict.
在应用程序运行及开发的过程当中,由于要面对复杂的运行环境,应用程序在运行时可能会出现一些故障,而这部分故障并不是由应用程序本身所造成的,具有一定的偶然性,此类故障就叫做偶现故障。而偶现故障的出现并没有任何的规律可寻,这就导致测试人员与研发人员很难发现问题所在,但是偶现故障会一直存在于应用程序当中。In the process of running and developing the application, due to the complex running environment, the application may have some faults during running, and this part of the fault is not caused by the application itself, but has a certain chance. Such failures are called occasional failures. The occurrence of occasional failures does not have any regularity, which makes it difficult for testers and developers to find the problem, but occasional failures will always exist in the application.
为了查找出现偶现故障的原因,只有通过不断地测试,由于偶现故障出现之后难以快速复现,这对于测试人员与研发人员来说,在复现和修复偶现故障的过程中增加了难度,也耗费了大量时间。因此,如何快速地对应用程序中的偶现故障进行复现成为技术人员亟待解决的技术问题。In order to find the cause of the occasional failure, only through continuous testing, because it is difficult to quickly reproduce the occasional failure after it occurs, which increases the difficulty for testers and R&D personnel in the process of reproducing and repairing the occasional failure , it also took a lot of time. Therefore, how to quickly reproduce the occasional failure in the application program has become a technical problem to be solved urgently by the technicians.
针对上述技术问题,本申请实施例提供一种故障复现方法,能够在偶现故障出现时对其进行快速复现,减少了修复偶现故障过程的难度,提高了测试人员修复偶现故障的效率,下面对此进行详细介绍。In view of the above technical problems, the embodiment of the present application provides a fault reproduction method, which can quickly reproduce the occasional fault when it occurs, reduces the difficulty of the process of repairing the occasional fault, and improves the tester's ability to repair the occasional fault. efficiency, which is described in detail below.
首先,应用于本申请中故障复现方法的终端可以通过各种形式来实施,例如,可以为数字TV、台式计算机等固定终端,也可以为包括诸如手机、平板电脑、笔记本电脑、掌上电脑、个人数字助理(Personal Digital Assistant,PDA)、便捷式媒体播放器(PortableMedia Player,PMP)、导航装置、可穿戴设备、智能手环、计步器等移动终端。First of all, the terminal applied to the fault recurrence method in this application can be implemented in various forms, for example, it can be a fixed terminal such as a digital TV, a desktop computer, etc. Mobile terminals such as Personal Digital Assistant (PDA), Portable Media Player (PMP), navigation device, wearable device, smart bracelet, and pedometer.
请参考图1,图1示出了本申请实施例提供的故障复现方法的流程示意图,该故障复现方法应用于终端中,包括以下步骤S130~S160:Please refer to FIG. 1. FIG. 1 shows a schematic flowchart of a fault recurrence method provided by an embodiment of the present application. The fault recurrence method is applied to a terminal and includes the following steps S130-S160:
S130、根据操作步骤生成相应的测试用例,操作步骤预先根据外部反馈或功能测试确定。S130. Generate a corresponding test case according to the operation steps, and the operation steps are determined in advance according to external feedback or functional testing.
其中,操作步骤可以根据外部反馈所确定,比如用户的电子设备在运行应用程序时出现偶现故障,便发送反馈信息表明偶现故障出现,操作步骤还可以通过功能测试所确定,比如测试人员在对应用程序进行测试时,编写并运行功能测试用例从而主动发现偶现缺陷。Among them, the operation steps can be determined according to external feedback. For example, when the user's electronic device has an occasional failure when running the application program, feedback information is sent to indicate that the occasional failure occurs. The operation steps can also be determined through functional testing. As you test your application, write and run functional test cases to proactively find occasional bugs.
值得说明的是,功能测试是软件测试中一个重要的方面,其是对软件产品的各个功能进行验证,根据功能测试用例,逐项测试软件产品的功能是否满足用户要求的功能。而功能测试用例是为某个特殊目标而编制的一组测试输入、执行条件以及预期结果,以便测试某个功能是否满足需求的测试用例。一般来说,功能测试用例通常是针对单个页面内部的测试,例如,向一个页面中的登录框输入用户名和密码之后,点击登录按钮,验证登录是否成功的登录功能测试用例。It is worth noting that functional testing is an important aspect of software testing. It verifies each function of a software product, and tests whether the functions of the software product meet user requirements according to functional test cases. A functional test case is a set of test inputs, execution conditions, and expected results prepared for a special goal in order to test whether a function satisfies the requirements. Generally speaking, functional test cases are usually tests inside a single page. For example, after entering the user name and password into the login box in a page, click the login button to verify whether the login is successful or not.
终端根据操作步骤生成相应的测试用例,该操作步骤可以包含上述的功能测试用例。在一种可能的实施方式中,终端可以预先存储测试用例至数据库中,并设置测试用例与操作步骤为对应的关系,当终端得到操作步骤时便能够生成测试用例。The terminal generates corresponding test cases according to the operation steps, and the operation steps may include the above-mentioned functional test cases. In a possible implementation, the terminal may store test cases in the database in advance, and set the test cases and operation steps as a corresponding relationship, and the terminal can generate the test cases when the operation steps are obtained.
S140、运行测试用例生成测试日志,并将测试日志显示于终端以使用户验证测试日志的正确性。S140. Run the test case to generate a test log, and display the test log on the terminal so that the user can verify the correctness of the test log.
在生成测试用例之后,终端会运行该测试用例从而生成测试日志,并将其显示给用户,以便用户能够检查测试日志是否正确,只有在测试日志正确的情况下能够发现偶现缺陷,所以要对测试日志的正确性做一次验证,测试日志正确执行步骤S150。After the test case is generated, the terminal will run the test case to generate the test log and display it to the user, so that the user can check whether the test log is correct. The correctness of the test log is verified once, and step S150 is performed correctly for the test log.
S150、在测试日志正确的情况下,添加预先设置的定位标识符至测试用例中以得到标识用例。S150. When the test log is correct, add a preset location identifier to the test case to obtain the identification case.
S160、运行标识用例,当标识用例出现故障时生成故障日志并发送。S160. Run the identification use case, and when the identification use case fails, a failure log is generated and sent.
定位标识符用来定位可能出现偶现缺陷的字段,该字段可以是一个关键字,也可以是一句话或者一段文字,本申请对此不作任何限定。在运行带有定位标识符的标识用例时,可以只用判断标识符定位的字段,而不用对测试用例中的所有字段进行判断,减小了终端的工作量。The location identifier is used to locate a field that may have occasional defects, and the field may be a keyword, or a sentence or a piece of text, which is not limited in this application. When running the identification use case with the positioning identifier, only the field located by the judgment identifier can be used instead of judging all the fields in the test case, which reduces the workload of the terminal.
在用户验证测试日志正确之后,终端便将定位标识符设置于测试用例之中从而生成标识用例,然后开启循环测试来重复运行标识用例,当在循环测试过程中出现偶现故障时,则立即停止循环测试并生成对应的故障日志,而故障日志可以通过邮件发送至指定邮箱,以表明偶现故障已经找出。故障日志为后续分析偶现缺陷的成因提供有效的帮助,减小了发现偶现缺陷的时间。After the user verifies that the test log is correct, the terminal sets the positioning identifier in the test case to generate the identification case, and then starts the loop test to repeatedly run the identification test case, and stops immediately when an accidental failure occurs during the loop test. Loop test and generate corresponding fault logs, and the fault log can be sent to the designated mailbox by email to indicate that the occasional fault has been found. The fault log provides an effective help for subsequent analysis of the causes of accidental defects, and reduces the time for discovering accidental defects.
在一种可能的实施方式中,判断标识用例运行过程中出现故障的方式可以为先运行一次标识用例生成对应的日志,然后再运行一次标识用例生成对应的日志,将前一次与后一次的日志进行对比,如果前一次与后一次的日志不同则表明出现故障,如果前一次与后一次的日志相同则继续循环上述步骤,直至故障出现。In a possible implementation manner, the method of judging the failure during the running of the identification use case may be to run the identification use case once to generate the corresponding log, then run the identification use case again to generate the corresponding log, and compare the logs of the previous time and the next time. For comparison, if the logs of the previous time and the next time are different, it indicates a failure. If the logs of the previous time and the next time are the same, the above steps will continue to be cycled until the failure occurs.
本申请根据操作步骤生成相应的测试用例,然后运行测试用例以生成测试日志,并将测试日志显示于终端使得用户能够对测试日志的正确性进行验证,在用户验证测试日志正确的情况下将预先设置的定位标识符添加至测试用例中,进而得到标识用例,终端运行标识用例,当出现故障时便生成故障日志并发送。通过在测试用例中添加定位标识符得到标识用例,并不断运行标识用例来找出程序中的偶现故障,能够快速地对偶现故障进行复现,减小了偶现故障修复过程的难度,有效地节省了时间成本。This application generates the corresponding test case according to the operation steps, then runs the test case to generate the test log, and displays the test log on the terminal so that the user can verify the correctness of the test log. The set positioning identifier is added to the test case, and then the identification case is obtained. The terminal runs the identification case, and when a fault occurs, a fault log is generated and sent. By adding the location identifier to the test case to obtain the identification use case, and running the identification use case continuously to find out the occasional fault in the program, the occasional fault can be quickly reproduced, and the difficulty of the repairing process of the occasional fault is reduced, effectively Save time cost.
为了找到执行测试用例的待测系统,在图1的基础上参照图2,图2示出了本申请实施例提供的故障复现方法的另一种流程示意图,如图所示,在步骤S130之前,还包括:In order to find the system under test that executes the test case, reference is made to FIG. 2 on the basis of FIG. 1 . FIG. 2 shows another schematic flowchart of the fault reproduction method provided by the embodiment of the present application. As shown in the figure, in step S130 Before, also included:
S110、获取用户输入的系统信息。S110. Obtain system information input by the user.
S120、根据系统信息登陆相应的待测系统,待测系统与测试用例对应。S120. Log in to the corresponding system to be tested according to the system information, and the system to be tested corresponds to the test case.
其中,系统信息为被测系统的web访问地址,可以是ip地址,也可以为域名地址。用户在终端输入web访问地址之后,终端根据访问地址登陆相应的待测系统,在待测系统中运行测试用例。The system information is the web access address of the system under test, which may be an IP address or a domain name address. After the user enters the web access address on the terminal, the terminal logs in to the corresponding system under test according to the access address, and runs the test case in the system under test.
进一步的,根据待测系统与测试用例的对应关系,可以同时对多个系统进行并行测试来对偶现故障进行复现,大大减少了偶现故障复现的时间,提高了测试人员的工作效率。Further, according to the corresponding relationship between the system under test and the test case, multiple systems can be tested in parallel to reproduce the occasional fault, which greatly reduces the time for the occasional fault to recur and improves the work efficiency of the testers.
接下来对步骤S130进行详细地介绍,在图1的基础上参照图3,图3示出了本申请实施例提供的故障复现方法中步骤S130的流程示意图,步骤S130包括:Next, step S130 will be introduced in detail. Referring to FIG. 3 on the basis of FIG. 1 , FIG. 3 shows a schematic flowchart of step S130 in the fault reproduction method provided by the embodiment of the present application. Step S130 includes:
S131、根据所述操作类型、所述定位方法及所述操作方式生成测试用例脚本。S131. Generate a test case script according to the operation type, the positioning method, and the operation mode.
S132、运行所述测试用例脚本以得到所述测试用例。S132. Run the test case script to obtain the test case.
其中,操作步骤包括操作类型、定位方法及操作方式等,操作类型为需要用户实际执行的类型,包括定位元素、执行js语句及打开或关闭窗口等,而定位方法是通过前端元素的属性值来对视图元素进行定位,前端元素的属性可以为class、id、name、xpath、css等,而操作方式为需要用户所执行的操作,例如点击,清除文本,获取元素,获取文本,鼠标右击,鼠标左击,鼠标双击,空格等。Among them, the operation steps include operation type, positioning method and operation method, etc. The operation type is the type that needs to be actually executed by the user, including positioning elements, executing js statements, and opening or closing windows, etc., and the positioning method is determined by the attribute value of the front-end element. Position the view element. The attributes of the front-end element can be class, id, name, xpath, css, etc., and the operation method is the operation that the user needs to perform, such as click, clear text, get element, get text, right-click, Left click, double click, space, etc.
通过用户选择的操作类型、定位方法及操作方式的操作步骤来自动生成测试用例脚本,然后终端运行测试用例脚本来得到测试用例,其中测试用例可以根据用户所选择的测试关键字自动生成自动化运行脚本。The test case script is automatically generated by the operation type, positioning method and operation steps selected by the user, and then the terminal runs the test case script to obtain the test case, wherein the test case can automatically generate the automatic running script according to the test keyword selected by the user. .
在一种可能的实施方式中,图4示出了本申请实施例提供的测试用例脚本生成示意图,如图所示。In a possible implementation manner, FIG. 4 shows a schematic diagram of test case script generation provided by the embodiment of the present application, as shown in the figure.
图中有三条操作步骤,三条操作步骤中的操作类型都是定位元素,而定位元素选择的都是xpath,第一条操作步骤和第二条操作步骤选择的操作方式都为输出文本,第三条操作步骤选择的是点击,此时用户只需要维护每一个步骤,终端将会自动生成测试用例脚本。There are three operation steps in the figure. The operation types in the three operation steps are positioning elements, and the positioning elements are all selected by xpath. The operation mode selected in the first operation step and the second operation step is output text. The operation step is selected by clicking. At this time, the user only needs to maintain each step, and the terminal will automatically generate the test case script.
可选的,在步骤S140之后,还包括:Optionally, after step S140, it further includes:
S170、在测试日志错误的情况下发送所述测试日志。S170. Send the test log when the test log is wrong.
在将测试日志显示于终端之后,用户验证测试日志错误,终端根据用户的选择将错误的测试日志发送至指定邮箱来分析测试日志出错的原因。After the test log is displayed on the terminal, the user verifies that the test log is wrong, and the terminal sends the wrong test log to a designated mailbox according to the user's selection to analyze the cause of the test log error.
与现有技术相比,本申请实施例具有以下有益效果:Compared with the prior art, the embodiments of the present application have the following beneficial effects:
第一,通过在测试用例中添加定位标识符得到标识用例,并不断运行标识用例来找出程序中的偶现故障,能够快速地对偶现故障进行复现,减小了偶现故障修复过程的难度,有效地节省了时间成本。First, by adding the location identifier to the test case to obtain the identification use case, and running the identification use case continuously to find out the occasional fault in the program, the occasional fault can be quickly reproduced, and the repair process of the occasional fault can be reduced. Difficulty, effectively saving time and cost.
第二,根据待测系统与测试用例的对应关系,可以同时对多个系统进行并行测试,进而对偶现故障进行复现,大大减少了偶现故障复现的时间,提高了测试人员的工作效率。Second, according to the corresponding relationship between the system under test and the test case, multiple systems can be tested in parallel at the same time, and then the occasional fault can be reproduced, which greatly reduces the time for the recurrence of the occasional fault and improves the work efficiency of the testers. .
下面给出一种故障复现装置可能的实现方式,其用于执行上述实施例及可能的实现方式中示出的故障复现方法各个执行步骤和相应的技术效果。请参照图5,图5示出了本申请实施例提供的故障复现装置100的结构示意图,该装置应用于上述的终端当中,故障复现装置100包括:A possible implementation manner of a fault reproduction apparatus is given below, which is used to execute each execution step and corresponding technical effect of the fault reproduction method shown in the foregoing embodiments and possible implementation manners. Please refer to FIG. 5 . FIG. 5 shows a schematic structural diagram of a
生成模块110,用于根据操作步骤生成相应的测试用例,操作步骤预先根据外部反馈或功能测试确定;The
运行模块130,用于运行测试用例生成测试日志,并将测试日志显示于终端以使用户验证测试日志的正确性;The running
添加模块120,用于在测试日志正确的情况下,添加预先设置的定位标识符至测试用例中以得到标识用例;The adding
运行模块130,还用于运行标识用例,当标识用例出现故障时生成故障日志并发送。The running
本申请提供了一种故障复现装置100,生成模块110根据操作步骤生成相应的测试用例,运行模块130运行测试用例以生成测试日志,并将测试日志显示于终端使得用户能够对测试日志的正确性进行验证,添加模块120在用户验证测试日志正确的情况下将预先设置的定位标识符添加至测试用例中,进而得到标识用例,运行模块130运行标识用例,当出现故障时便生成故障日志并发送。来找出程序中的偶现故障,能够快速地对偶现故障进行复现。The present application provides a
可选的,故障复现装置100还包括:Optionally, the
获取模块,用于获取用户输入的系统信息;The acquisition module is used to acquire the system information input by the user;
登陆模块,用于根据所述系统信息登陆相应的待测系统,所述待测系统与所述测试用例对应。The login module is used to log in to the corresponding system under test according to the system information, and the system under test corresponds to the test case.
可选的,生成模块110包括:Optionally, the
生成子模块,用于根据所述操作类型、所述定位方法及所述操作方式生成测试用例脚本;generating a submodule for generating a test case script according to the operation type, the positioning method and the operation mode;
运行子模块,用于运行所述测试用例脚本以得到所述测试用例。The running submodule is used for running the test case script to obtain the test case.
可选的,故障复现装置100还包括:Optionally, the
发送模块,用于在所述测试日志错误的情况下发送所述测试日志。A sending module, configured to send the test log when the test log is wrong.
下面对终端的结构进行介绍,请参照图6,图6示出了本申请实施例提供的一种终端的结构示意图。The structure of the terminal is introduced below. Please refer to FIG. 6 , which shows a schematic structural diagram of a terminal provided by an embodiment of the present application.
终端除了包括正常终端所包含的设备,例如射频单元、WiFi模块、音频输出单元、视频输入单元、传感器、显示器等基础设备之外。本申请实施例提供的终端还可以包括处理器11、存储器12及总线13,处理器11通过总线13与存储器12连接。存储器12用于存储程序,例如图4所示的故障复现装置100,该故障复现装置100包括至少一个可以以软件或固件(firmware)的形式存储于存储器12中或固化在终端的操作系统(operating system,OS)中的软件功能模块,处理器11在接收到执行指令后,执行程序以实现上述实施例揭示的故障复现方法。In addition to the equipment included in a normal terminal, the terminal includes basic equipment such as a radio frequency unit, a WiFi module, an audio output unit, a video input unit, a sensor, and a display. The terminal provided in this embodiment of the present application may further include a
存储器12可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器12可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(StaticRandom Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等等。存储器12是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器12还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。
处理器11可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述故障复现方法的各步骤可以通过处理器11中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器11可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、微控制单元(Microcontroller Unit,MCU)、复杂可编程逻辑器件(ComplexProgrammable Logic Device,CPLD)、现场可编程门阵列(Field-Programmable GateArray,FPGA)、嵌入式ARM等芯片。The
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器11执行时实现上述实施例揭示的故障复现方法。Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the
综上所述,本申请提供了一种故障复现方法、装置、终端及计算机可读存储介质,应用于终端。首先,终端根据操作步骤生成相应的测试用例,然后运行测试用例以生成测试日志,并将测试日志显示于终端使得用户能够对测试日志的正确性进行验证,在用户验证测试日志正确的情况下将预先设置的定位标识符添加至测试用例中,进而得到标识用例,终端运行标识用例,当出现故障时便生成故障日志并发送。通过在测试用例中添加定位标识符得到标识用例,并不断运行标识用例来找出程序中的偶现故障,能够快速地对偶现故障进行复现,减小了偶现故障修复过程的难度,有效地节省了时间成本。To sum up, the present application provides a method, device, terminal and computer-readable storage medium for failure reproduction, which are applied to a terminal. First, the terminal generates the corresponding test case according to the operation steps, then runs the test case to generate the test log, and displays the test log on the terminal so that the user can verify the correctness of the test log. The preset location identifier is added to the test case, and then the identification case is obtained. The terminal runs the identification case, and when a fault occurs, a fault log is generated and sent. By adding the location identifier to the test case to obtain the identification use case, and running the identification use case continuously to find out the occasional fault in the program, the occasional fault can be quickly reproduced, and the difficulty of the repairing process of the occasional fault is reduced, effectively Save time cost.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, All should be covered within the scope of protection of this application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111506353.5A CN114328189A (en) | 2021-12-10 | 2021-12-10 | Fault recurrence method, device, terminal and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111506353.5A CN114328189A (en) | 2021-12-10 | 2021-12-10 | Fault recurrence method, device, terminal and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114328189A true CN114328189A (en) | 2022-04-12 |
Family
ID=81050329
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111506353.5A Pending CN114328189A (en) | 2021-12-10 | 2021-12-10 | Fault recurrence method, device, terminal and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114328189A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115454022A (en) * | 2022-08-25 | 2022-12-09 | 广东新会美达锦纶股份有限公司 | Testing method and device of variable frequency control module for spinning and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104614601A (en) * | 2014-12-26 | 2015-05-13 | 惠州Tcl移动通信有限公司 | Terminal fault positioning method, device and system |
CN112732563A (en) * | 2020-12-31 | 2021-04-30 | 深圳赛安特技术服务有限公司 | Interface script test log extraction method and device, terminal and storage medium |
CN113501034A (en) * | 2021-09-09 | 2021-10-15 | 卡斯柯信号(北京)有限公司 | Test log generation method and device for railway signal system |
CN113656321A (en) * | 2021-08-26 | 2021-11-16 | 中国电信股份有限公司 | Automated testing method, system, equipment and medium |
-
2021
- 2021-12-10 CN CN202111506353.5A patent/CN114328189A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104614601A (en) * | 2014-12-26 | 2015-05-13 | 惠州Tcl移动通信有限公司 | Terminal fault positioning method, device and system |
CN112732563A (en) * | 2020-12-31 | 2021-04-30 | 深圳赛安特技术服务有限公司 | Interface script test log extraction method and device, terminal and storage medium |
CN113656321A (en) * | 2021-08-26 | 2021-11-16 | 中国电信股份有限公司 | Automated testing method, system, equipment and medium |
CN113501034A (en) * | 2021-09-09 | 2021-10-15 | 卡斯柯信号(北京)有限公司 | Test log generation method and device for railway signal system |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115454022A (en) * | 2022-08-25 | 2022-12-09 | 广东新会美达锦纶股份有限公司 | Testing method and device of variable frequency control module for spinning and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10552301B2 (en) | Completing functional testing | |
CN108763076A (en) | A kind of Software Automatic Testing Method, device, equipment and medium | |
CN110992992B (en) | A hard disk testing method, device and storage medium | |
CN111459798A (en) | Test methods, devices, media and electronic equipment | |
CN113238940B (en) | Interface test result comparison method, device, equipment and storage medium | |
US9779014B2 (en) | Resilient mock object creation for unit testing | |
US20190079854A1 (en) | Systems and methods for executing tests | |
US10846206B2 (en) | Adaptive software testing | |
CN113918864A (en) | Website page testing method, testing system, testing device, electronic equipment and medium | |
US9658948B2 (en) | Workload mapper for potential problem areas using modules and defect data | |
CN107820608A (en) | For the method and apparatus for the Debugging message for producing, capture, storing and loading the test script to fail | |
CN116382968A (en) | Fault detection method and device for external equipment | |
US9501390B1 (en) | Enhancing automated mobile application testing | |
CN114328189A (en) | Fault recurrence method, device, terminal and computer readable storage medium | |
US8516311B2 (en) | System and method for testing peripheral component interconnect express switch | |
CN118885406A (en) | Database cluster abnormality testing method and device | |
US10417116B2 (en) | System, method, and apparatus for crowd-sourced gathering of application execution events for automatic application testing and replay | |
CN113127280A (en) | API interface automatic input method and system | |
Huang et al. | Ocasta: Clustering configuration settings for error recovery | |
CN112560041B (en) | Method, apparatus and computer storage medium for automated quality verification detection | |
de Assis et al. | Amplifying Tests for Cross-Platform Apps through Test Patterns. | |
CN115061921A (en) | Automatic test method, device, electronic equipment and readable storage medium | |
CN115454856A (en) | Multi-application security detection method, device, medium and electronic equipment | |
CN112380127A (en) | Test case regression method, device, equipment and storage medium | |
CN113760696A (en) | Program problem positioning method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |