WO2018036530A1 - 一种测试设计书生成方法 - Google Patents

一种测试设计书生成方法 Download PDF

Info

Publication number
WO2018036530A1
WO2018036530A1 PCT/CN2017/098688 CN2017098688W WO2018036530A1 WO 2018036530 A1 WO2018036530 A1 WO 2018036530A1 CN 2017098688 W CN2017098688 W CN 2017098688W WO 2018036530 A1 WO2018036530 A1 WO 2018036530A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
action
current
control
screen
Prior art date
Application number
PCT/CN2017/098688
Other languages
English (en)
French (fr)
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 JP2019531515A priority Critical patent/JP2019525372A/ja
Publication of WO2018036530A1 publication Critical patent/WO2018036530A1/zh

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
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • 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 software testing technologies, and in particular, to a method for generating a test design book.
  • the traditional software testing technology has a stage of manual intervention.
  • the tester needs to manually set the test case and various test actions included therein, and manually run the test, manually compare the test results and judge whether the test is successful according to the comparison result.
  • there are too many steps of manual intervention in the existing software testing technology so it takes up a lot of artificial resources, prolongs the time of software testing, and reduces the testing efficiency.
  • test parameter setting is usually implemented by code level settings that only professional testers can master. Therefore, the test setup is complicated, and the tester is required to have matching code knowledge and technology.
  • the tester when writing the test design book, the tester needs to manually write a large number of test cases, and manually form a negative complex test design book according to the manually written test cases, and compare the consumption of human resources. Big.
  • a technical solution for generating a test design book which aims to realize automatic visualization of the test, making the test process more intuitive and more efficient, and simplifying the test operation.
  • test design book generating method wherein a plurality of the test cases are preset in sequence, each of the test cases corresponding to a plurality of sequentially executed test actions, each of the test actions corresponding to one test control, Each of the test actions corresponds to one operation method, each of the test controls corresponds to one test screen, and each of the test actions corresponds to a plurality of expected results;
  • test case name Set the test case name, test action name, and expected result in a test design book. value
  • the filled test design book is displayed in a test design screen.
  • test design book generating method wherein an initial data value is respectively set for each test case in the test design book;
  • Initialization data corresponding to each of the test cases is filled into the corresponding initialization data values, respectively.
  • the test design book generating method wherein all the test actions corresponding to all the test cases that need to be executed this time are arranged in the order in which the test cases are executed to form a test according to the test design book.
  • Action list and perform an automated test method including:
  • Step S1 selecting one of the test actions as the current action in the action list, and testing the test case corresponding to the current action as a current use case;
  • Step S2 comparing the number of the display screen in the system browser during the test with the number of the test screen corresponding to the current action to locate the display screen;
  • Step S3 grab the test control matching the current action as the current control in the displayed display screen
  • Step S4 according to the action attribute of the current action, operating the captured current control according to the corresponding operation method, and then outputting an operation result corresponding to the current action;
  • step S5 the operation result is compared with the expected result corresponding to the current action to determine whether the current action is successfully executed, and the corresponding comparison result is saved as the test result of the current action.
  • test design book generating method wherein a result value is respectively set corresponding to each of the test actions in the test design book
  • test results corresponding to each of the test actions are respectively filled into the corresponding result values.
  • the test design book generating method wherein, in the step S1, when performing the first test action associated with the current use case, extracting the first test corresponding to the current use case
  • the test screen of the control serves as an open screen, and the open screen is opened by an address associated with the open screen to start testing the current use case.
  • the test design book generating method wherein, in the step S1, before performing each of the test actions associated with the current use case, determining, according to the action attribute of the test action, whether the need to open the corresponding The test screen of the test control of the test action is described, and an address associated with the test screen is extracted as needed to open the test screen.
  • the test design book generating method in the step S1, extracting initialization data of the current use case after confirming the test case as the current use case, in a database associated with the current use case The data is initialized to begin testing the current use case;
  • the screen is opened to test the startup screen.
  • the test design book generating method wherein the step S2 specifically includes:
  • the test design book generating method wherein the step S2 specifically includes:
  • the test design book generating method in the step S3, after capturing one of the test controls in the display screen, the control attribute of the test control is corresponding to the current action
  • the control attributes of the test control are matched and the matching result is obtained, and the test control that is captured is positioned as the current control when the matching result indicates that the matching is successful.
  • the test design book generating method in the step S4, before the operation of the control, first determining the action attribute of the current action, and determining, according to the action attribute, the current
  • the control operates:
  • action attribute of the current action is an execution operation command, performing an operation on the current control to execute the operation command to operate the control;
  • action attribute of the current action is a send text column message, operating the current control to send the corresponding text column message;
  • action attribute of the current action is memory copy, save the value of the current control in a system memory
  • the action attribute of the current action is a memory assignment, changing a value of the current control to a value saved in the system memory;
  • the action attribute of the current action is a logical judgment, determining an expression stored in the system memory for indicating an assignment, and skipping a preset subsequent to the current action according to the determination result Said test action;
  • the current control is operated by transmitting a corresponding function key combination command to an input device of the system.
  • test design book generating method wherein, in the step S5, comparing the operation result with the expected result according to the type of the operation result:
  • the system reads information of the control corresponding to the display screen in the browser, and reads the read information The expected results are compared;
  • the system reads the corresponding column of data in the browser, and performs the read information with the expected result.
  • the system reads the data in the database and compares the read information with the expected result.
  • test design book generating method in the step S5, determining whether the current action is executed successfully:
  • test of the current use case is ended and jumps to the next test case, and then returns to the step S1.
  • the test design book generating method in the step S5, after saving the corresponding comparison result as the test result of the current action, jumping to the next test action:
  • step S4 If the next test action jumped to indicates that the global control is operated, the process returns to step S4.
  • the beneficial effects of the above technical solution are: providing a test design book generation method, which can realize the automatic visualization of the test, make the test process more intuitive and more efficient, simplify the test operation, and generate the test design book more convenient and intuitive, and save Labor costs.
  • FIG. 1 is a schematic diagram of a test design book generated by automatic filling in a preferred embodiment of the present invention
  • FIG. 2 is a schematic diagram showing the overall flow of performing an automatic test according to a test design book in a preferred embodiment of the present invention
  • 3-4 are schematic diagrams showing preset test cases in a preferred embodiment of the present invention.
  • Figure 5 is a schematic diagram of a preset screen in a preferred embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a preset test action in a preferred embodiment of the present invention.
  • Figure 7 is a schematic diagram of a preset control in a preferred embodiment of the present invention.
  • test design book generation method a plurality of test cases are preset in sequence, and each test case corresponds to a plurality of test actions executed in sequence, each test action corresponds to one test control, and each test action corresponds to one operation Method, each test control corresponds to one test picture, and each test action corresponds to multiple expected results;
  • test case name is populated according to the attribute value associated with the use case name in the test case
  • the filled test design book is displayed in a test design screen.
  • the filling of the test design report is automatically filled by the system, and is not manually filled by the user.
  • the content described above is only for describing the items set in the test design book and the data source corresponding to each item. .
  • an initialization data value is respectively set for each test case in the test design book
  • the initialization data corresponding to each test case is filled into the corresponding initialization data value, respectively.
  • a test title is also provided in the test design.
  • different test cases may be combined to form a test plan, and multiple test cases in the test plan are related to each other, and there is a certain execution order.
  • the test scenario is a holistic test project that includes multiple test cases.
  • the test title set in the above test design book may be the data source of the title of the above test plan, that is, the title name of the test plan is filled into the test title of the test design book.
  • FIG. 1 is a schematic diagram showing the above test design book.
  • the above "system management" is the test title, and its data source is from the title name of the test plan.
  • the data source for the above use case name is derived from the attribute value of the use case name for each test case.
  • the data source for the above test action is derived from the attribute value associated with the action name of each test action.
  • the data source of the expected result value is derived from the expected result corresponding to each test action (both the initialization data and the expected result value in FIG. 1 are not filled with data). All other items shown in FIG. 1 above may be from related data sources of test cases and/or test actions that have been preset, and will not be further described herein.
  • test actions corresponding to all the test cases that need to be executed in this order are arranged in the order in which the test cases are executed to form a test action list, and an automatic test method is executed according to the test design book.
  • Figure 2 including:
  • Step S1 selecting a test action as the current action in the action list, and testing the test case corresponding to the current action as the current use case;
  • Step S2 comparing the number of the display screen in the system browser during the test with the number of the test screen corresponding to the current action to locate the display screen;
  • Step S3 capturing a test control matching the current action as a current control in the displayed display screen
  • Step S4 according to the action attribute of the current action, operating the captured current control according to the corresponding operation method, and then outputting the operation result corresponding to the current action;
  • step S5 the operation result is compared with the expected result of the current action to determine whether the current action is successfully executed, and the corresponding comparison result is saved as the test result of the current action.
  • a basic test case is first preset, and a plurality of derived test cases are randomly generated according to the basic test case.
  • the above basic test case may be a test case in which a user sets a relevant parameter in advance, and the plurality of derivative test cases may be different test cases generated by transforming a random transform related parameter according to the basic test case. Since it is derived from the same base test case, the base test case and the derived test case belong to the same test plan (or test item). Both the above basic test cases and derivative test cases can be confirmed as test cases.
  • the basic test case and the plurality of derivative test cases are all filled into the test design book to form a test design book associated with the test plan (or test item).
  • a test design book associated with the test plan (or test item).
  • an execution order of all the test cases described above needs to be formed, and the filling position of the test case filled in the test design book is adjusted according to the execution order of the test case.
  • the resulting test design book is different from the general design book. It does not require the tester to manually write each test case in the test design book. It also does not require the tester to manually fill in the specific parameters of each test case, thus saving labor costs. .
  • each test case in the test design includes a plurality of test actions, and each test action corresponds to one test control.
  • Each test control corresponds to one test screen, so it is decided that each test case corresponds to multiple test pictures.
  • test case is preset in order, that is, a plurality of test cases are preset according to a certain execution order, and after one test case is executed, the next test case is turned to execute.
  • different test actions are also arranged in order, and each test action corresponds to one test control, and each test control corresponds to one test picture.
  • the above test screen can be divided into an open screen and a subsequent screen. For a test case, there is only one open screen, and there may be multiple subsequent screens.
  • the open screen may be the first screen executed by the test case, and the subsequent screen is the display screen after the above-mentioned open screen and sequentially arranged.
  • Each test screen (including the open screen and subsequent screens) is the screen corresponding to the operation of a test control.
  • a test action of entering a username and password may include a test action of entering a username and password, and a test action of clicking a login control.
  • the test screen corresponding to the login control may be a login screen provided to the user for inputting a user name and a password, and the screen may be used as a startup screen of the test case, and the plurality of subsequent screens of the test case may be a system displayed after successful login. Other screens of the browser, or screens that failed to log in. The above pictures are sorted according to test logic.
  • the setting interface of the test case is as shown in Figure 3-4.
  • the name of the opening screen in the test case is “account information”, and the name of the test case is “Enter the modified account password interface”.
  • the pre-association test case of the test case is “Enter Account Information Interface”, and accordingly, the test
  • the pre-association test cases of the use cases also include "login”, "enter system management” and “enter account information interface”, and the above-mentioned pre-association test cases are arranged in order.
  • the setting interface of the test case shown in FIG. 2 is a visual interface, which is not a code level setting interface in the prior art, so the setting process of the test case can be simplified.
  • a list of the above-described preset test cases is shown in FIG.
  • the setting interface of the test screen (including the open screen and the subsequent screen) associated with the test case is as shown in FIG. 5.
  • the screen information in FIG. 5 includes a screen number (ID), a screen name, and a screen access address.
  • the so-called access address refers to a URL (Uniform Resoure Locator) address.
  • the above screen setting interface is also a visual interface.
  • the setting interface of the test action is as shown in FIG. 6, and the test action in FIG. 6 can be configured as “embedded search condition”, wherein the name of the plurality of display screens, multiple control names, and multiple action attributes are associated with each other. (method) and assignment of multiple test actions.
  • the setting interface of the above test action is also visually easy to operate.
  • the operation method corresponding to each test action may be performed by a series of action attributes.
  • the column is calculated, and the above action attribute can be represented by the corresponding expression.
  • the set of test actions associated with different test cases is completed to form an action list.
  • test cases A, B, and C are respectively arranged in order
  • test actions A1, A2, and A3 are respectively arranged in order in test case A
  • test actions are respectively set in order in test case B.
  • B1 and B2 in which test actions C1, C2, C3, and C4 are respectively arranged in the test case C
  • the above action list may be sequentially arranged A1, A2, A3, B1, B2, C1, C2. C3, C4.
  • the setting interface of the control associated with each test action is as shown in FIG. 7.
  • the control information of each control includes the control serial number (ID), the control title, the control type, the front-end technology of the control, the attribute name used for the positioning of the control, the attribute value used for the positioning of the control, and the maximum/minimum of the control. Value/maximum length/minimum length, default value of the control, list of correct values for the control/list of error values, etc.
  • the setting screen of the above control is also a visual screen.
  • the settings of the test cases, test actions, screens, and controls may be performed in the following two ways: 1) pre-set by the system; 2) pre-set each test element in the system, then use Different test elements can be selected through the corresponding visual interface and combined to form setting information such as test cases, test actions, pictures and controls.
  • test cases included in the test case are placed in an action list according to the order of different test cases.
  • step S1 first, a test action is selected to start the test. Specifically, for the test action, the corresponding test case can be determined, and the determined test case is used as the current use case to start the test.
  • the switching state of the display screen of the browser is monitored, the screen number of the display screen currently loaded by the browser is found, and the number of the test screen of the current action is displayed with the display.
  • the number of the screen is compared, that is, the screen of the current display screen is matched with the test screen corresponding to the current motion, so that the display screen of the current browser is positioned as a test screen corresponding to the current motion in the current use case.
  • the display content in the display screen is analyzed, and real-time information of all the controls in the display screen is captured, according to the control captured in the display screen.
  • the related information of the piece is matched with the control information corresponding to the test action (for example, the positioning attribute), so that the accurate control can be located and the position information of the positioned control can be recorded.
  • the control information corresponding to the test action for example, the positioning attribute
  • the matching result is displayed when the matching result indicates that the matching is successful. Position as the current control.
  • the manner of positioning the control may include: firstly, using a test control corresponding to the test action to locate a test screen, where the test screen is the currently displayed display screen. Since the display screen may not only include one control, the test control corresponding to the above test action needs to be located in the display screen to complete the positioning of the test control.
  • the corresponding operation may be performed on the test control according to the action attribute of the current action, and then the current action is executed, and the operation result corresponding to the current action is recorded.
  • the operation result is compared with the expected result corresponding to the current action to determine whether the current action is successful, and the comparison result is recorded.
  • test parameters such as test cases, test actions, test controls, test screens, and expected results
  • the software test that is automatically visualized by the set test parameters can meet people's software testing requirements and improve the efficiency of software testing.
  • a result value is respectively set for each test action in the test design book
  • step S5 the test results corresponding to each test action are respectively filled into corresponding result values. For example, based on the test results, the result value is filled with "success” or "failure".
  • step S1 before performing each test action associated with the current use case, it is determined according to the action attribute of the test action whether the test screen corresponding to the test action of the test action needs to be opened. And extract the address associated with the test screen as needed to open the test screen. Specifically, in the above embodiment, before each test action is performed, To determine whether you need to load the test screen of the test control corresponding to the test action: if necessary, load the corresponding test screen; if not, do not make any changes to the screen. In the above embodiment, the extraction and loading of the test screen is implemented by extracting the URL address of the corresponding screen of the corresponding control.
  • the current use case is tested by extracting the URL address associated with the corresponding picture of the corresponding control, using the startup parameter specified by the current use case, and opening the corresponding URL address in the browser. If the currently specified browser has been opened, it is only necessary to update the display screen in the browser by extracting the URL address associated with the screen.
  • the action attribute of the test action may include an association relationship between the test action and the action in the sequence. The system can judge the relationship between the test action and its front and rear actions, and then determine whether it is necessary to extract the corresponding URL address and open the corresponding test screen.
  • step S1 when the first test action associated with the current use case is executed, the test screen corresponding to the first test control of the current use case is extracted as the open screen, and Open the open screen with the address associated with the open screen to begin testing the current use case.
  • the test screen of the test control corresponding to the test action is loaded as the open screen only when the first test action in one test case is executed.
  • the first test action in the above action list can be selected and the test can be started.
  • the test action is taken as the current action, and the corresponding test case is located according to the current action, and the test case is used as the current use case, and then the test picture corresponding to the test control corresponding to the current action is extracted and started. test.
  • the extracted picture should also be the open picture of the corresponding current use case.
  • the method of loading and extracting the open screen is the same as the previous embodiment, that is, by extracting the URL address of the open screen and using the startup parameter specified by the current use case, opening in the specified system browser.
  • the initialization data of the test case is first set, that is, the data of the test case is initialized.
  • the so-called initialization operation of the data which may include: initializing the corresponding data in the database to avoid the previous test data legacy affecting the test, or adding corresponding initialization data in the database to form a test initialization Test the environment to ensure the uniformity of the environment at the beginning of the test.
  • test action when performing a new test action, First, it is necessary to determine whether the test action is the first test action of a test case: if yes, the test case needs to be initialized first, and then the test action is performed; if not, the test action is directly executed.
  • the open screen of each test case is marked.
  • the corresponding test case is initialized with data, and then the test action corresponding to the open screen is executed.
  • step S1 after the test case is confirmed as the current use case, the initialization data of the current use case is extracted to start testing the current use case;
  • the address of the test screen corresponding to the first test control of the current use case is extracted as the open screen, and then the open screen is opened using the boot parameters specified by the current use case, and the test is performed.
  • the startup parameter refers to a standard network parameter that opens the above test screen as a start screen.
  • the step S2 includes: acquiring the number of the test screen corresponding to the subsequent test action of the current action, and monitoring the number of the display screen, the number of the display screen and the number of the test screen. When they match, confirm that the display screen is successfully switched to locate the display screen. Specifically, in the above step S2, if the number of the current display screen matches the number of the test screen corresponding to the subsequent operation of the current operation, it is considered that the current display screen is successfully switched, and the display screen is positioned as the subsequent action of the current action. Test screen.
  • the step S2 includes: acquiring the number of the subsequent test screen corresponding to the current action, and monitoring the number of the display screen, when the number of the display screen is consistent with the number of the test screen. , confirm that the display screen is successfully switched to locate the display screen. Specifically, in the above step S2, if the current display screen number matches the number of the subsequent screen of the current operation, the current display screen is considered to be successfully switched, and the display screen is positioned as the subsequent screen of the current operation.
  • step S4 before the operation of the control, the action attribute of the current action is first determined, and the current control is determined according to the action attribute:
  • the operation performed on the current control is to assign a value to the control, for example, a preset value is given to the control.
  • the operation performed on the current control is to execute an operation command to operate the control, for example, the operation command is “click”, and the current control can be executed. Click on the action of the control.
  • the current control is operated by sending a corresponding function key combination command to the input device of the system, for example, the function key is combined into a "Shift” button on the combined input keyboard.
  • the "Alt” button and the “Enter” button the system can send a corresponding function key combination command to the keyboard to notify the keyboard to output the combined key command of the above three buttons.
  • the current control sends a corresponding text column message, and specifically, the corresponding text column message can be sent by the browser.
  • the assignment of the current control is saved in the system memory; specifically, the assignment of the current control or other specific values can be saved to the system memory, that is, the "clipboard" of the system memory is implemented.
  • the action attribute of the current action is a memory assignment
  • the value already saved in the system memory can be assigned to the current control according to the action attribute of the current action.
  • the action attribute of the current action is a logical judgment
  • the value saved in the memory may be judged, and the preset subsequent test action is skipped according to the judgment result.
  • the so-called logical judgment is to judge the expression indicating the value in the system memory, for example, whether the expression is greater than/less than a certain preset value, or whether the value stored in the system memory is true/false.
  • the above skipping scheme indicating the skip action can be preset in the test attribute of different test actions.
  • the specific judging process may be: determining an expression of the value stored in the system memory, and determining whether the preset skipping scheme needs to be executed according to the judging result to skip one or more subsequent testing actions.
  • the skipping scheme may also not include any subsequent actions, that is, no need to skip any subsequent actions regardless of the judgment result.
  • the display content of the browser can be monitored, thereby positioning a new picture number, and locating a new test control.
  • step S5 a comparison between the operation result and the expected result is performed according to the type of the operation result:
  • the system reads the information of the corresponding control included in the display screen in the browser, and compares the read information with the expected result; specifically, the control When comparing the information with the expected result, it is a unified ratio of a batch of controls. For example, the information corresponding to all the controls in the current display screen is captured and compared with the expected result.
  • the system reads the corresponding column of data in the browser, and compares the read information with the expected result;
  • the system reads the data in the database and compares the read information with the expected result.
  • the preset setting interface of the expected result is as shown in FIG. 8-10:
  • the expected result of the controls in the picture is shown in Figure 8, which may include the ID of the control, the title of the control, the type of the expected result, and the value of the expected result.
  • the expected result of the table class is shown in FIG. 9, which may include attributes such as a control ID, a title of the control, a number of expected pieces, a number of comparison pieces, and table data.
  • the expected result of the database class is shown in FIG. 10, which may include attributes such as search conditions, sorting conditions, number of restrictions, and data.
  • the system reads the information of the corresponding control in the browser, and compares the read information with the expected result;
  • the system If it is a comparison of data in a column, the system reads the corresponding column of data in the browser, and compares the read information with the expected result;
  • the system reads the data in the specified database and compares the read information with the expected result.
  • step S5 it is determined whether the current action is successfully executed:
  • step S5 If yes, save the operation result associated with the current action, and then continue to perform step S5;
  • test of the current use case is ended and jumps to the next test case, and then returns to step S1.
  • step S5 If the current action is successfully executed, it naturally jumps to the next test action of the same current use case and executes (continues to step S5), and saves the result of the successful execution.
  • step S1 execution (return to step S1), in the action list, the subsequent test action corresponding to the current use case is skipped, and the test is resumed from the first test action of the next test case.
  • the display page of the browser ie, the page indicating the operation result
  • the control corresponding to the current action is marked in the screenshot.
  • the location (marked by the previous control positioning).
  • step S5 after saving the corresponding comparison result as the test result of the current action, the process jumps to the next test action:
  • step S5 after the corresponding comparison result is saved as the test result of the current action, the process jumps to the next test action.
  • test design book generation method and the corresponding automatic test method can be applied to any mainstream software system, because the above test cases, test actions, test controls, and tests are preset.
  • the implementation of the driving method required in the mainstream software system is pre-guaranteed in the database such as the screen, thereby ensuring the driving of the action method in the mainstream software system.

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)
  • Investigating Or Analysing Biological Materials (AREA)

Abstract

本发明公开了一种测试设计书生成方法,属于软件测试技术领域;方法包括:按序预设多个测试用例,每个测试用例对应于多个按序执行的测试动作,于一测试设计书中分别设置测试用例名称、测试动作名称以及预想结果值;根据测试用例中关联于用例名称的属性值对测试用例名称进行填充;根据测试动作中关联于动作名称的属性值对测试动作名称进行填充;分别将关联于每个测试动作的预想结果填充至对应的预想结果值中;将经过填充的测试设计书显示在一测试设计画面中上述技术方案的有益效果是:生成测试设计书更简便和直观,节省人力成本。

Description

一种测试设计书生成方法 技术领域
本发明涉及软件测试技术领域,尤其涉及一种测试设计书生成方法。
背景技术
传统的软件测试技术存在着人工干预的阶段,测试人员需要手动设置测试用例以及其中包括的各种测试动作,并且手动运行测试,手动比对测试结果以及根据比对结果判断测试是否成功。换言之,在现有的软件测试技术中存在过多人工干预的步骤,因此会占用大量的人工资源,延长软件测试的时间,降低测试效率。
同时,现有的软件测试技术中,其测试参数设置通常采用一些只有专业测试人员才能掌握的代码级设置来实现,因此导致测试设置比较复杂,要求测试人员具有相匹配的代码知识和技术才能对软件测试进行参数设置;
同时,对于传统的软件测试技术而言,在编写测试设计书时需要测试人员手动编写大量的测试用例,并且根据手动编写的测试用例手动形成一个负复杂的测试设计书,对于人力资源的消耗比较大。
发明内容
根据现有技术中存在的上述问题,现提供一种测试设计书生成方法的技术方案,旨在实现测试的可视化自动进行,使得测试过程更直观更有效率,简化测试的操作。
上述技术方案具体包括:
一种测试设计书生成方法,其中,按序预设多个所述测试用例,每个所述测试用例对应于多个按序执行的测试动作,每个所述测试动作对应于一个测试控件,每个所述测试动作对应于一个操作方法,每个所述测试控件对应一个测试画面,每个所述测试动作对应多个预想结果;
于一测试设计书中分别设置测试用例名称、测试动作名称以及预想结果 值;
根据所述测试用例中关联于用例名称的属性值对所述测试用例名称进行填充;
根据所述测试动作中关联于动作名称的属性值对所述测试动作名称进行填充;
分别将关联于每个所述测试动作的所述预想结果填充至对应的所述预想结果值中;
将经过填充的所述测试设计书显示在一测试设计画面中。
优选的,该测试设计书生成方法,其中,于所述测试设计书中对应每个所述测试用例分别设置一初始化数据值;
分别将对应于每个所述测试用例的初始化数据填充至对应的所述初始化数据值中。
优选的,该测试设计书生成方法,其中,根据所述测试设计书,将本次需要执行的所有所述测试用例对应的所有所述测试动作按照所述测试用例被执行的顺序排列形成一测试动作列表,并执行一个自动测试方法,具体包括:
步骤S1,于所述动作列表中选择一个所述测试动作作为当前动作,并将所述当前动作对应的所述测试用例作为当前用例进行测试;
步骤S2,将测试过程中系统浏览器中的显示画面的编号,和所述当前动作对应的所述测试画面的编号进行比较,以对所述显示画面进行定位;
步骤S3,于被定位的所述显示画面中抓取匹配于所述当前动作的所述测试控件作为当前控件;
步骤S4,根据所述当前动作的动作属性,依据对应的所述操作方法对被抓取的所述当前控件进行操作,随后输出对应所述当前动作的操作结果;
步骤S5,将所述操作结果与对应所述当前动作的所述预想结果进行比较,以判断所述当前动作是否执行成功,将对应的比较结果保存为所述当前动作的测试结果。
优选的,该测试设计书生成方法,其中,于所述测试设计书中对应每个所述测试动作分别设置一结果值;
于执行所述步骤S5后,分别将对应于每个所述测试动作的所述测试结果填充至对应的所述结果值中。
优选的,该测试设计书生成方法,其中,所述步骤S1中,在执行关联于所述当前用例的第一个所述测试动作时,提取对应于所述当前用例的第一个所述测试控件的所述测试画面作为开启画面,并通过关联于所述开启画面的地址打开所述开启画面,以开始对所述当前用例进行测试。
优选的,该测试设计书生成方法,其中,所述步骤S1中,在执行关联于所述当前用例的每个所述测试动作之前,根据所述测试动作的动作属性判断是否需要打开对应于所述测试动作的所述测试控件的所述测试画面,并在需要时提取关联于所述测试画面的地址以打开所述测试画面。
优选的,该测试设计书生成方法,其中,所述步骤S1中,当将所述测试用例确认为所述当前用例后提取所述当前用例的初始化数据,对关联于所述当前用例的数据库中的数据进行初始化操作,以开始对所述当前用例进行测试;
提取对应于所述当前用例的第一个所述测试控件的所述测试画面的地址作为所述开启画面的开启地址,并基于所述开启地址,使用关联于所述当前用例的启动参数开启所述开启画面,以对所述启动画面进行测试。
优选的,该测试设计书生成方法,其中,所述步骤S2具体包括:
获取对应于所述当前动作的后续的所述测试动作的所述测试画面的编号,同时监控所述显示画面的编号,在所述显示画面的编号与所述测试画面的编号一致时,确认所述显示画面切换成功,以对所述显示画面进行定位。
优选的,该测试设计书生成方法,其中,所述步骤S2具体包括:
获取对应于所述当前动作的后续的所述测试画面的编号,同时监控所述显示画面的编号,在所述显示画面的编号与所述测试画面的编号一致时,确认所述显示画面切换成功,以对所述显示画面进行定位。
优选的,该测试设计书生成方法,其中,所述步骤S3中,抓取到所述显示画面中的一个所述测试控件后,将所述测试控件的控件属性与所述当前动作对应的所述测试控件的控件属性进行匹配并得到匹配结果,并在所述匹配结果表示匹配成功时将被抓取的所述测试控件定位为所述当前控件。
优选的,该测试设计书生成方法,其中,所述步骤S4中,在对所述控件进行操作之前,首先判断所述当前动作的所述动作属性,并根据所述动作属性确定对所述当前控件进行操作:
若所述当前动作的所述动作属性为设值,则对所述当前控件进行的操作为给所述控件赋值;
若所述当前动作的所述动作属性为执行操作命令,则对所述当前控件进行的操作为执行所述操作命令以操作所述控件;
若所述当前动作的所述动作属性为发送文字列消息,则操作所述当前控件发送对应的所述文字列消息;
若所述当前动作的所述动作属性为内存复制,则将所述当前控件的值保存于系统内存中;
若所述当前动作的所述动作属性为内存赋值,则将所述当前控件的值更改为所述系统内存中保存的值;
若所述当前动作的所述动作属性为逻辑判断,则对保存于所述系统内存中用于表示赋值的表达式进行判断,并根据判断结果跳过关联于所述当前动作的预设的后续的所述测试动作;
若所述当前动作的所述动作属性为采用功能键组合的方式进行操作,则通过向系统的输入装置发送对应的功能键组合命令的方式操作所述当前控件。
优选的,该测试设计书生成方法,其中,所述步骤S5中,根据所述操作结果的类型进行所述操作结果与所述预想结果之间的比较:
若所述操作结果为操作所述显示画面中包括的所述控件的结果,则系统读取所述浏览器中的所述显示画面对应的所述控件的信息,并将读取到的信息与所述预想结果进行比较;
若所述操作结果为对应于所述浏览器中的一栏数据的结果,则系统读取所述浏览器中对应的所述一栏数据,并将读取到的信息与所述预想结果进行比较;
若所述操作结果为系统的数据库中的数据,则系统读取所述数据库中的数据,并读取到的信息与所述预想结果进行比较。
优选的,该测试设计书生成方法,其中,所述步骤S5中,判断所述当前动作是否执行成功:
若是,则保存关联于所述当前动作的所述操作结果,随后继续执行所述步骤S5;
若否,则结束所述当前用例的测试,并跳转至下一个所述测试用例,随后返回所述步骤S1。
优选的,该测试设计书生成方法,其中,所述步骤S5中,将对应的比较结果保存为所述当前动作的测试结果后,跳转至下一个所述测试动作:
若跳转至的下一个所述测试动作表示对全局的控件进行操作,则返回所述步骤S4。
上述技术方案的有益效果是:提供一种测试设计书生成方法,能够实现测试的可视化自动进行,使得测试过程更直观更有效率,简化测试的操作,并且生成测试设计书更简便和直观,节省人力成本。
附图说明
图1是本发明的较佳的实施例中,自动填充生成的测试设计书的示意图;
图2是本发明的较佳的实施例中,根据测试设计书执行自动测试的总体流程示意图;
图3-4是本发明的较佳的实施例中,预设测试用例的示意图;
图5是本发明的较佳的实施例中,预设画面的示意图;
图6是本发明的较佳的实施例中,预设测试动作的示意图;
图7是本发明的较佳的实施例中,预设控件的示意图;
图8-10是本发明的较佳的实施例中,不同的预想结果的示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。
需要说明的是,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。
下面结合附图和具体实施例对本发明作进一步说明,但不作为本发明的限定。
本发明的较佳的实施例中,基于现有技术中存在的上述问题,现提供一 种测试设计书生成方法。该测试设计书生成方法中,按序预设多个测试用例,每个测试用例对应于多个按序执行的测试动作,每个测试动作对应于一个测试控件,每个测试动作对应于一个操作方法,每个测试控件对应一个测试画面,每个测试动作对应多个预想结果;
于一测试设计书中分别设置测试用例名称、测试动作名称以及预想结果值;
根据测试用例中关联于用例名称的属性值对测试用例名称进行填充;
根据测试动作中关联于动作名称的属性值对测试动作名称进行填充;
分别将关联于每个测试动作的预想结果填充至对应的预想结果值中;
将经过填充的测试设计书显示在一测试设计画面中。
上述实施例中,上述测试设计报告书的填充是通过系统自动填充的,并非由使用者手动填充,上文中所述的内容仅仅为描述测试设计书中设置的项目以及每个项目对应的数据来源。
本发明的较佳的实施例中,于测试设计书中对应每个测试用例分别设置一初始化数据值;
分别将对应于每个测试用例的初始化数据填充至对应的初始化数据值中。
本发明的较佳的实施例中,于测试设计书中还设置一测试标题。具体地,可以将不同的多个测试用例结合起来形成一个测试方案,该测试方案中的多个测试用例是相互关联的,并且存在一定的执行顺序。换言之,该测试方案是一个包括多个测试用例的整体的测试项目。则上述测试设计书中设置的测试标题可以以上述测试方案的标题名称为数据来源,即将上述测试方案的标题名称填充至测试设计书的测试标题中。
则图1为上述测试设计书的一种显示示意图。在图1中,上述“系统管理”即为测试标题,其数据源来自测试方案的标题名称。上述用例名称的数据源来自每个测试用例的用例名称的属性值。上述测试动作的数据源来自关联于每个测试动作的动作名称的属性值。上述预想结果值的数据源来自对应于每个测试动作的预想结果(图1中的初始化数据和预想结果值两栏均未填充数据)。上述图1中显示的其他项目均可以来自已经预设好的测试用例和/或测试动作的相关数据源,在此不再一一赘述。
则本发明的较佳的实施例中,将本次需要执行的所有测试用例对应的所有测试动作按照测试用例被执行的顺序排列形成一测试动作列表,并根据测试设计书执行一个自动测试方法,具体如图2所示,包括:
步骤S1,于动作列表中选择一个测试动作作为当前动作,并将当前动作对应的测试用例作为当前用例进行测试;
步骤S2,将测试过程中系统浏览器中的显示画面的编号,和当前动作对应的测试画面的编号进行比较,以对显示画面进行定位;
步骤S3,于被定位的显示画面中抓取匹配于当前动作的测试控件作为当前控件;
步骤S4,根据当前动作的动作属性,依据对应的操作方法对被抓取的当前控件进行操作,随后输出对应当前动作的操作结果;
步骤S5,将操作结果与对应当前动作的预想结果进行比较,以判断当前动作是否执行成功,将对应的比较结果保存为当前动作的测试结果。
在一个具体实施例中,首先预设一个基础测试用例,并且根据该基础测试用例随机生成多个衍生测试用例。上述基础测试用例可以为使用者预先设定好相关参数的测试用例,上述多个衍生测试用例可以为根据基础测试用例变换随机变换相关参数生成的不同的测试用例。由于是从同一个基础测试用例衍生生成的,因此基础测试用例和衍生测试用例同属于一个测试方案(或者测试项目)中。上述基础测试用例和衍生测试用例均可以被确认为测试用例。
则上述实施例中,将上述基础测试用例和多个衍生测试用例全部填充到测试设计书中,以形成关联于该测试方案(或者测试项目)的测试设计书。具体地,在填充上述测试用例之前,需要先形成上述所有测试用例的一个执行顺序,并且根据上述测试用例的执行顺序调整填充在测试设计书中的测试用例的填充位置。最终形成的测试设计书与一般的设计书不同,其不需要测试人员手动编写测试设计书中的每个测试用例,同样不需要测试人员手动填写每个测试用例的具体参数,从而节省了人力成本。
上述实施例中,测试设计书中的每个测试用例内包括多个测试动作,每个测试动作对应一个测试控件。每个测试控件对应一个测试画面,因此决定每个测试用例对应于多个测试画面。
具体地,上述测试用例是按序预设的,即按照一定的执行顺序预设多个测试用例,一个测试用例执行完毕后就转向执行下一个测试用例。同样地,在同一个测试用例中,不同的测试动作也按序排列,每个测试动作分别对应于一个测试控件,每个测试控件分别对应于一个测试画面。上述测试画面可以被划分为开启画面以及后续画面。对于一个测试用例来说,开启画面只有一个,后续画面可以存在多个,上述开启画面可以为测试用例执行的第一个画面,后续画面为在上述开启画面之后并且依序排列的显示画面。每个测试画面(包括开启画面和后续画面)均为操作一个测试控件所对应的画面。例如对于用户登录这个测试用例而言,其中可以包括输入用户名和密码的测试动作,以及点击登录控件的测试动作。则对应上述登录控件的测试画面可以为提供给使用者可以输入用户名和密码的登录画面,并且该画面可以作为测试用例的开启画面,上述测试用例的多个后续画面可以为登录成功后显示的系统浏览器的其他画面,或者显示登录失败的画面。上述画面依照测试逻辑排序。
上述实施例中,测试用例的设置界面如图3-4所示。该测试用例中的开启画面的名称为“账户信息”,该测试用例的名称为“进入修改账户密码界面”,该测试用例的前期关联测试用例为“进入账户信息界面”,相应地,该测试用例的前期关联测试用例还包括“登录”、“进入系统管理”和“进入账户信息界面”,上述前期关联测试用例依序排列。图2中所示的测试用例的设置界面为可视化界面,并非现有技术中代码级的设置界面,因此可以简化测试用例的设置过程。图4中示出了上述预设的测试用例列表。
上述实施例中,关联于测试用例的测试画面(包括开启画面和后续画面)的设置界面如图5所示。图5中的画面信息中包括画面序号(ID)、画面名称以及画面访问地址。所谓的访问地址是指URL(Uniform Resoure Locator,统一资源定位)地址。上述画面设置界面同样为可视化界面。
上述实施例中,测试动作的设置界面如图6所示,图6中的测试动作可以配置为“嵌入检索条件”,其中关联有多个显示画面的名称、多个控件名称、多个动作属性(方法)以及多个测试动作的赋值等。上述测试动作的设置界面同样为可视化易操作的。
上述实施例中,每个测试动作对应的操作方法可以由动作属性经过一系 列计算得到,而上述动作属性可以由对应的表达式表示。
上述实施例中,将设置完成的关联于不同的测试用例的测试动作形成一个动作列表。具体地,例如按序排列分别设置有测试用例A、B和C,在测试用例A中按序排列分别设置有测试动作A1、A2和A3,在测试用例B中按序排列分别设置有测试动作B1和B2,在测试用例C中按序排列分别设置有测试动作C1、C2、C3和C4,则上述动作列表即可以为按序排列的A1、A2、A3、B1、B2、C1、C2、C3、C4。
上述实施例中,每个测试动作相关联的控件的设置界面如图7所示。在图7中,每个控件的控件信息中包括控件序号(ID)、控件标题、控件类型、控件的前端技术、控件定位用的属性名称、控件定位用的属性值、控件的最大值/最小值/最大长度/最小长度、控件的默认值、控件的正确值列表/错误值列表等。上述控件的设置画面也是可视化画面。
上述实施例中,上述测试用例、测试动作、画面以及控件等的设置均可以依照以下两种方式进行:1)由系统预先设定;2)在系统中预先设定了各测试元素,则使用者可以通过相应的可视化界面选择不同的测试元素并组合形成测试用例、测试动作、画面以及控件等设置信息。
上述实施例中所述的预想结果的设置界面在下文中会详述。
则上述实施例中,针对本次需要执行的所有测试用例,按照不同测试用例的排序,将其中包括的所有测试动作放置在一个动作列表中。
随后,根据上述测试设计书,可以执行一个自动测试方法,该方法如图1所示。上述步骤S1中,首先选择一个测试动作开始执行测试。具体地,针对该测试动作,可以确定相应的测试用例,并将被确定的测试用例作为当前用例开始测试。
上述实施例中,在定位好当前动作和当前用例后,监控浏览器的显示画面的切换状态,找到浏览器当前加载完成的显示画面的画面编号,并将当前动作的测试画面的编号与该显示画面的编号进行对比,即根据当前的显示画面的画面编号去与对应当前动作的测试画面进行匹配,从而将当前浏览器的显示画面定位为当前用例中对应于当前动作的一个测试画面。
上述实施例中,在定位好显示画面后,对显示画面中的显示内容进行分分析,并抓取显示画面中的所有控件的实时信息,根据显示画面中抓取的控 件的相关信息与测试动作对应的控件信息(例如定位用属性)进行匹配,从而可以定位准确的控件,并记录被定位的控件的位置信息。具体地,抓取到显示画面中的一个控件后,将控件的控件属性与当前动作对应的测试控件的控件属性进行匹配并得到匹配结果,并在匹配结果表示匹配成功时将被抓取的控件定位为当前控件。例如,抓取到一个控件后,将该控件与测试动作所对应的测试控件进行比较:若不同,则表示不是当前动作的控件;若相同,则表示是当前动作的控件。随后将匹配成功的控件确认为当前控件。因此,上述定位控件的方式可以包括:首先采用测试动作所对应的测试控件定位到一个测试画面,该测试画面即为当前显示的显示画面。由于在显示画面中可能不仅仅包括一个控件,因此在该显示画面中还需要通过控件属性对比的方式定位到上述测试动作所对应的测试控件,以完成测试控件的定位。
上述实施例中,当定位到测试控件之后,可以根据当前动作的动作属性对该测试控件执行相应的操作,随后当前动作执行完毕,记录对应当前动作的操作结果。
上述实施例中,得到操作结果后,将该操作结果与当前动作对应的预想结果进行比较,以判断当前动作是否操作成功,并记录比较结果。
在上述过程执行完毕后,判断当前动作执行完毕,随后转向下一个测试动作,并返回上述步骤S1。
综上所述,上述实施例中,通过可视化的操作方法,将预先设置测试用例、测试动作、测试控件、测试画面以及预想结果等测试参数的过程变得简单易懂,并且可以便捷地根据这些被设置好的测试参数自动进行可视化的软件测试,能够满足人们的软件测试需求,并且提升了软件测试的效率。
本发明的较佳的实施例中,仍然如图1所示,于测试设计书中对应每个测试动作分别设置一结果值;
于执行步骤S5后,分别将对应于每个测试动作的测试结果填充至对应的结果值中。例如,根据测试结果,在结果值中填入“成功”或者“失败”。
本发明的一个较佳的实施例中,在上述步骤S1中,在执行关联于当前用例的每个测试动作之前,根据测试动作的动作属性判断是否需要打开对应于测试动作的测试控件的测试画面,并在需要时提取关联于测试画面的地址以打开测试画面。具体地,上述实施例中,在执行每个测试动作之前,都需 要判断下是否需要加载该测试动作对应的测试控件的测试画面:若需要,则加载相应的测试画面;若不需要,则不对画面做任何变动。上述实施例中,上述测试画面的提取和加载是通过提取对应控件的对应画面的URL地址实现的。具体地,通过提取对应控件的对应画面相关的URL地址,使用当前用例指定的启动参数,并在浏览器中打开对应的URL地址,以对当前用例进行测试。若当前指定的浏览器已被打开,则只需要通过提取画面相关的URL地址来更新浏览器中的显示画面即可。并且,上述实施例中,所谓测试动作的动作属性,其中可以包括测试动作与其前后顺序的动作之间的关联关系。系统可以通过判断测试动作与其前后动作的关系,然后判断是否需要提取相应的URL地址并打开相应的测试画面。
本发明的另一个较佳的实施例中,上述步骤S1中,在执行关联于当前用例的第一个测试动作时,提取对应于当前用例的第一个测试控件的测试画面作为开启画面,并通过关联于开启画面的地址打开开启画面,以开始对当前用例进行测试。具体地,上述实施例中,只有在执行一个测试用例中的第一个测试动作时,才加载该测试动作对应的测试控件的测试画面,以作为开启画面。具体地,在首次开始测试时,可以选择上述动作列表中的第一个测试动作并开始测试。则选择好测试动作后,将该测试动作作为当前动作,并根据当前动作定位到对应的测试用例,将该测试用例作为当前用例,随后提取该当前动作对应的测试控件对应的测试画面并开始进行测试。上述实施例中,由于首次开始测试时的测试动作为第一个测试动作,则上述被提取的画面应当也为相应的当前用例的开启画面。同样地,加载和提取开启画面的方法与上一个实施例相同,即通过提取开启画面的URL地址并使用当前用例指定的启动参数,在指定的系统浏览器中打开来实现。
本发明的较佳的实施例中,在开始执行上述每个测试用例之前,首先设定该测试用例的初始化数据,即对测试用例的数据进行初始化操作。所谓对数据进行初始化操作,其中可以包括:对数据库中相应的数据做初始化处理,以避免之前的测试数据遗留影响本次测试,又或者在数据库中添加相应的初始化数据,以形成一个测试的初始化测试环境,保证测试开始的环境的统一性等。
因此,在本发明的一个较佳的实施例中,在执行到一个新的测试动作时, 首先需要判断该测试动作是否为某个测试用例的第一个测试动作:若是,则需要对测试用例先进行初始化数据的操作,随后再执行测试动作;若否,则直接执行该测试动作。
又或者,在本发明的另一个较佳的实施例中,对每个测试用例的开启画面进行标记。在测试过程中,当跳转至一个开启画面时,则对相应的测试用例进行初始化数据的操作,随后再执行开启画面对应的测试动作。
本发明的较佳的实施例中,上述步骤S1中,当将测试用例确认为当前用例后提取当前用例的初始化数据,以开始对当前用例进行测试;
提取对应于当前用例的第一个测试控件的测试画面的地址作为开启画面,随后使用当前用例指定的启动参数打开开启画面,并进行测试。
上述实施例中,所谓启动参数,是指打开上述作为开始画面的测试画面的标准网络参数。
本发明的一个较佳的实施例中,上述步骤S2具体包括:获取对应于当前动作的后续的测试动作的测试画面的编号,同时监控显示画面的编号,在显示画面的编号与测试画面的编号一致时,确认显示画面切换成功,以对显示画面进行定位。具体地,上述步骤S2中,若当前的显示画面的编号与当前动作的后续动作对应的测试画面的编号一致,则认为当前的显示画面切换成功,从而将该显示画面定位为当前动作的后续动作的测试画面。
本发明的另一个较佳的实施例中,上述步骤S2具体包括:获取对应于当前动作的后续的测试画面的编号,同时监控显示画面的编号,在显示画面的编号与测试画面的编号一致时,确认显示画面切换成功,以对显示画面进行定位。具体地,上述步骤S2中,若当前的显示画面的编号与当前动作的后续画面的编号一致,则认为当前的显示画面切换成功,从而将该显示画面定位为当前动作的后续画面。
本发明的较佳的实施例中,上述步骤S4中,在对控件进行操作之前,首先判断当前动作的动作属性,并根据动作属性确定对当前控件进行操作:
若当前动作的动作属性为设值,则对当前控件进行的操作为给控件赋值,例如对控件赋予一个预先设定的数值等。
若当前动作的动作属性为执行操作命令,则对当前控件进行的操作为执行操作命令以操作控件,例如操作命令为“点击”,则可以对当前控件执行 点击控件的操作。
若当前动作的动作属性为采用功能键组合的方式进行操作,则通过向系统的输入装置发送对应的功能键组合命令的方式操作当前控件,例如功能键组合为组合输入键盘上的“Shift”按键、“Alt”按键和“Enter”按键,则系统可以向键盘发送相应的功能键组合命令,以通知键盘输出上述三个按键的组合按键指令。
若当前动作的动作属性为发送文字列消息,则操作当前控件发送对应的文字列消息,具体地可以通过浏览器发送对应的文字列消息。
若当前动作的动作属性为内存复制,则将当前控件的赋值保存于系统内存中;具体地,可以将当前控件的赋值或者其他特定值保存到系统内存中,即实现系统内存的“剪贴板”功能。
若当前动作的动作属性为内存赋值,则可以根据当前动作的动作属性,将系统内存中已经保存的值赋到当前控件中。
若当前动作的动作属性为逻辑判断,则可以对内存中保存的值进行判断,并根据判断结果跳过预设的后续的测试动作。具体地,所谓逻辑判断,其为对系统内存中表示赋值的表达式进行判断,例如判断该表达式是否大于/小于某个预设值,或者判断系统内存中保存的值是否为true/false。而上述表示跳过动作的跳过方案可以预设在不同的测试动作的测试属性中。具体的判断过程可以为:判断上述系统内存中保存的数值的表达式,并根据判断结果确定是否需要执行上述预设的跳过方案,来跳过一个或多个后续的测试动作。上述实施例中,上述跳过方案中同样可以不包括任何一个后续动作,即无论判断结果如何,都不需要跳过任何一个后续动作。
本发明的较佳的实施例中,如上文中所述,若当前的画面发生跳转,则可以监控浏览器的显示内容,进而定位到新的画面编号,以及定位到新的测试控件。
本发明的较佳的实施例中,上述步骤S5中,根据操作结果的类型进行操作结果与预想结果之间的比较:
若操作结果为操作显示画面的控件的结果,则系统读取浏览器中的显示画面中包括的对应的控件的信息,并将读取到的信息与预想结果进行比较;具体地,在对控件的信息和预想结果进行比较时,是对一批控件进行统一比 较,例如抓取当前的显示画面中的所有控件对应的信息,并分别与预想结果进行比较。
若操作结果为对应于浏览器中的一栏数据的结果,则系统读取浏览器中对应的一栏数据,并将读取到的信息与预想结果进行比较;
若操作结果为系统的数据库中的数据,则系统读取数据库中的数据,并读取到的信息与预想结果进行比较。
具体地,本发明的较佳的实施例中,上述预想结果预先设置的设置界面如图8-10所示:
图8中示出画面中控件的预想结果,其中可以包括控件的ID,控件标题,预想结果的类型以及预想结果的值。
图9中示出表格类的预想结果,其中可以包括控件ID、控件的标题,预想件数、比较件数以及表格数据等属性。
图10中示出了数据库类的预想结果,其中可以包括检索条件、排序条件、限制条数以及数据等属性。
则本发明的较佳的实施例中:
若为控件比较,则系统读取浏览器中对应控件的信息,并将读取到的信息与预想结果进行比较;
若为一栏数据的比较,则系统读取浏览器中对应的一栏数据,并将读取到的信息与预想结果进行比较;
若为数据库的比较,则系统读取指定的数据库中的数据,并将读取到的信息与预想结果进行比较。
本发明的较佳的实施例中,上述步骤S5中,判断当前动作是否执行成功:
若是,则保存关联于当前动作的操作结果,随后继续执行步骤S5;
若否,则结束当前用例的测试,并跳转至下一个测试用例,随后返回步骤S1。
具体地,本发明的较佳的实施例中:
若当前动作执行成功,则自然跳转到同一个当前用例的下一个测试动作并执行(继续执行步骤S5),同时保存执行成功的操作结果。
若当前动作执行失败,则结束当前用例的测试,并跳转至下一个测试用 例执行(返回步骤S1),在动作列表中即为跳过当前用例对应的后续的测试动作,从下一个测试用例的第一个测试动作重新开始进行测试。
本发明的较佳的实施例中,在一个当前动作的操作结果完成时,可以对浏览器的显示页面(即表示操作结果的页面)进行截图保存,并且在截图中标注出当前动作对应的控件的位置(通过之前的控件定位进行标注)。
本发明的一个较佳的实施例中,上述步骤S5中,将对应的比较结果保存为当前动作的测试结果后,跳转至下一个测试动作:
若跳转至的下一个测试动作表示对全局的控件进行操作,则返回步骤S4。
本发明的一个较佳的实施例中,上述步骤S5中,将对应的比较结果保存为当前动作的测试结果后,跳转至下一个测试动作。
本发明的较佳的实施例中,上述测试设计书生成方法以及相应的自动测试方法可以适用于任何一个主流的软件系统中,这是因为在预设上述测试用例、测试动作、测试控件、测试画面等的数据库中预先保证了主流软件系统中需要用到的驱动方法的实现方式,从而保证了主流软件系统中的动作方法的驱动。
以上所述仅为本发明较佳的实施例,并非因此限制本发明的实施方式及保护范围,对于本领域技术人员而言,应当能够意识到凡运用本发明说明书及图示内容所作出的等同替换和显而易见的变化所得到的方案,均应当包含在本发明的保护范围内。

Claims (14)

  1. 一种测试设计书生成方法,其特征在于,按序预设多个所述测试用例,每个所述测试用例对应于多个按序执行的测试动作,每个所述测试动作对应于一个测试控件,每个所述测试动作对应于一个操作方法,每个所述测试控件对应一个测试画面,每个所述测试动作对应多个预想结果;
    于一测试设计书中分别设置测试用例名称、测试动作名称以及预想结果值;
    根据所述测试用例中关联于用例名称的属性值对所述测试用例名称进行填充;
    根据所述测试动作中关联于动作名称的属性值对所述测试动作名称进行填充;
    分别将关联于每个所述测试动作的所述预想结果填充至对应的所述预想结果值中;
    将经过填充的所述测试设计书显示在一测试设计画面中。
  2. 如权利要求1所述的测试设计书生成方法,其特征在于,于所述测试设计书中对应每个所述测试用例分别设置一初始化数据值;
    分别将对应于每个所述测试用例的初始化数据填充至对应的所述初始化数据值中。
  3. 如权利要求1所述的测试设计书生成方法,其特征在于,根据所述测试设计书,将本次需要执行的所有所述测试用例对应的所有所述测试动作按照所述测试用例被执行的顺序排列形成一测试动作列表,并执行一个自动测试方法,具体包括:
    步骤S1,于所述动作列表中选择一个所述测试动作作为当前动作,并将所述当前动作对应的所述测试用例作为当前用例进行测试;
    步骤S2,将测试过程中系统浏览器中的显示画面的编号,和所述当前动作对应的所述测试画面的编号进行比较,以对所述显示画面进行定位;
    步骤S3,于被定位的所述显示画面中抓取匹配于所述当前动作的所述测试控件作为当前控件;
    步骤S4,根据所述当前动作的动作属性,依据对应的所述操作方法对被 抓取的所述当前控件进行操作,随后输出对应所述当前动作的操作结果;
    步骤S5,将所述操作结果与对应所述当前动作的所述预想结果进行比较,以判断所述当前动作是否执行成功,将对应的比较结果保存为所述当前动作的测试结果。
  4. 如权利要求1所述的测试设计书生成方法,其特征在于,于所述测试设计书中对应每个所述测试动作分别设置一结果值;
    于执行所述步骤S5后,分别将对应于每个所述测试动作的所述测试结果填充至对应的所述结果值中。
  5. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S1中,在执行关联于所述当前用例的第一个所述测试动作时,提取对应于所述当前用例的第一个所述测试控件的所述测试画面作为开启画面,并通过关联于所述开启画面的地址打开所述开启画面,以开始对所述当前用例进行测试。
  6. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S1中,在执行关联于所述当前用例的每个所述测试动作之前,根据所述测试动作的动作属性判断是否需要打开对应于所述测试动作的所述测试控件的所述测试画面,并在需要时提取关联于所述测试画面的地址以打开所述测试画面。
  7. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S1中,当将所述测试用例确认为所述当前用例后提取所述当前用例的初始化数据,对关联于所述当前用例的数据库中的数据进行初始化操作,以开始对所述当前用例进行测试;
    提取对应于所述当前用例的第一个所述测试控件的所述测试画面的地址作为所述开启画面的开启地址,并基于所述开启地址,使用关联于所述当前用例的启动参数开启所述开启画面,以对所述启动画面进行测试。
  8. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S2具体包括:
    获取对应于所述当前动作的后续的所述测试动作的所述测试画面的编号,同时监控所述显示画面的编号,在所述显示画面的编号与所述测试画面的编号一致时,确认所述显示画面切换成功,以对所述显示画面进行定位。
  9. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S2具体包括:
    获取对应于所述当前动作的后续的所述测试画面的编号,同时监控所述显示画面的编号,在所述显示画面的编号与所述测试画面的编号一致时,确认所述显示画面切换成功,以对所述显示画面进行定位。
  10. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S3中,抓取到所述显示画面中的一个所述测试控件后,将所述测试控件的控件属性与所述当前动作对应的所述测试控件的控件属性进行匹配并得到匹配结果,并在所述匹配结果表示匹配成功时将被抓取的所述测试控件定位为所述当前控件。
  11. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S4中,在对所述控件进行操作之前,首先判断所述当前动作的所述动作属性,并根据所述动作属性确定对所述当前控件进行操作:
    若所述当前动作的所述动作属性为设值,则对所述当前控件进行的操作为给所述控件赋值;
    若所述当前动作的所述动作属性为执行操作命令,则对所述当前控件进行的操作为执行所述操作命令以操作所述控件;
    若所述当前动作的所述动作属性为发送文字列消息,则操作所述当前控件发送对应的所述文字列消息;
    若所述当前动作的所述动作属性为内存复制,则将所述当前控件的值保存于系统内存中;
    若所述当前动作的所述动作属性为内存赋值,则将所述当前控件的值更改为所述系统内存中保存的值;
    若所述当前动作的所述动作属性为逻辑判断,则对保存于所述系统内存中用于表示赋值的表达式进行判断,并根据判断结果跳过关联于所述当前动作的预设的后续的所述测试动作;
    若所述当前动作的所述动作属性为采用功能键组合的方式进行操作,则通过向系统的输入装置发送对应的功能键组合命令的方式操作所述当前控件。
  12. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤 S5中,根据所述操作结果的类型进行所述操作结果与所述预想结果之间的比较:
    若所述操作结果为操作所述显示画面中包括的所述控件的结果,则系统读取所述浏览器中的所述显示画面对应的所述控件的信息,并将读取到的信息与所述预想结果进行比较;
    若所述操作结果为对应于所述浏览器中的一栏数据的结果,则系统读取所述浏览器中对应的所述一栏数据,并将读取到的信息与所述预想结果进行比较;
    若所述操作结果为系统的数据库中的数据,则系统读取所述数据库中的数据,并读取到的信息与所述预想结果进行比较。
  13. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S5中,判断所述当前动作是否执行成功:
    若是,则保存关联于所述当前动作的所述操作结果,随后继续执行所述步骤S5;
    若否,则结束所述当前用例的测试,并跳转至下一个所述测试用例,随后返回所述步骤S1。
  14. 如权利要求3所述的测试设计书生成方法,其特征在于,所述步骤S5中,将对应的比较结果保存为所述当前动作的测试结果后,跳转至下一个所述测试动作:
    若跳转至的下一个所述测试动作表示对全局的控件进行操作,则返回所述步骤S4。
PCT/CN2017/098688 2016-08-26 2017-08-23 一种测试设计书生成方法 WO2018036530A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019531515A JP2019525372A (ja) 2016-08-26 2017-08-23 テスト設計書の生成方法

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610735499.XA CN106407105B (zh) 2016-08-26 2016-08-26 一种测试设计书生成方法
CN201610735499.X 2016-08-26

Publications (1)

Publication Number Publication Date
WO2018036530A1 true WO2018036530A1 (zh) 2018-03-01

Family

ID=58005314

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/098688 WO2018036530A1 (zh) 2016-08-26 2017-08-23 一种测试设计书生成方法

Country Status (3)

Country Link
JP (1) JP2019525372A (zh)
CN (1) CN106407105B (zh)
WO (1) WO2018036530A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407105B (zh) * 2016-08-26 2019-02-01 上海合福信息科技有限公司 一种测试设计书生成方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1744056A (zh) * 2004-09-04 2006-03-08 华为技术有限公司 一种应用程序的自动测试方法
CN101604286A (zh) * 2008-06-11 2009-12-16 中兴通讯股份有限公司 一种关键字驱动表格生成方法
US9021442B2 (en) * 2013-02-13 2015-04-28 Sap Se Dynamic scenario testing of web application
CN106407105A (zh) * 2016-08-26 2017-02-15 上海合福信息科技有限公司 一种测试设计书生成方法

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7058857B2 (en) * 2001-10-10 2006-06-06 International Business Machines Corporation Method and system for testing a software product
JP4148527B2 (ja) * 2006-06-05 2008-09-10 インターナショナル・ビジネス・マシーンズ・コーポレーション 機能テスト・スクリプト生成装置
JP4899971B2 (ja) * 2007-03-27 2012-03-21 富士通株式会社 テスト仕様書作成プログラム、テスト仕様書作成装置、およびテスト仕様書作成方法
CN101339534B (zh) * 2008-06-17 2010-10-13 金蝶软件(中国)有限公司 一种软件测试的方法及装置
JP2011060052A (ja) * 2009-09-11 2011-03-24 Mitsubishi Electric Corp ソフトウェア試験実行方法
JP2012038162A (ja) * 2010-08-09 2012-02-23 Ricoh Co Ltd 自動テストツール・プログラム及び自動テスト方法
CN103186457A (zh) * 2011-12-29 2013-07-03 阿里巴巴集团控股有限公司 一种自动生成测试用例的方法和装置
CN102710833B (zh) * 2012-05-03 2015-07-08 广东欧珀移动通信有限公司 一种手机测试用例及其自动生成方法
US9710366B2 (en) * 2013-01-29 2017-07-18 Hewlett Packard Enterprise Development Lp Generating test code to test executable code
CN103631720B (zh) * 2013-12-20 2016-08-17 百度在线网络技术(北京)有限公司 测试用例的生成方法和装置
CN104794050B (zh) * 2014-01-21 2018-09-18 腾讯科技(深圳)有限公司 应用程序的测试方法、装置及系统
JP6417791B2 (ja) * 2014-08-27 2018-11-07 日本電気株式会社 アプリケーションテスト支援装置、そのデータ処理方法、およびプログラム

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1744056A (zh) * 2004-09-04 2006-03-08 华为技术有限公司 一种应用程序的自动测试方法
CN101604286A (zh) * 2008-06-11 2009-12-16 中兴通讯股份有限公司 一种关键字驱动表格生成方法
US9021442B2 (en) * 2013-02-13 2015-04-28 Sap Se Dynamic scenario testing of web application
CN106407105A (zh) * 2016-08-26 2017-02-15 上海合福信息科技有限公司 一种测试设计书生成方法

Also Published As

Publication number Publication date
CN106407105A (zh) 2017-02-15
CN106407105B (zh) 2019-02-01
JP2019525372A (ja) 2019-09-05

Similar Documents

Publication Publication Date Title
WO2018036531A1 (zh) 一种测试用例生成方法
WO2018036529A1 (zh) 一种可视化测试报告生成方法
CN104679658B (zh) Web页面的测试方法和系统
US20160283353A1 (en) Automated software testing
US8839107B2 (en) Context based script generation
US9898396B2 (en) Automated software testing and validation via graphical user interface
CN105843734A (zh) 一种自动化测试方法、装置及计算设备
JP2016048471A (ja) アプリケーション開発支援装置、そのデータ処理方法、およびプログラム
CN107450953B (zh) 一种更新bios的方法及装置
WO2018036528A1 (zh) 一种自动测试方法
CN114489625A (zh) 将json格式文本转换为可视化配置工具的方法和装置
WO2018036530A1 (zh) 一种测试设计书生成方法
CN110543429A (zh) 测试用例调试方法、装置及存储介质
JP2011039786A (ja) ソフトウェアテスト支援装置、ソフトウェアテスト支援方法、及びプログラム
CN115599490B (zh) 一种bios设置方法、系统、存储介质及设备
CN111143205B (zh) 一种面向安卓平台的测试用例自动化生成方法及生成系统
WO2020248504A1 (zh) 学生平板的状态指示方法、装置、学生平板及存储介质
JP4941674B2 (ja) シミュレーション・システム
KR20100056338A (ko) 재활용도를 높일 수 있는 gui 테스트 자동화 시스템 및 그 방법
US10430309B2 (en) Duplicating a task sequence from a graphical user interface interaction for a development application in view of trace data
JP2009223568A (ja) シナリオ生成装置及びプログラム
CN114936152A (zh) 应用测试方法及设备
CN101727384B (zh) 自动测试一应用软件的控件的方法
CN114115826A (zh) 代码生成方法、终端及可读存储介质
CN113326193A (zh) 一种小程序测试方法及装置

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: 17842952

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019531515

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17842952

Country of ref document: EP

Kind code of ref document: A1