Wednesday, September 28, 2016

Selenium 3.0 Beta is here and it takes a leap!!

When Selenium 2.0 was released in July 2011, it was a major leap from Selenium 1.0 (or Selenium Remote Control “RC”). It was the merger of RC and WebDriver projects and as we saw it was just the name Selenium that was retained and pretty much everything was updated to WebDriver API. Also, that release came with the announcement that the support to RC would be “soon” dropped. And then we heard the similar announcements in various Selenium conferences that RC will be dropped that year, it did’t happen though. I presume that was due to large number legacy RC user base out there. For the last six years users were advised to switch to the newer WebDriver APIs and to stop using the original RC APIs.
Now that day has at last come when the RC support has been completely dropped in Selenium 3.0.

Selenium 3 is Selenium 2 without Selenium 1.
Other major changes is for the Firefox driver.  So far Selenium has been giving preferred treatment to Firefox, there was no need to use any browser drivers like for Google Chrome, IE, Opera, Safari (previously).  Firefox always ran right out of the box, not anymore…  We now need to use Geckodriver to run Firefox marionette implementation.
Other than this there are some major changes that you should be aware of as below:
  • You’ll need to be running Java 8 to use the Java pieces of Selenium. Get it here
  • Support for Firefox is via Mozilla’s geckodriver. Get it here
  • Support for Safari is provided on macOS (Sierra or later) via Apple’s own safaridriver. Get ithere
  • Support for Edge is provided by Microsoft through their webdriver server. Get it here
  • Only versions 9 or above of IE are supported. Earlier versions may work, but are no longer supported as Microsoft no longer supports them. Remember you need to have thesesettings for IE.
Our team has been doing testing of the Selenium 3.0 beta and found inconsistencies with Firefox 49 beta version, it works find on previous versions for Firefox.  I presume this might be the same old Selenium catching up with latest version of Firefox browser.  It might be good idea to stay with one version below the latest Firefox and keep latest Selenium Jar files.
We also plan to make a big announcement on this occasion which is related to CP-SAT and CP-SAT Advanced certification roadmap and all the testers out there who want to become expect in Selenium.  Please watch out this space for more.

Wednesday, April 22, 2015

ATDD Mobile Test Automation - Integration of FitNesse with Appium - Part 1

FitNesse is a collaboration tool, some Agile enthusiasts use this tool to facilitate ATDD (Acceptance Test Driven Development) or BDD (Behaviour Driven Development).  Compared to Cucumber where the focus is on the behavioral aspect, here we also get inclined towards the test data framework.

Appium is the premier open-source tool for mobile testing.  Here is my video on integrating FitNesse with Appium.



FitNesse can be downloaded from this link --> http://www.fitnesse.org/FitNesseDownload

The prerequisite for Appium project are as below:

  • Install Android SDK
  • Install Node.js
  • Install Appium
  • Install Appium Java Client
  • Configure Appium in Eclipse (preferably maven project)
FitNesse server can be started using following command:
java -jar fitnesse-standalone.jar -p 9090

where -p gives which port to start the server.

Configure the project in eclipse with FitNesse and Appium dependencies and run the mobile test.  More details on Eclipse setup in part 2.

Tuesday, April 21, 2015

BDD Mobile Test Automation - Integration of Cucumber with Appium

Behavior Driven Development (BDD) is very popular with many Agilists out there, specially those focused on Testing. However my view is that BDD is not about Test Automation, it is about collaboration so that the expected behavior of the application can be determined. Cucumber happens to be the tool of choice to implement BDD.  While doing this for web applications, we can drive the features through WebDriver.

Lately the application development has been inclined towards mobile apps and we need to extend our exiting BDD frameworks to handle app, be it Android, iOS or Win Mobile.

Appium is a neat tool for anyone who has exposure to WebDriver, irrespective of that also it is an excellent tool for mobile testing.

Here is my video of running Appium tests for android app using Cucumber.




You can create the Maven project using the following POM.xml:

<?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?>
<project xmlns=&amp;quot;http://maven.apache.org/POM/4.0.0&amp;quot;
xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;
xsi:schemaLocation=&amp;quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&amp;quot;>
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>LATEST</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.0.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.0.14</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>


The code for JUnit test runner is as below:


1:  package com.qaagility.atacalc;
2:  import cucumber.api.CucumberOptions;
3:  import cucumber.api.junit.Cucumber;
4:  import org.junit.runner.RunWith;
5:  @RunWith(Cucumber.class)
6:  @CucumberOptions(format ="pretty", tags={"@only"}, features = "test/resources/ATA_Calc.feature", monochrome=true)
7:  public class TestRunner {
8:  }


Saturday, August 10, 2013

STIQ

http://www.qatestingtools.com/sourceforge/storytestiq

Wednesday, August 7, 2013

Selenium 2.34 is released

https://code.google.com/p/selenium/downloads/list

Wednesday, April 18, 2012

Grid2 RemoteWebdriver

public class FlipkartBackedGrid2 extends SeleneseTestCase {
private Selenium selenium;
@Parameters({"browser","port"})
@BeforeClass
public void beforeClass(String browser,String port){
DesiredCapabilities capability= new DesiredCapabilities();

capability.setBrowserName(browser);

try {
WebDriver driver= new RemoteWebDriver(new URL("http://localhost:".concat(port).concat("/wd/hub")), capability);
selenium = new WebDriverBackedSelenium(driver, "http://www.flipkart.com");
} catch (MalformedURLException e) {

e.printStackTrace();
}
}

Wednesday, March 7, 2012

IE/Chrome Driver code in Selenium 2.x

private WebDriver driver;

@Before
public void setUp() throws Exception {

DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
      ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
driver  = new InternetExplorerDriver(ieCapabilities);
}

--------------------


System.setProperty("webdriver.chrome.driver", "C:\\ChromeDriver\\chromedriver_win_19.0.1068.0\\chromedriver.exe");

driver = new ChromeDriver();

Sunday, September 25, 2011

Adding Main() to JUnit to run from command prompt

//package com.example.tests;

import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
import junit.framework.*;

public class GE_TC1 extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.ge.com/", "*firefox");
}
public void testGE_TC1() throws Exception {
selenium.open("http://www.ge.com/");
// Search for any word
selenium.type("textToSearch", "energy efficient");
// This is just a comment
selenium.click("searchSubmit");
selenium.waitForPageToLoad("30000");
assertEquals("GE: Search Results", selenium.getTitle());
assertTrue(selenium.isTextPresent("energy efficient"));
}
public static Test suite() {
//method added
return new TestSuite(GE_TC1.class);
}
public void tearDown(){
//Added . Will be called when the test will complete
selenium.stop();
}
public static void main(String args[]) {
// Added. Execution will started from here.
junit.textui.TestRunner.run(suite());
}
}

Sunday, July 24, 2011

Hover Menus

Create a test case with the following steps:
1.Open http://www.annauniv.edu/
2.Click on the Link ‘Departments’
3.From the ‘Faculty of Civil Engineering’ menu, choose ‘Institute for Ocean Management’
4.New page opens, verify for the correct page
5.From the ‘Research Themes’ menu, choose ‘Coastal Pollution Monitoring and Hazards’
6.New page opens, verify for the correct page.

Saturday, July 23, 2011

Screen capture ex

1.Go to the below URL:http://maps.google.com/maps
2.Type or Cut and Paste the below Address:

90 Hamilton Street, Cambridge, MA-02139

1.Verify the Text Present Lim Consultants Inc
3.Click on the Lim Consultants Inclink
4.VerifyText Present “limconsultants.com” on the right side inline popup window.
5.AssertText “Lim Consultants Inc” present within the inline popup window.
6.Stop the Recoding in Selenium IDE
7.Capture the screen at the start and end of Test
8.Save and view the screen shots

Sunday, July 10, 2011

DDT CSS

css=html.yui3-js-enabled body div.page-content-wrapper section.page-content div#SearchResults-1.SearchResults ul.result-set li#search-result0.result div.main section p.title a.subtle span.name

DDT CSS

css=html.yui3-js-enabled body div.page-content-wrapper section.page-content div#SearchResults-1.SearchResults ul.result-set li#search-result0.result div.main section p.title a.subtle span.name

Shutdown RC from browser

http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

Sunday, June 5, 2011

Download Selenium RC 1.0.3

The most stable version of Selenium RC is available at:

http://code.google.com/p/selenium/downloads/list

Saturday, June 4, 2011

IDE Exercises

Ex-1
Open a specific URL (www.amazon.com)
Select “Books” under Search Select List
Search for a specific text (“Java”) in #1 page
Sort by “Prize: Low to high”
Check whether the windows title matches “Amazon.com: Java: Books”
Check whether the result set contains “Java” text
Click the link #2
Check whether the result set contains “Java” text

Wednesday, June 1, 2011

Selenium IDE 1.0.11 released

Selenium IDE

Selenium IDE is the a Firefox plugin that does record-and-playback of interactions with the browser. Use this to either script simple scripts, or to speed up creation of Selenium RC or Selenium Webdriver scripts.

Download version 1.0.11 released on 30/May/2011 or view the Release Notes

http://seleniumhq.org/download/

Saturday, April 30, 2011

DDT Code

//Data Driven Test Framework using Selenium and TestNG
//This Test performs search for the movie and looks for the attributes on the result page
//Data is read from the Excel SS - imdb_data1.xls
package script;

import com.thoughtworks.selenium.*;

//import org.junit.AfterClass;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.*;

import java.io.File;
import jxl.*;

public class dataProviderExample extends SeleneseTestCase{

@BeforeClass
public void setUp() throws Exception {
SeleniumServer seleniumserver=new SeleniumServer();
seleniumserver.boot();
seleniumserver.start();
setUp("http://www.imdb.com/", "*firefox");
selenium.open("/");
selenium.windowMaximize();
selenium.windowFocus();
}

@DataProvider(name = "DP1")
public Object[][] createData1() {
Object[][] retObjArr=getTableArray("test\\resources\\data\\imdb_data1.xls",
"DataPool", "imdbTestData1");
return(retObjArr);
}


@Test (dataProvider = "DP1")
public void testDataProviderExample(String movieTitle,
String directorName, String moviePlot, String actorName) throws Exception {
//enter the movie title
selenium.type("q", movieTitle);
//they keep switching the go button to keep the bots away
if (selenium.isElementPresent("nb15go_image"))
selenium.click("nb15go_image");
else
selenium.click("xpath=/descendant::button[@type='submit']");
selenium.waitForPageToLoad("30000");

//click on the movie title in the search result page
selenium.click("xpath=/descendant::a[text()='"+movieTitle+"']");
selenium.waitForPageToLoad("30000");
//verify director name is present in the movie details page
verifyTrue(selenium.isTextPresent(directorName));
//verify movie plot is present in the movie details page
verifyTrue(selenium.isTextPresent(moviePlot));
//verify movie actor name is present in the movie details page
verifyTrue(selenium.isTextPresent(actorName));
}

@AfterClass
public void tearDown(){
selenium.close();
selenium.stop();
}

public String[][] getTableArray(String xlFilePath, String sheetName, String tableName){
String[][] tabArray=null;
try{
Workbook workbook = Workbook.getWorkbook(new File(xlFilePath));
Sheet sheet = workbook.getSheet(sheetName);
int startRow,startCol, endRow, endCol,ci,cj;
Cell tableStart=sheet.findCell(tableName);
startRow=tableStart.getRow();
startCol=tableStart.getColumn();

Cell tableEnd= sheet.findCell(tableName, startCol+1,startRow+1, 100, 64000, false);

endRow=tableEnd.getRow();
endCol=tableEnd.getColumn();

System.out.println("startRow="+startRow+", endRow="+endRow+", " +
"startCol="+startCol+", endCol="+endCol);
tabArray=new String[endRow-startRow-1][endCol-startCol-1];
ci=0;

for (int i=startRow+1;i<endRow;i++,ci++){
cj=0;
for (int j=startCol+1;j<endCol;j++,cj++){
tabArray[ci][cj]=sheet.getCell(j,i).getContents();
}
}
}
catch (Exception e) {
System.out.println("error in getTableArray()");
}

return(tabArray);
}

}//end of class

Sunday, April 24, 2011

Android Apps Testing Tool-kit

Playing around with idea to develop a testing tool-kit for Android. With so many applications being built, there is a dire need to shorten the time to market. That is the main reason, most of the applications available in the market either crash or do not meet user expectation. It is apparent that the quality is veiong sacrificed in order to mee the deadlines. To ensure that the Android apps are delivered with quality and also in time, there is a need for a testing framework that can check on the quality of apps on certain standard parameters as below:

1. Installation testing:
Tester’s need to focus on installation & uninstallation of the app. User will install the app through Market place, but since the app is not in market place testers can use the app installer from marketplace for installation tests.

2. Requirement (Functionality) Testing:
Test for the application functionality according to designed test cases.

3. Widget testing:
Test the widget by adding widget, using widget as per functionality i.e. music widget should play music, deleting widget.

4. Phone Interrupt testing:
Test the application behavior on phone call, SMS & other notifications.

5. Stress testing (monkey test):
There is a command in android where it generates series of events at different frequencies.
Make sure your app passes this monkey test

6. UI testing:
Testing for UI can be done to verify that the app meets standard guidelines.

Refer the link below:
http://developer.android.com/guide/practices/ui_guidelines/index.html

7. Compatibility Test:
Developers do the unit testing on the emulators. Testers need to test on actual environment i.e. devices. There are multiple devices of different resolutions & having various OS i.e. Android 1.5, 1.6. 2.1 & 2.2. We need to check for compatibility on maximum devices.

Tuesday, April 12, 2011

Android App Testing



Robotium

Robotium is java based (jar) and can be run through Eclipse IDE.

Robotium officially supports Android 1.6 and up.

For more information on features of this Apache open-source tool, please click on the above link.

Sunday, April 10, 2011

Test

1. What does SIDE stand for?


2. What is a GPL (General Public License)?


3. What are main components of the Selenium Toot-kit?


4. I installed Selenium IDE from Internet Explorer and then installed Firefox browser. Would it work, please explain?


5. What is the use of “Clipboard Format” in IDE?


6. What is the use of “Find” button on IDE?


7. What is difference between “assert” and “verify” commands?


8. What must one set within SIDE in order to run a test from the beginning to a certain point within the test?


9. What does a right-pointing green triangle with one line at the commands icons in IDE indicate?


10. What distinguishes between an absolute and relative URL in SIDE?


11. When ran as part of the whole Test the command runs fine but when I run it through the option "Execute this command X" in IDE then it fails, why?


12. How would one access a Selenium variable named "Vcount" from within a JavaScript snippet?


13. How would one access a Javacsript Stored Variable named "vStored" from within a JavaScript snippet?


14. What Selenese command can be used to display the value of a variable in the log file, which can be very valuable for debugging?


15. If one wanted to display the value of a variable named “Vanswer” in the log file, what would the first argument to the previous command look like?


16. Where did the name "Selenium" come from?


17. Which command(s) can be used to check that an alert with a particular message popped up?


18. What command simulates selecting the browser's Back button?


19. Why do you use the ‘click’ command at times and then the ‘clickAndWait’ command at others? What’s the difference?


20. If the Test Case frame contains several test cases, how can one execute just the selected one of those test cases?


21. What is the generic name for an argument (to a Selenese command) which starts with //?


22. How can I change sequence of Test Cases in my Test Suite?


23. How can I change sequence of commands in my Test Case?


24. What is the oddity associated with testing an alert?


25. How can one get IDE to always record an absolute URL for the open command's argument?



26. What are the benefits of using Integrated Development Env like Eclipse?


27. What is the use of importing libraries in the Java code?


28. What is Bromine?


29. What is Selenium GRID?


30. What is the price of Selenium license per server?


31. What is the minimum programming knowledge required to test using Selenium IDE?


32. What programming languages can you use in RC?


33. If you have an application to test which was developed in PHP, can you use Java programming language Test Scripts in RC to test it?