System, method, and computer program for automating manually written test cases

As described herein, a system, method, and computer program are provided for automating manually written test cases. In use, a web scraper is used to scrape an application to be tested, wherein the scraping identifies elements of the application. Additionally, a repository is used to store an indication of the elements of the application identified from the scraping of the application. Further, a test case manually written for the application is accessed. One or more of the elements of the application indicated in the repository that are impacted by the manually written test case are then determined. Still yet one or more of the preconfigured test functions that correspond with the one or more of the elements of the application are selected from a library of preconfigured test functions. Moreover, the manually written test case is automated, to form an automated test case, using the selected one or more of the preconfigured test functions.

FIELD OF THE INVENTION

The present invention relates to automating tests for software.

BACKGROUND

Testing is a common phase in software application development, and is generally used prior to distribution of the software in order to ensure that a developed software application executes without errors, failures, etc. Initially, testing was performed in an entirely manual manner, with a user interacting with the software application in accordance with some pre-planned test cases to validate operation of the software application for those test cases. As time has progressed, many techniques have been developed to automate testing in order to improve the testing speed, thoroughness, and accuracy.

One technique for test automation involves converting manually written test cases into automated tests that can be performed on a software application in an automated manner (e.g. without manual intervention). However, to date, the processes used for this type of test case conversion have been limited. For example, users are still typically required to manually write at least a portion of the automated tests, which is time consuming and prone to error.

SUMMARY

As described herein, a system, method, and computer program are provided for automating manually written test cases. In use, a web scraper is used to scrape an application to be tested, wherein the scraping identifies elements of the application. Additionally, a repository is used to store an indication of the elements of the application identified from the scraping of the application. Further, a test case manually written for the application is accessed. One or more of the elements of the application indicated in the repository that are impacted by the manually written test case are then determined. Still yet, one or more of the preconfigured test functions that correspond with the one or more of the elements of the application are selected from a library of preconfigured test functions. Moreover, the manually written test case is automated, to form an automated test case, using the selected one or more of the preconfigured test functions.

DETAILED DESCRIPTION

FIG. 1illustrates a method100for automating manually written test cases, in accordance with one embodiment. The method100may be carried out by any system that includes at least one processor. For example, the method100may be carried using the computer system described below with reference toFIG. 5.

As shown in operation102, a web scraper is used to scrape an application to be tested, wherein the scraping identifies elements of the application. The application is any computer code that performs one or more functions. Thus, the code of the application may be scraped to identify the elements of the application. The scraping may enable all elements of the application to be identified.

In one embodiment, the application may be a web-based application. To this end, the application may include one or more web pages. In this embodiment, the web pages of the application may be scraped for the elements of the application.

The elements of the application may be any components, building blocks, etc. of the application. For example, the elements of the application may be visual elements of the application, such as input fields of the application (e.g. included in the web pages) that are utilized for receiving user input during execution of the application, tables output by the application, etc. As another example, the elements of the application may include data structures created and used during execution of the application.

Additionally, in operation104, a repository is used to store an indication of the elements of the application identified from the scraping of the application. The indication may include any other information associated with each element. For example, for each element, the repository may store a name of the element, a type of the element, a functionality of the element, a web page on which the element was identified, etc.

Further, in operation106, a test case manually written for the application is accessed. The test case may be set of steps to be performed for testing at least one aspect of the application. In one example, the test case may correspond to input fields of the application and may involve steps to enter input in the input fields of the application.

The test case may be manually written by a user (e.g. tester, developer, support engineer) in a user interface (e.g. of a testing platform, such as that described below with reference toFIG. 2). As an option, the test case may be manually written by the user as free text. To this end, the test case may be written in any format desired by the user.

In one embodiment, the manually written test case may be accessed responsive to creation of the manually written test case by the user. For example, the manually written test case may be accessed when the user selects an option on the above mentioned user interface to “save” or “upload” the manually written test case. In another embodiment, the manually written test case may be accessed as a part of a batch process, in which case all test cases manually written for the application and saved/uploaded by the user may be accessed for automating such test cases.

In operation108, one or more of the elements of the application indicated in the repository that are impacted by the manually written test case are determined. The elements of the application that are impacted by the manually written test case (i.e. the impacted elements) may be those elements involved in the steps of the test case.

In one embodiment, the elements of the application that are impacted by the manually written test case may be determined using natural language processing (NPL). For example, NPL may be performed on the manually written test case to determine which of the elements in the repository are impacted by the manually written test case. Optionally, the NPL may identify names or other indicators of the elements that are impacted by the manually written test case, and those identified names or other indicators may be matched to the element indicators stored on the repository, in order to identify the exact elements of the application that are impacted by the manually written test case.

Still yet, in operation110, one or more of the preconfigured test functions that correspond with the impacted elements of the application are selected from a library of preconfigured test functions. The test functions refer to functions that, when executed, perform one or more operations to test functionality of an application, such as providing input to an input field, initiating the generation of a table or report, etc.

The library of preconfigured test functions may be any library (storage) having preconfigured (i.e. pre-written) test functions. The preconfigured test functions may be specific to the application, in one embodiment. In another embodiment, the preconfigured test functions may be common test functions which are generic to any number of different applications (i.e. can be generically applied to testing of any application).

In one embodiment, the information stored in the repository for the impacted elements may be used to select the corresponding preconfigured test functions. For example, a description and/or type of each impacted element may be matched to information in the library describing preconfigured test functions. Any desired matching algorithm may be used.

In another embodiment, a machine learning algorithm may be used to select the preconfigured test functions that correspond to the impacted elements. The machine learning algorithm may be trained to be able to infer which of the test functions in the library correspond to certain application elements (e.g. elements associated with the application to be tested or other applications). For example, the impacted elements may be input to the machine learning algorithm, and the machine learning algorithm may process the impacted elements to select, from the library, the preconfigured test functions that correspond with the impacted elements. In any case, this selection operation may be performed automatically (i.e. without user intervention).

Moreover, in operation112, the manually written test case is automated, to form an automated test case, using the selected one or more of the preconfigured test functions. The automated test case may be a test script, in one embodiment. In another embodiment, the manually written test case may be automated by integrating the selected preconfigured test functions into the test script. The integration may be performed based on the manually written test case itself (e.g. a sequence of the steps included in the manually written test) and/or based on dependencies or other rules predefined for preconfigured test functions included in the library.

In this way, the automated test case may be automatically generated for the manually written test case, without requiring user input beyond the initial input of the manually written test case. The method100described above may increase the speed at which manually written test cases are converted to automated test cases, by automating the conversion process and avoiding manual processing. The method100described above may also provide consistent results, including reducing error otherwise potentially introduced in a manual conversion process.

In further embodiments to the method100described above, the automated test case may be stored (e.g. an automated test case repository). For example, the automated test case may be stored in association with an indicator of the application, such that the automated test case may be accessed for each instance of testing the application. In another embodiment, the automated test case may be executed to test the application. In a further embodiment, results of the execution of the automated test case may be output (e.g. in a user interface).

It should be noted that the method100may be applied to any number of different manually written test cases for the application, in order to provide automation of those various different manually written test cases. As an option, a scheduler may then be utilized to schedule execution of the automated test case (e.g. in connection with any of the other automated test cases).

In yet another embodiment, for any detected change made to the application (e.g. code change, etc.), the scraping in operation102and the storing in operation104may be repeated. This may allow the repository of application elements to be updated responsive to any application changes (e.g. updated to store new application elements newly included in the application, remove old application elements no longer included in the application, etc.). In turn, manually written test cases may be correlated with current elements of the application, to ensure that the automated test cases provided by the method100correctly apply to the current state (i.e. elements) of the application.

FIG. 2illustrates a system200for automating manually written test cases, in accordance with one embodiment. As an option, the system200may be implemented in the context of the details of the previous figure and/or any subsequent figure(s). For example, the system200may carry out the method100ofFIG. 1. The system200may be a computer system or combination of computer systems, as desired. The system200may be located in the cloud, for automating manually written test cases for applications stored on other computer systems. Of course, however, the system200may be implemented in the context of any desired environment. Further, the aforementioned definitions may equally apply to the description below.

As shown, the system200includes a testing platform202that automates manually written test cases. While not shown, it should be noted that the system200may also include one or more applications to be tested, which may or may not be remotely stored with respect to the testing platform202.

The testing platform202includes a web scraper204(e.g. written in Python) that scrapes an application to be tested to identify elements of the application. The testing platform202then stores, in an application element repository206(e.g. written in Selenium), an indication of the elements of the application identified from the scraping. The application element repository206may be specific to the application, in one embodiment. As an option, the web scraper204may be prompted to scrape the application periodically, to update the application element repository206with any changes made to elements included in the application. As another option, the web scraper204may be prompted to scrape the application after each change made to the application (e.g. as detected by a monitoring module of the testing platform202or a component separate from the testing platform202), in order to ensure that the application element repository206remains up-to-date with current elements included in the application.

The testing platform202includes at least one user interface208. In one embodiment, a test case manually written for the application is received through the user interface208. The user interface208may allow a user to input the test case as free text, in one embodiment. The user interface208may allow the user to “save” or “upload” the manually written test case to the testing platform202. While not shown, it should be noted that the testing platform202may include a repository for storing manually written test cases.

The testing platform202also includes a test function library210. The test function library210stores preconfigured test functions. The preconfigured test functions may be common to various applications, or may even store test functions specific to the application to be tested.

Further, the testing platform202includes a conversion module212. The conversion module212may be a software application or other segment of code that automates the manually written test case to form an automated test case. The conversion module212accesses the manually written test case, determines elements in the application element repository206that are impacted by the manually written test case, selects preconfigured test functions from the test function library210which correspond with the impacted elements, and then automates the manually written test case using the selected preconfigured test functions. The conversion module212may include a machine learning algorithm to select the preconfigured test functions, in one embodiment. In another embodiment, the conversion module212may include rules for integrating the selected preconfigured test functions to form the automated test case.

The testing platform202includes an automated test case repository214for storing the automated test case and any other automated test cases similarly generated for the application. As an option (not shown), the testing platform202may also include a test execution module which executes the automated test cases to test the application, and which reports results of the testing. A scheduler (not shown) of the testing platform202, or as part of the test execution module, may also be used to schedule execution of the automated test cases. In one embodiment, the user interface208may be used to output the results of the testing to the user or any other user of the testing platform202. As another option, the testing platform202may output the automated test cases to a separate test execution platform or application for use in testing the application.

FIG. 3illustrates a block diagram of a flow for automating manually written test cases, in accordance with one embodiment. The flow may be carried out by the testing platform202ofFIG. 2, in one embodiment. Of course, however, the flow may be carried out in the context of any desired environment. Further, the aforementioned definitions may equally apply to the description below.

As shown, test steps are manually entered in a user interface for generating a manually written test case to be used for testing an application. In the present example shown, the manually entered test steps relate to entering input in input fields of the application. The user interface also includes an option (i.e. selectable button) for adding more test steps, as desired.

Further, the user interface includes an option for uploading the manually written test case entered in the user interface. In another embodiment, as shown, a user interface may be provided for allowing a user to import a test case manually written in a separate file/document. In either case, the test case may be manually written as free text.

Once uploaded, the user may select an option to create an automated test case (i.e. script) for the manually written test case. In another embodiment, the automated test case may be automatically created responsive to uploading of the manually written test case. The example shown illustrates a portion of code for a possible automated test case. In the embodiment shown, the code of the created automated test case may be presented in a user interface for viewing by the user.

The user interface presenting the automated test case code includes an option to download (i.e. save) the automated test case. This user interface also includes an option to configure the automated test case for execution on a server (i.e. to test the application). This configuration may relate to a test environment in which the automated test case is to be run. The test environment may relate to a hardware environment in which the automated test case is to be run, a software environment in which the automated test case is to be run, etc. The user interface further includes an option to run the automated test case (e.g. within the configured test environment).

FIG. 4illustrates a network architecture400, in accordance with one possible embodiment. As shown, at least one network402is provided. In the context of the present network architecture400, the network402may take any form including, but not limited to a telecommunications network, a local area network (LAN), a wireless network, a wide area network (WAN) such as the Internet, peer-to-peer network, cable network, etc. While only one network is shown, it should be understood that two or more similar or different networks402may be provided.

Coupled to the network402is a plurality of devices. For example, a server computer404and an end user computer406may be coupled to the network402for communication purposes. Such end user computer406may include a desktop computer, lap-top computer, and/or any other type of logic. Still yet, various other devices may be coupled to the network402including a personal digital assistant (PDA) device408, a mobile phone device410, a television412, etc.

FIG. 5illustrates an exemplary system500, in accordance with one embodiment. As an option, the system500may be implemented in the context of any of the devices of the network architecture400ofFIG. 4. Of course, the system500may be implemented in any desired environment.

As shown, a system500is provided including at least one central processor501which is connected to a communication bus502. The system500also includes main memory504[e.g. random access memory (RAM), etc.]. The system500also includes a graphics processor506and a display508.

The system500may also include a secondary storage510. The secondary storage510includes, for example, solid state drive (SSD), flash memory, a removable storage drive, etc. The removable storage drive reads from and/or writes to a removable storage unit in a well-known manner.

Computer programs, or computer control logic algorithms, may be stored in the main memory504, the secondary storage510, and/or any other memory, for that matter. Such computer programs, when executed, enable the system500to perform various functions (as set forth above, for example). Memory504, storage510and/or any other storage are possible examples of non-transitory computer-readable media.

The system500may also include one or more communication modules512. The communication module512may be operable to facilitate communication between the system500and one or more networks, and/or with one or more devices through a variety of possible standard or proprietary communication protocols (e.g. via Bluetooth, Near Field Communication (NFC), Cellular communication, etc.).