Saturday, 12 September 2015

Selenium Integration with Jenkins

#thebuddhatree #Selenium #WebDriver #Maven #Jenkins

The Problem
Running your Selenium project from CI tools like Jenkins.

A Solution
In order to integrate Selenium project with Jenkins, you need to manually configure Jenkins job. Let's step through how to do it and make sure it's working.

An Example 
Install Maven in Eclipse, after that create a Maven project for your Selenium. To do that 
  1. Open Eclipse
  2. Create a Maven project
  3. Update POM.XML file with required dependency
  4. Write your Selenium WebDriver code
  5. Make sure code is running
  6. Follow below given steps 

Manorama Yearbook 2015 (Book & CD)
Step 1


Step 2



Step 3



Step 4



Step 5



Step 6




Expected Behavior
Scion of Ikshvaku (1st Part in Ram Chandra Series)
When you build your project from Jenkins, here is what will happen -

  • Build is created & Success message is displayed
Conclusion
Keep in mind that your Maven project should be running successful from local machine.

Note - If any doubt/query/suggestion, pls post in forum - Testing Forum

Happy Learning!




SeleniumFramework - A simple web testing framework based on open source technology Selenium WebDriver, TestNG, Java, Apache POI

#Selenium #WebDriver #Maven #TestNG #Framework #POI #Jenkins

This framework is designed to help you get started with Web testing quickly, to grow as needed, and to avoid common pitfalls. it just allows you to manipulate browser.
Who Will Cry When You Die?

Main features:
  • Provides browser automation using Selenium WebDriver
  • Page Object Model is used to design pattern to create Object Repository for web UI elements.
  •  Running test case against multiple set of test data
  • Automation Suite Configuration using Java properties file
  • TestNG.xml file which provides feature to run selective test suite
  • Screenshot capturing capability for failed test scenario (Take screenshots on demand and save on disk.)
  • Uses Apache logger for generating test execution logs
  • Build Tool : Maven
  • Programming language: Java
  • Test Data Management: data stored in Excel worksheet : Apache POI
  • Parallel Execution : Using Selenium Grid to run simultaneous test execution
  • CI Integration : Integrated with Jenkins
  • Exceptions handling : Using Java try/Catch exception handling feature
  • Reports : Custom html reports are generated and available in test-output folder

To download Framework, visit link - Download Here

Note - If any doubt/query/suggestion, pls post in forum - Testing Forum

Sunday, 6 September 2015

How to Verify the limit of characters of a textbox

If you already know the char limit, then input the text which is more than the permissible limit. For example if max char limit is 30 then send a text with 31 char length and then fetch the text and count the number of character. It should be 30.

Code example is here which is written considering the limit is 30 char :- 

//Data input should be more than 30 chars
driver.findElement(By.id("textfield1")).sendKeys("Testexample1Testexample2Testexa");

//get count of string length
int actualLimit =driver.findElement(By.id("textfield1")).getText().length();

//Assertion
assertEquals(actualLimit, 30);

Saturday, 5 September 2015

Selenium WebDriver : An Overview of Exception Class

List of exception classes in Selenium package (which is "org.openqa.selenium"), which we see as error on daily basis.
  1. ConnectionClosedException
  2. ErrorHandler.UnknownServerException
  3. ImeActivationFailedException
  4. ImeNotAvailableException
  5. InvalidCookieDomainException
  6. InvalidCoordinatesException
  7. InvalidElementStateException
  8. JsonException
  9. MoveTargetOutOfBoundsException
  10. NotFoundException 
  11. ScreenshotException
  12. SessionNotCreatedException 
  13. SessionNotFoundException
  14. StaleElementReferenceException
  15. TimeoutException
  16. UnableToCreateProfileException 
  17. UnableToSetCookieException
  18. UnexpectedTagNameException
  19. UnhandledAlertException 
  20. UnreachableBrowserException
  21. UnsupportedCommandException
  22. WindowsRegistryException

Sunday, 16 August 2015

Java : Reverse a String

Wings of Fire: An Autobiography

Code to reverse string is as follows -

public class StringReverse {

  public static void main(String[] args) {

      String original, reverse =""; // declare two string variable

      original = "Sample String"; //String to be reversed

      int length = original.length(); //find length of string

      for ( int i = length - 1 ; i >= 0 ; i-- )

         reverse = reverse + original.charAt(i); //charAt returns one char at a time & assign to reverse 

      System.out.println("Reverse is :- "+reverse); //print reverse of string

  }
}