According to some embodiments, a method and apparatus are provided to receive browser automation code to automatically test a software application executed in a web browser and receive a first parameter to indicate a first type of web browser and a second parameter to indicate a second type of web browser. The browser automation code is executed in the first type of web browser and the browser automation code is executed in the second type of web browser.
|
1. A method to automate software testing without changing browser automation code, the method comprising:
receiving browser automation code to automatically test a software application executed in a web browser, the browser automation code comprising computer code that defines a specific sequence of events for testing the software application;
receiving a first parameter to indicate a first type of web browser;
executing, via a processor, the browser automation code in the first type of web browser via a framework comprising one or more object classes that interfaces between the browser automation code and the first type of web browser by emulating binaries associated with the first type of web browser based on the received first parameter, where executing the browser automation code in the first type of web browser comprises creating, via the one or more object classes, a first browser specific runtime environment to communicate between the emulated binaries and the browser automation code, and where the browser automation code executed in the first type of web browser is the received browser automation code;
receiving a second parameter to indicate a second type of web browser; and
executing the browser automation code in the second type of web browser via the framework that interfaces between the browser automation code and the second type of web browser by emulating binaries associated with the second type of web browser based on the received second parameter where the browser automation code executed in the second type of web browser is the received browser automation code, where executing the browser automation code in the second type of web browser comprises creating, via the one or more object classes, a second browser specific runtime environment to communicate between the emulated binaries and the browser automation code.
6. A non-transitory computer-readable medium comprising instructions that when executed by a processor perform a method to automate software testing without changing browser automation code, the method comprising:
receiving browser automation code to automatically test a software application executed in a web browser, the browser automation code comprising computer code that defines a specific sequence of events for testing the software application;
receiving a first parameter to indicate a first type of web browser;
executing, via a processor, the browser automation code in the first type of web browser via a framework comprising one or more object classes that interfaces between the browser automation code and the first type of web browser by emulating binaries associated with the first type of web browser based on the received first parameter, where executing the browser automation code in the first type of web browser comprises creating, via the one or more object classes, a first browser specific runtime environment to communicate between the emulated binaries and the browser automation code, and where the browser automation code executed in the first type of web browser is the received browser automation code;
executing the browser automation code in the second type of web browser via the framework that interfaces between the browser automation code and the second type of web browser by emulating binaries associated with the second type of web browser based on the received second parameter where the browser automation code executed in the second type of web browser is the received browser automation code, where executing the browser automation code in the second type of web browser comprises creating, via the one or more object classes, a second browser specific runtime environment to communicate between the emulated binaries and the browser automation code.
12. An apparatus comprising:
a processor; and
a non-transitory computer-readable medium comprising instructions that when executed by a processor perform a method to automate software testing without changing browser automation code, the method comprising:
receiving browser automation code to automatically test a software application executed in a web browser, the browser automation code comprising computer code that defines a specific sequence of events for testing the software application;
receiving a first parameter to indicate a first type of web;
executing, via the processor, the browser automation code in the first type of web browser via a framework comprising one or more object classes that interfaces between the browser automation code and the first type of web browser by emulating binaries associated with the first type of web browser based on the received first parameter, where executing the browser automation code in the first type of web browser comprises creating, via the one or more object classes, a first browser specific runtime environment to communicate between the emulated binaries and the browser automation code, and where the browser automation code executed in the first type of web browser is the received browser automation code;
executing the browser automation code in the second type of web browser via the framework that interfaces between the browser automation code and the second type of web browser by emulating binaries associated with the second type of web browser based on the received second parameter where the browser automation code executed in the second type of web browser is the received browser automation code, where executing the browser automation code in the second type of web browser comprises creating, via the one or more object classes, a second browser specific runtime environment to communicate between the emulated binaries and the browser automation code.
2. The method of
3. The method of
4. The method of
5. The method of
7. The medium of
8. The medium of
9. The medium of
10. The medium of
11. The medium of
13. The apparatus of
14. The apparatus of
15. The apparatus of
16. The apparatus of
17. The apparatus of
18. The apparatus of
|
Many software applications function as web-based applications which are accessed via a web browser such as, for example, Internet Explorer, Chrome, Firefox, and Safari. To test a web-based application using multiple web browsers, test automation is frequently used. Test automation, in this case, refers to using a software tool to run repeatable tests against a web-based application. A number of open source tools are available for test automation. Selenium, for example, is an open source test automation tool.
However, to run the same tests using a plurality of web browsers, the test automation tool must rely on specific testing code that is developed for each specific type of web browser. For example, a first version of the testing software will be needed to test a web-based application on a Chrome web browser and a second version of the testing software will be needed to test the web-based application on an Internet Explorer web browser. Having multiple platform-based versions of testing software makes it difficult to maintain the testing software since the testing software has to be maintained for each specific web browser.
The present embodiments relate to a test automation framework that provides developers with an ability to execute a same test on different web browsers, desktops and mobile devices without modifying their testing software. Automated tests may be executed on desktop or mobile browsers like Internet Explorer, Firefox, Chrome, as well as browsers for mobile devices such as an iPad, iPhone, an Android phone or an Android tablet. In some embodiments, the framework may function as a framework over a Selenium automation tool.
Referring now to
At 110, browser automation code to automatically test a software application executed in a web browser is received. The browser automation code may comprise code that defines a specific sequence of events to test a web based application. For example, the browser automation code may define a sequence of radio buttons or check boxes to use, forms to be filled out (and the associated data for said forms) and/or sequences of text to be input. The browser automation code may be associated with an open source automation tool used for test automation such as, but not limited to, Selenium's open source automation tool.
For illustrative purposes, and to aid in understanding features of the specification, an example will be introduced. This example is not intended to limit the scope of the claims. Now referring to
Referring back to
At 130, the browser automation code is executed in the first type of web browser. The browser automation code may be executed via a processor. Since each web browser may require different binaries (e.g., browser specific binaries) in order for the browser automation code to execute, the browser automation code may interface with a framework to communicate with the first type of web browser. The framework may be based on an object-oriented computer programming language such as, for example Java.
In practice, the framework may receive the first parameter and second parameter and based on each received parameter, drivers and/or binaries that are associated with a specific type of web browser may be emulated. For example, the framework may use an object class or classes to emulate binaries for Internet Explorer or an object class or classes to emulate binaries for Chrome. In this way, the browser automation code used for testing is never changed or modified to interface with different types of web browsers.
For example, the following example driver factory class may create drivers for different web browser such as, but not limited to, Android, iPhone, iPad, Internet Explorer, Firefox, Safari, and Chrome.
public class DriverFactory {
private enum Browsers { ANDROID, IPHONE, IPAD,
INTERNETEXPLORER, FIREFOX, SAFARI, CHROME}
public static final String FIREFOX_PROFILE_KEY = “FirefoxProfile”;
public static RemoteWebDriver getDriver(DesiredCapabilities
desiredCapabilities) throws Exception {
RemoteWebDriver driver = null;
String browserName = (String)
desiredCapabilities.getCapability(CapabilityType.BROWSER_NAME);
switch
(Browsers.valueOf(browserName.toUpperCase( ).replaceAll(“\\s+”, “”)))
{
case ANDROID:
driver = new AndroidDriver(getDriverRemoteAccess( ),
desiredCapabilities);
break;
case IPHONE:
case IPAD:
driver = new IPhoneDriver(getDriverRemoteAccess( ));
break;
case INTERNETEXPLORER:
driver = new InternetExplorerDriver(desiredCapabilities);
break;
case FIREFOX:
if(desiredCapabilities.getCapability(FIREFOX_PROFILE_KEY) != null)
driver = new FirefoxDriver((FirefoxProfile)
desiredCapabilities.getCapability(FIREFOX_PROFILE_KEY));
else
driver = new FirefoxDriver(desiredCapabilities);
break;
case SAFARI:
driver = new SafariDriver(desiredCapabilities);
break;
case CHROME:
driver = new ChromeDriver( );
break;
}
return driver;
}
public static DesiredCapabilities getDesiredCapabilities(String
driverEnvironment) {
DesiredCapabilities desiredCapabilities = null;
switch (Browsers.valueOf(driverEnvironment.toUpperCase( )))
{
case ANDROID:
desiredCapabilities = DesiredCapabilities.android( );
break;
case IPHONE:
desiredCapabilities = DesiredCapabilities.iphone( );
break;
case IPAD:
desiredCapabilities = DesiredCapabilities.ipad( );
break;
case INTERNETEXPLORER:
desiredCapabilities = DesiredCapabilities.internetExplorer( );
break;
case FIREFOX:
desiredCapabilities = DesiredCapabilities.firefox( );
break;
case SAFARI:
desiredCapabilities = DesiredCapabilities.safari( );
break;
case CHROME:
desiredCapabilities = DesiredCapabilities.chrome( );
}
return desiredCapabilities;
}
private static URL getDriverRemoteAccess( ) throws Exception {
URL url = CommonUtils.buildUrl(Environment.getDriverProtocol( ),
Environment.getDriverIP( ), null,
Environment.getDriverPort( ), Environment.getDriverPath( ), null, null);
return url;
}
}
Therefore, based on a type of browser and/or platform associated with the first parameter and the second parameter, drivers and/or binaries that are associated with the specific type of web browser may be emulated. Continuing with the above example, browser automation code is executed in a Chrome web browser.
The object classes may also create a runtime environment that the framework 202 may use to communicate between the created drivers and/or binaries and the browser automation code 203. An example of an object class to create a browser specific runtime environment is disclosed below.
public class Environment {
private static final String DRIVER_BROWSER_NAME = “Driver.Browser_Name”;
private static final String EXTERNALLY_CONFIGURED_BROWSER_NAME =
“system”;
private static String ENVIRONMENT_FILE_WIN = “\\Automation\\Test-
Parameters\\Environment.properties”;
private static String ENVIRONMENT_FILE_MAC = “/Automation/Test-
Parameters/Environment.properties”;
private static Properties environment = new Properties( );
private static final String INTERNET_EXPLORER = “internetexplorer”;
private static final String FIREFOX = “firefox”;
private static boolean propertiesFileExists = true;
static {
String userHome = System.getProperty(“user.home”);
FileInputStream in = null;
try {
if(isWindowsOS( ))
in = new FileInputStream(userHome +
ENVIRONMENT_FILE_WIN);
else if(isMacOS( ))
in = new FileInputStream(userHome +
ENVIRONMENT_FILE_MAC);
else
propertiesFileExists = false;
environment.load(in);
} catch (FileNotFoundException e) {
propertiesFileExists = false;
} catch (IOException e) {
e.printStackTrace( );
} finally {
if(in!=null) {
try {
in.close( );
} catch (IOException e) {
e.printStackTrace( );
}
}
}
}
public static String getOSName( ) {
return System.getProperty(“os.name”);
}
public static boolean isWindowsOS( ) {
return getOSName( ).toLowerCase( ).indexOf(“win”) >= 0;
}
public static boolean isMacOS( ) {
return getOSName( ).toLowerCase( ).indexOf(“mac”) >= 0;
}
public static String getParameter(String key) {
String param = System.getProperty(key);
if(param != null)
return param;
return environment.getProperty(key);
}
public static String getEnvironmentBrowserName( ) {
return System.getProperty(“browser”, null);
}
public static boolean isPropertiesFileConfiguration( ) {
return propertiesFileExists;
}
public static String getBrowserName( ) {
String browserName = getParameter(DRIVER_BROWSER_NAME);
if(browserName==null ||
browserName.equalsIgnoreCase(EXTERNALLY_CONFIGURED_BROWSER_NAME))
{
browserName = System.getProperty(“browser”, isMacOS( ) ?
FIREFOX : (isWindowsOS( ) ? INTERNET_EXPLORER : null));
}
return browserName;
}
public static String getDriverProtocol( ) {
return getParameter(“Driver.Remote.Protocol”);
}
public static String getDriverIP( ) {
return getParameter(“Driver.Remote.Host”);
}
public static String getDriverPort( ) {
return getParameter(“Driver.Remote.Port”);
}
public static String getDriverPath( ) {
return getParameter(“Driver.Remote.Path”);
}
public static String getAutProtocol( ) {
return getParameter(“Aut.Protocol”);
}
public static String getAutHost( ) {
return getParameter(“Aut.Host”);
}
public static String getAutDomain( ) {
return getParameter(“Aut.Domain”);
}
public static String getAutPort( ) {
return getParameter(“Aut.Port”);
}
public static String getAutPath( ) {
return getParameter(“Aut.Path”);
}
}
Next, at 140, the browser automation code is executed in the second type of web browser. Continuing with the above example, browser automation code is executed in an Internet Explorer web browser.
Now referring to
Now referring to
The apparatus 400 may comprise a storage device 401, a medium 402, a processor 403, and memory 404. According to some embodiments, the apparatus 400 may further comprise a digital display port, such as a port adapted to be coupled to a digital computer monitor, television, portable display screen, or the like.
The medium 402 may comprise any computer-readable medium that may store processor-executable instructions to be executed by the processor 403. For example, the medium 402 may comprise a non-transitory tangible medium such as, but not limited to, a compact disk, a digital video disk, flash memory, optical storage, random access memory, read only memory, or magnetic media.
A program may be stored on the medium 402 in a compressed, uncompiled and/or encrypted format. The program may furthermore include other program elements, such as an operating system, a database management system, and/or device drivers used by the processor 403 to interface with peripheral devices.
The processor 403 may include or otherwise be associated with dedicated registers, stacks, queues, etc. that are used to execute program code and/or one or more of these elements may be shared there between. In some embodiments, the processor 403 may comprise an integrated circuit. In some embodiments, the processor 403 may comprise circuitry to perform a method such as, but not limited to, the method described with respect to
The processor 403 communicates with the storage device 401. The storage device 401 may comprise any appropriate information storage device, including combinations of magnetic storage devices (e.g., a hard disk drive), optical storage devices, flash drives, and/or semiconductor memory devices. The storage device 401 stores a program for controlling the processor 403. The processor 403 performs instructions of the program, and thereby operates in accordance with any of the embodiments described herein.
The main memory 404 may comprise any type of memory for storing data, such as, but not limited to, a flash driver, a Secure Digital (SD) card, a micro SD card, a Single Data Rate Random Access Memory (SDR-RAM), a Double Data Rate Random Access Memory (DDR-RAM), or a Programmable Read Only Memory (PROM). The main memory 404 may comprise a plurality of memory modules.
As used herein, information may be “received” by or “transmitted” to, for example: (i) the apparatus 400 from another device; or (ii) a software application or module within the apparatus 400 from another software application, module, or any other source.
In some embodiments, the storage device 401 stores a database (e.g., including information associated with web browser binaries). Note that the database described herein is only an example, and additional and/or different information may be stored therein. Moreover, various databases might be split or combined in accordance with any of the embodiments described herein.
Embodiments have been described herein solely for the purpose of illustration. Persons skilled in the art will recognize from this description that embodiments are not limited to those described, but may be practiced with modifications and alterations limited only by the spirit and scope of the appended claims.
Hristov, Georgi, Sudkovich, Alex, Saar, Asaf, Sreerangaraju, Sreevatsa
Patent | Priority | Assignee | Title |
11205041, | Aug 15 2019 | Anil, Kumar | Web element rediscovery system and method |
11769003, | Aug 15 2019 | Anil, Kumar | Web element rediscovery system and method |
9575873, | Sep 13 2013 | SAP SE | Software testing system and method |
Patent | Priority | Assignee | Title |
6889158, | Jun 30 2003 | CALLAHAN CELLULAR L L C | Test execution framework for automated software testing |
7694181, | Dec 12 2005 | HITACHI DATA SYSTEMS CORPORATION | Automated software testing framework |
7930683, | Mar 31 2006 | SAP SE | Test automation method for software programs |
8065661, | Aug 29 2006 | SAP SE | Test engine |
8311794, | May 04 2007 | SAP SE | Testing executable logic |
8347267, | Jul 27 2001 | SmarteSoft, Inc. | Automated software testing and validation system |
8428900, | Sep 16 2010 | Universal quality assurance automation framework | |
8458666, | Oct 22 2008 | Oracle International Corporation | Methods and systems for implementing a test automation framework for testing software applications on UNIX/LINUX based machines |
8700763, | May 19 2008 | Citrix Systems, Inc | Systems and methods for automatically testing an application |
20020116153, | |||
20070220341, | |||
20080086499, | |||
20110283148, | |||
20120174075, | |||
20120198422, | |||
20120246619, | |||
20130007522, | |||
20130145250, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Jun 27 2013 | HRISTOV, GEORGI | SAP AG | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 030799 | /0773 | |
Jun 28 2013 | SAAR, ASAF | SAP AG | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 030799 | /0773 | |
Jun 28 2013 | SREERANGARAJU, SREEVATSA | SAP AG | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 030799 | /0773 | |
Jun 30 2013 | SUDKOVICH, ALEX | SAP AG | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 030799 | /0773 | |
Jul 15 2013 | SAP SE | (assignment on the face of the patent) | / | |||
Jul 07 2014 | SAP AG | SAP SE | CHANGE OF NAME SEE DOCUMENT FOR DETAILS | 033625 | /0223 | |
May 19 2016 | SAP SE | SAP Portals Israel Ltd | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 038685 | /0173 |
Date | Maintenance Fee Events |
Oct 17 2016 | ASPN: Payor Number Assigned. |
Dec 11 2019 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Dec 13 2023 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Date | Maintenance Schedule |
Jun 21 2019 | 4 years fee payment window open |
Dec 21 2019 | 6 months grace period start (w surcharge) |
Jun 21 2020 | patent expiry (for year 4) |
Jun 21 2022 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jun 21 2023 | 8 years fee payment window open |
Dec 21 2023 | 6 months grace period start (w surcharge) |
Jun 21 2024 | patent expiry (for year 8) |
Jun 21 2026 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jun 21 2027 | 12 years fee payment window open |
Dec 21 2027 | 6 months grace period start (w surcharge) |
Jun 21 2028 | patent expiry (for year 12) |
Jun 21 2030 | 2 years to revive unintentionally abandoned end. (for year 12) |