Please post your Web Driver questions in official Web Driver forum

Thursday, July 18, 2013

Java Training Tutorials for Software Testing Engineers

UPDATES: Java training tutorial with flavor of Selenium Webdriver are live now :)

The boundaries between software testing and development are beginning to blur in today’s technological environment. Knowledge of programming language would not just help you gain more knowledge in the field of software testing but also makes you more competitive in today’s job market.
When I started with Selenium Training Tutorial, I assumed that every one is from programming background. Many of you have asked me that it is very difficult for you to learn Selenium without knowledge of a programming language.
Hence I decided to create video tutorial in java, especially designed for software test engineers. Those software test engineers who have little or no programming experience. Learning one programming language would almost always make it easy for you to learn any other language.
But there is one condition :)

I would begin with java training tutorials when Software Testing forum on Facebook reaches 2000 likes. and ONLY YOU can help me achieve this -


It would be impossible to reach this target without your help. Please share 
FaceBook Testing Forum with software test Engineers on your Facebook/LinkedIn/Twitter/<Other Social Media Networks>. At the time of writing this post. There are about 300 likes on testing forum. Reaching more “likes” will help me take training program to more users free of cost.
While we are on the journey to reach 2000 likes I will continue to create testing videos in other fields of software testing.
So would you help me reach 2k likes for FaceBook Testing Forum ?

Sunday, July 14, 2013

8th Selenium Training Video - Jenkins Marries Selenium

I have uploaded 8th Selenium Training Videos on my You Tube Channel.
This session covers -
  • Introduction to jenkins
  • Download and Install jenkins
  • Set up free style project to find version of java
  • Set up Selenium project for jenkins (Sample project from 7th Selenium training session) -

Monday, July 8, 2013

Installing Selenium Tests Framework

Installing STF -

To begin with STF you can clone seleniumtests project. It is a sample project which uses STF maven dependency and demonstrate it's feature.
If you want to try STF in your own project then please add following dependency to your project -

<dependency>
   <groupId>com.seleniumtests</groupId>
   <artifactId>seleniumtestsframework</artifactId>
   <version>4.0</version> 
</dependency>

Please refer maven central repo for latest version of STF jar

Once cloned and imported, project would look as - 





which means that you need to install seleniumtestsframework to your .m2 folder. 
You can install seleniumtestsframework using following maven command - 

mvn install:install-file -Dfile=C:\Users\testingforum\Desktop\seleniumtestsframework-1.0.jar -DgroupId=com.seleniumtests -DartifactId=seleniumtestsframework -Dversion=1.0 -Dpackaging=jar

Here -
C:\Users\testingforum\Desktop\seleniumtestsframework-1.0.jar 
is the location of seleniumtestsframework-1.0.jar on my system. Update this location with location of jar in your system 

If installation goes right then seleniumtestsframework would be installed in your .m2 repository - 




When there is a new version of seleniumtestsframework is released you should update <version>1.0</version>  in your pom.xml file and install latest seleniumtestsframework.jar 

Have a look at all src file in project and understand how tests use seleniumtestsframework. 
You can execute test either from testng.xml file available in project or using
mvn test
 command from command line 

One test execution is over then following test result report would open in FF browser - 



Stuck with Something? Have a question on STF? Please post it in 
testing forum 

Saturday, July 6, 2013

5 minutes guides to using Selenium Tests Framework

The best way to learn to write tests using STF is is to use sample STF project, but in a gist – 

• Each test class should extend SeleniumTestPlan Class. SeleniumTestPlan class sets context of test i.e. browser environment etc 

/**
 * Tests valid and invalid login use cases for Test Link
 *
*/
public class TestLinkLoginTest extends SeleniumTestPlan


• Each page object should extend PageObject class. Refer Page Object Description for more on this. PageObject class provides methods for interaction with page like – launching URL, selecting frame, waiting for element availability etc 

/**
 * Defines service for TestLink login page
 * 
*/
public class TestLinkLoginPage extends PageObject {

page object would contain the page element of page. i.e. – Textbox, Dropdown etc – 

    private static LinkElement seleniumTrainingLink = new LinkElement("Selenium Training LinkElement", By.linkText("Free Selenium Training"));
    private static TextFieldElement loginTextBox = new TextFieldElement("Login Text Box", By.id("login"));

If you want to launch application URL then you should create page object for a page with Boolean parameter true else you can just create page object without any parameter. In the former case you can use appURL defined in testng.xml to launch application or have your own mechanism of launching URL. You can see it's example in sample project

page object would encapsulate page operations in page object methods. i.e. - 


/**
     * Logging in with valid credentials direct user to home page
     *
     * @param user
     * @return
     * @throws Exception
*/
public AdminHomePage loginAsValidUser(User user) throws Exception {
        loginTextBox.clear();
        loginTextBox.sendKeys(user.getUserID());
        passwordTextBox.clear();
        passwordTextBox.sendKeys(user.getPassword());
        loginButton.submit();
        return new AdminHomePage();
}

• For data driven tests define you test data object. Following example defines User object – 

/**
 * User account for TestLink
 */
public class User {

    private String userID;
    private String password;

    public String getUserID() {
        return userID;
    }

   public String getPassword() {
        return password;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}

Now define your test data in a CSV. CSV file would contain Test method details and test data details. i.e. 

TestEntity.TestCaseId,TestEntity.TestMethod,TestEntity.TestTitle,User.UserID,User.Password
testcaseid1,loginAsInvalidUser,loginAsInvalidUser,wronguserid,wrongpassword
testcaseid2,loginAsValidUser,loginAsValidUser,admin,admin

Herein loginAsInvalidUser and loginAsValidUser are two test methods and each test method is run for one set of test data. 
To run same test method with different data set, define corresponding data sets for method in csv file – 

TestEntity.TestCaseId,TestEntity.TestMethod,TestEntity.TestTitle,User.UserID,User.Password
testcaseid1,loginAsInvalidUser,loginAsInvalidUser,wronguserid1,wrongpassword1
testcaseid2,loginAsInvalidUser,loginAsInvalidUser,wronguserid2,wrongpassword2

Define the data provider method and consumer in your class – 

@DataProvider(name = "loginData", parallel = true)
    public static Iterator<Object[]> getUserInfo(Method m,
                                                 ITestContext testContext) throws Exception {
      // Some magic here 
    }

/**
     * Logs in to TestLink as valid user
     *
     * @param testObject
     * @param user
     * @throws Exception
     */
    @Test(groups = {"loginTestSuccess"}, dataProvider = "loginData",
            description = "Logs in to TestLink as admin")
    public void loginTestSuccess(TestEntity testEntity, final User user)
            throws Exception {

        new TestLinkLoginPage(true)
                .loginAsValidUser(user)
                .verifyDocumentationDropDown();
    }


And not just this, there are many more features described in sample test project of STF. 
Enough of "Gyan"? Want install Selenium Tests Framework and try sample project which uses STF? 

Friday, July 5, 2013

STF Test Report Snapshots

Here are few selenium test report snapshots from STF -







Now is the time to watch  5 minutes guide to using STF :)


Thursday, July 4, 2013

Announcing Selenium Tests Automation Framework

Selenium Tests Framework (referred as STF from here on) is a test automation framework for automated testing of Desktop web, mobile site and mobile apps. STF is based on WebDriver, Appium, TestNG and Maven. STF source code is available on GitHub.



Please NOTICE that if you are new to selenium then you should first watch Java Training Video Tutorials and Selenium Training Video Tutorials

STF supports following features - 

• Supports running tests on following environments - 

IE, Firefox, Chrome browsers on Windows, Ubuntu and Mac

mobile web site tests on android and ios devices

mobile app tests on android and ios devices


• Awesome Test Reports with step by step details of test actions -





    • Self instantiation of most popular browsers i.e. - Firefox, chrome and IE testing, you need not set up chrome or IE server, our framework does it for you. Self serve instantiation of web browsers, hence you don't have to set up browser  yourself. STF takes care of all.  Plugin STF and start writing you tests from day one! 


  • Capture snapshot and html source on test failure (because snapshot and html sources adds in debugging test failures)


    • Retrying failed test (because test environment inconsistency is not new to us and we want to make sure if a test fails consistently)

   • Data driven tests using csv file and more complex run time data objects using TestNG (because we don't want to run tests with same data set time and again)


   • Soft Asserting the failures to continue with test execution even in the wake of failures

   • Selenium grid support (don't we love cloud)


  • Rerun only failed tests using testng failed xml file once an application defect is fixed
  • Test dependency using testng dependent method because integration tests are at times dependent on one another

  
Selenium Tests Framework Tutorials -

Have a question on STF or a feature suggestion ? Then please post it in testing forum 

Fork me on GitHub