Please post your Web Driver questions in official Web Driver forum

Sunday, December 22, 2013

Git Branching

If you use Git version control system then following commands may come handy for creating new branch for selenium tests -

Create new branch and commit tests/features to branch – 

git checkout –b <branchname>

Work on branch and commit

git commit –m “developed awesome feature” 

Merge branch to your local master

git checkout master

pull if remote master is updated and then merge the branch

git pull

If you want to avoid creation of merge commit then rebase else merge and push to remote master

git pull --rebase
 
git merge <branchname>
 
git push

Once done with branch then delete it

git branch –d <branchname>

If you want local branch to be pushed to git so that more than one committer could work on it

git push -u origin <branchname>
If origin does not have a <branchname>, then it is created on the fly. The -u tells git that you want to be able to easily push and pull changes to that branch in the future. This is needed when multiple committers are working on same branch
Now you can commit changes to remote local branch.

If another committer wants to use the <branchname>

git fetch origin
 
git checkout --track origin/<branchname>

The first command updates repository with the changes from the remote repository. The second command creates a local branch  that matches the origin/plugin branch and tells git that new committer wants to be able to easily push and pull from the branch on GitHub.

Deleting branch locally and from git 

git branch –d <branchname>
 
git push origin --delete <branch name>

In case there are conflicts when merging branch to master

  • Resolve conflicts manually
  • git commit
The commit message would be like this “””Merge branch 'branch name’””” and the push -
  • git push

Sunday, August 25, 2013

Manual Test Case Design Techniques

This is the next training video in the series of "Back to Basics". Being bombarded with automation tools we often forget that it is manual testing which finds most number of defects in application Here is a VIDEO TUTORIAL on Black box test design techniques. The video covers following topics -


  • Equivalence class partitioning
  • Boundary Value Analysis
  • Decision Table Testing
  • State Transition Testing
If you find this video educational then please share it on FB/Google+ etc
There would be a second video on White Box Test Design Techniques, so stay tuned :)

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


Fork me on GitHub