Archive for the ‘Automation’ Category

  • Verified that the link takes you to the page it said it would.
  • Ensure to have no orphan pages (a page that has no links, on buttons, tabs
  • etc to it)
  • Ensure that all referenced links or email addresses must be hyperlinked.
  • Check all mailto links and whether it reaches properly
  • Ensure that all the data’s inside combo/list box must be arranged in chronological order.
  • Check the maximum field lengths to ensure that there should not any truncated characters.
  • Assure that leap years are validated correctly & do not cause errors/miscalculations.
  • Include value zero in all calculations.
  • Assure that upper and lower values in ranges are handled correctly. (Using BVA)
  • Each field should get highlighted when the cursor is in that field.
  • Default values on page load/reload (Also terms and conditions should be disabled)
  • Ensure that division by zero does not occur.
  • Navigation should work correctly with the input methods offered by the device.
  • An application for a touch device should use touch interaction to navigate all functions/screens of the application, e.g. tapping buttons, navigating lists etc.
  • Ensure that all interactive elements such as buttons must respond to touch interaction on first use. It must not be difficult to touch an interactive element, such as a button, link, image, etc.
  • Checks weather all requirements and checkpoints are covered.
  • Give multiple inputs (Text inputs) at a time and the app should work according to that.
  • Check the app weather it syncs with native functionalities.
  • Whether checks for optional and mandatory fields carried out like a mandatory field should not be left blank and an optional should allow the user to skip the field.
  • Closing of the application should result in “Are you sure?” message.(Depends upon app)
  • Verify if the application continuous from the same place after minimizing and restarting it.
  • Ensure that home page of an app should be loaded quickly within 8 seconds.
  • If the device is tilted from portrait mode to landscape mode and vice versa, the app should self adjust as per the device resolution (condition: if the application supports both landscape and portrait modes).
  • If the device is tilted from portrait mode to landscape mode, the screen should display an error message asking the user to switch the device back to landscape mode or the screen resolution should not change (condition: if the application supports only portrait mode)
  • If the device is tilted from landscape mode to portrait mode, the screen should display an error message asking the user to switch the device back to portrait mode or the screen resolution should not change (condition: if the application supports only landscape mode)
  • Verify the functionality for the Background music [If any]
    • When music running in the background of the App/game
    • App goes into idle mode
    • When app comes from the idle mode

Expected behavior: Background music should be running.

  • When the Application uses network capabilities, it must be able to handle network delays and any loss of connection.
    Launch the Application.
    Start the network access from the Application.
    Put the phone in a place where there connection will be lost.
    Observe the result.
    Expected behavior: The Application will work until time out and then give an error message to the user indicating there was an error with the connection.
  • When the Application uses network capabilities, it must be able to handle the device being in Airplane mode.
    Set the device to Airplane mode
    Start the Application.
    Observe the result.
    Expected behavior: The Application will give a meaningful error message to indicate that the device is in Airplane mode and the application cannot run successfully.
  • Verify for the Network Reachebility.
    Expected behavior: Popup should be detect when the network is unavailable and provide a (pop-up) message informing the user.
  • Verify the Materials or Advertisements.
    Expected behavior: Marketing materials or advertisements should not be there at the app (app will be rejected)

How to extract no. of links and text of  links present on a page in Selenium WebDriver:

We all know that tag name for every link starts with letter “a”. “a” refers to the anchor tag. The tag name which starts with letter “a” should be a link.

Because all links has tag name “a” so we can identify links with tagName method of By class i.e.

driver.findElements(By.tagName(“a”));

To find the total no of links on a page:

Suppose you want to find total no. of links on google page for this you can use

driver.get(“http://www.google.com”);

List<WebElement> alllinkspresent=driver.findElements(By.tagName(“a”));

System.out.println(“no. of links on google page are :” +alllinkspresent.size());

Where size() method returns the total no of links on Google page.

To find or print the name of links i.e. text of links:

Suppose you want to print text of all links present on Google page for this you can use

for(int i=0; i< alllinkspresent.size(); i++)

{

System.out.println(alllinkspresent.get(i).getText());

}

To extract the links of a particular section:

Suppose you want to extract the links of languages offered by Google section for this you can use

WebElement LangSection=driver.findElement(By.xpath (“//*[@id=’addlang’]”));

List<WebElement> lang=LangSection.findElements(By.tagName(“a”));

for(int i=0; i< lang.size(); i++)

{

System.out.println(lang.get(i).getText());

}

Where LangSection is one WebElement and we have to find the all the links present in this section. For understanding of this section of code please refer following screen shot

When you run the above code you will get text of all links present in this section. Refer following screen shot

Different methods to locate UI Elements (WebElements) or Object Recognize Methods:

There are different methods to locate UI Elements (WebElements) or to recognize objects which are as follows:
· By ID
· By Tag Name
· By Class Name
· By Link Text
· By Name
· By Partial Link Text
· By XPATH

By ID:

This method is most efficient and mostly used to locate the elements. Every element has its unique id.

Let’s take the example for Google, suppose we have to find/locate the search box of goggle. Use firebug option of Mozilla Firefox with which you can easily locate the element in HTML format. Please refer following screenshot:

<td id=”gs_tti0″ class=”gsib_a”>

Id of Search box of goggle is gs_tti0.

Now Example for how to find an element via using ID:

WebElement element = driver.findElement(By.id(“gs_tti0”));

 By Tag Name:

To find tag name of a use fire bug.

Let’s take the example for Google, suppose we have to find/locate the “Google Search” button of goggle via tag name. Use firebug option of Mozilla Firefox with which you can easily locate the element in HTML format. Please refer following screenshot:

<input type=”submit” onclick=”this.checked=1″ name=”btnK” value=”Google Search”/>

Tag Name of Google Search” button of goggle is input here.

Now Example for how to find an element via using TagName:

WebElement element = driver.findElement(By.tagName("input"));

By Class Name:

There may be many elements that are associated with same class name so finding multiple elements becomes the more practical option over finding the first element.

Example of how to find an element that looks like this:

<div class=”tsf-p” style=”position:relative”>

Here tsf-p is classname.

List<WebElement> element = driver.findElements(By.className("tsf-p "))
Remember that use findElements method instead of findElement to find multiple elements.

 By Link Text:

By using By Link Text method of class “By “you can find link element with matching visible text.

Let’s take the example for Google, suppose you want to find/locate the “Advertising Programs” link of goggle via Link Text.

Now Example for how to find an element i.e. link via using linkText:

WebElement element = driver.findElement(By.linkText("Advertising Programs"));

By Name:

By using By Name method of class “By “you can find link element via name attribute of element.

Example of how to find an element that looks like this:

<input type=”submit” onclick=”this.checked=1″ name=”btnK” value=”Google Search”>

Here” btnK” is name.

List<WebElement> element = driver.findElements(By.name("btnK "))

By Partial Link Text:

By using “BypartialLinkText” method of class “By “you can find link element with Partial matching visible text.

Let’s take the example for Google, suppose you want to find/locate the “Advertising Programs” link of goggle via BypartialLinkText. For this you can use:

WebElement element = driver.findElement(By. partialLinkText ("Advertising"));

 By XPATH:

Xpath is a locator, it is an unique address which identifies each and every element.WebDriver uses a browser’s native XPath capabilities wherever possible. To find xpath of an element use firebug and fire path adons on Mozilla Firefox.

Let’s take the example for Google, suppose we have to find/locate the search box of goggle via using xpath. Use firebug option of Mozilla Firefox with which you can easily locate the element in HTML format and copy the xpath from xpath bar of firepath tab.Please refer following screenshot:

Now Example for how to find an element via using xpath:

WebElement element = driver.findElement(By.xpath("//*[@id='gs_tti0']"));
 Note: Don’t copy the dot from xpath bar.

 

Eclipse (software)

Download and Configuring the Selenium Webdriver in Eclipse:

Pre-requisites:

  • JDK
  • Eclipse setup
  • Selenium

Steps to Download and Configuring the Selenium Webdriver in Eclipse:

1. Go to http://seleniumhq.org/download/

2. Click on Download link which is associated with java release. Download the jar files. Refer following screenshot.

3. When you download it you will get a folder. In this folder you have two jar files related to selenium and a lib folder in which you have another jar files. Refer following screenshot.

4. Now Create a New project in Eclipse for this you have to follow the following steps:

  • Go to Eclipse –> Click File –> New –> Project
  • In Select Wizard –> Click Java –> “Java Project” (Refer following screenshot.)
  • Give the project name
  • Click Finish – Click Yes

5. Now add all jars which you have downloaded earlier. Go to properties by right clicking on project.

  • Click “Java Build Path”
  • Click Libraries tab
  • Click “Add External JARs” button
  • Select both selenium jars and all other jars from lib folder of downloaded folder.

If you like this post ,Don’t forget to write comments……………………

Selenium logo

Selenium2/Selenium Webdriver:

Selenium2=Selenium1+WebDriver

Webdriver is a tool for automating testing web applications. Webdriver makes direct calls to the browser using each browser’s native support for automation. Selenium Webdriver does not depends upon the server. We can directly run the programs/scripts in the main method. Selenium Webdriver is very simple, easy to use and to the point.

Features of Selenium Webdriver:

  • Selenium Webdriver supports various languages for example java, Python, C#, Ruby, Perl, Php, Java script.
  • No need to start selenium server.
  • Selenium Webdriver Supports iPhone and Android testing.
  • You can find coordinates of any object using Webdriver.
  • You can easily simulate clicking on front and back button of browser.
  • Keyword driven framework is very easy to build in webdriver.
  • Webdriver uses native automation and does not have the sandbox constraints of Selenium-RC. It’s a little faster and does not require a server.

 

If you like this post ,Don’t forget to write comments…………………

Selenium logo

Selenium Introduction:

Selenium :

Selenium is a Web testing tool. Selenium is a robust set of tools that is used to record and run web applications. There are three components of Selenium. i.e. Selenium is composed of three major tools which has their own specific roles. Selenium is free and open source.

Selenium 2 provides drivers for:

  • Mozilla Firefox
  • Google Chrome
  • Microsoft Internet Explorer
  • Opera
  • Apple iPhone
  • Android browsers

Selenium-IDE:

Selenium-IDE is the Integrated Development Environment for building Selenium test cases. It operates as a Firefox add-on.

Advantages of Selenium-IDE:

It is very easy to use. It has record and play feature and we can also write our own extensions and implement loops, if statements, use arrays, parameterize test cases. Selenium-IDE is very user friendly.

Limitation of Selenium-IDE:

It gets installed as an add-on on Mozilla and works only on Mozilla. IDE cannot work on browsers other than Mozilla. That’s why RC or webdriver is used.

Selenium-RC (Remote Control):

Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language.

Advantages of Selenium-RC:

Selenium Remote Control is great for testing complex AJAX-based web applications. Selenium Remote Control can be used for any java script enabled browser.

Limitation of Selenium-RC:

In RC we have to start the server again and again i.e. RC completely depends upon server. Switching between the multiple instances of the same browser is not possible. Switching between the multiple instances of the different browsers is not possible.

Selenium-Grid:

Selenium Grid is a server that allows tests to use web browser instances running on remote machines. With Selenium Grid, one server acts as the hub.

MonkeyTalk all Actions/methods  with their Description and Examples:

MonkeyTalk Action Description Example for android
Device Rotate This method is used for Change the device orientation.
Android:Landscape,Portrait
Ios:Left,Right
Device *  Rotate Landscape
Back iOS: Pops the current UINavigationItem (if there is one)
Android: Presses the hardware device key
Device *  back
forward iOS: Pushes the next UINavigationItem, if there is one
Android: ignored.
N/A on Android.
search iOS: ignored.
Android: Presses the device search key.
Device *  Search
Screenshot This method is used to create screenshot folder in running project and we can capture screenshot at any point Device *  Screenshot
Menu Android: Presses the device menu key.
iOS: ignored
Device * Menu
Shake This method is used for specific apps.  Device * Shake
Get This method returns “iOS” or “Android”. Device * Get a
Table Select This method is used to select an element from the table. Table * Select Boron
SelectRow Select a row.
row – the row to select
section – the section containing the row. (Ignored on Android).
Where row and section are arguments.
ScrollToRow(by row) Scroll to a row by row number.
Row – the row to select
section – the section containing the row. (Ignored on Android).
Where row and section are arguments and both args should be integer.
ScrollToRow(by Value) Scroll to a row by value.
value (int)- the value of the row to scroll to.
SetEditing Enable/disable table editing. iOS: Enabled editing mode for table. Android: ignored. N/A on Android.
Insert Insert a row into the table. iOS: Inserts a row. Android: Ignored. N/A on Android.
Remove Remove a row from the table.  iOS: Deletes the row. Android: Ignored. N/A on Android.
Move Move a row. iOS: Moves a row. Android: Ignored N/A on Android.
SelectIndex Selects an item by index. Table * SelectIndex 3
Where 3 is item no i.e index and index should be integer.
LongSelectIndex Long press an item by index. Table * LongSelectIndex 4
Where 4 is item no i.e index and index should be integer.
View verify Verifies that a property of the component has some expected value.If  Expected value is null then it  verifies the existence of the component. Syntax: ComponentType MonkeyId  Verify arg
where for argument pass expected value for verification and componenttype can be any component of monkeytalk like label,button,tabbar etc.
Example: Label #1 Verify “Welcome, test!” %thinktime=8000
Label LOGOUT Verify LOGOUT %thinktime=3000
or
View  LOGOUT Verify LOGOUT %thinktime=3000
verifyNot Verifies that a property of the component does not have some value.If  Expected value is null then it  verifies the non-existence of the component. ComponentType MonkeyId  VerifyNot arg
Label LOGOUT VerifyNot Login %thinktime=3000
or
View LOGOUT VerifyNot Login %thinktime=3000
verifyRegex Verifies that a property of the component matches some regular expression.
verifyNotRegex Verifies that a property of the component does not have a value matching a regular expression
verifyWildcard  Verifies that a property of the component does have a value matching some wildcard expression
verifyNotWildcard  Verifies that a property of the component does not have a value matching some wildcard expression
Get Retrieves a property value from the component Syntax: ComponentType MonkeyId Get Variable PropPath
Example: Button LOGIN Get b :text
Label #1 Get a
Tap Taps on the component. On Android, plays a “click”. On iOS, plays a TouchDown/TouchMove/TouchUp sequence. Button LOGOUT Tap
Swipe Swipe(scroll)  the component in direction Left, Right, Up, or Down (case insensitive) WebView webview swipe Down
Table * Swipe Up
Slider * Swipe Right
Drag Touch down, drag across the component, then up Input username Drag 43 154 181 162
where 43 and 154 are x1,y1 i.e starting cordinates and 181 & 162 are x2,y2  i.e ending cordinates.
TouchDown Start touching the component. Input username TouchDown 43 154
where 43 and 154 are x and y cordinates of touch and x,y should be integer.
TouchMove Drag across the component.
one or more (x,y) coordinate pairs specifying the path of the drag gesture
Input username TouchMove 146 170
TouchUp Stop touching the component Input username TouchUp 43 154
where 43 and 154 are x and y cordinates of touch where touch is released and x,y should be integer.
Pinch Pinch the component.
scale – The scale factor relative to the points of the two touches in screen coordinates
velocity – The velocity of the pinch in scale factor per second (read-only)
Exec Call a method on a component. The method must take zero or more String arguments and return a String result. Not implemented yet by gorilla logics.
LongPress Performs a long press on the component. On Android, plays a “longClick”. On iOS, plays a longPush gesture View LOGOUT  LongPress
Button LOGIN  LongPress
ButtonSelector Select Select an item by value. ButtonSelector forms_radios select A
SelectIndex Selects an item by index.
LongSelectIndex Long press an item by index.
Input EnterText Enter text into the input field.
text – the text to enter
hitDone – iOS: if true, hit Done key after entering text. Android: ignored.
Where text and hitdone are arguments of entertext action.
Input username EnterText test
Clear Clear text from the input field Input username Clear
Script Run Run the script with the given args. Script test1.mt Run john “my password” %thinktime=3000
RunWith Run the script with the given CSV file. Script datdriven.mt RunWith credentials.csv
Slider Select Select a numeric component value Slider forms_slider_bar Select 52 %thinktime=3000
TabBar Select Select an item by value. TabBar * Select hierarchy %thinktime=1000
SelectIndex Selects an item by index. TabBar * SelectIndex 2 %thinktime=5000
LongSelectIndex Long press an item by index.
Vars Define Define the named variables used in the script. Vars * Define user pass
CheckBox On This action sets or returns the checked state of a checkbox. CheckBox forms_checkbox on
Off This action sets or returns the Unchecked state of a checkbox. CheckBox forms_checkbox off
ItemSelector Select Select an item by value. ItemSelector * Select Carbon
SelectIndex Selects an item by index. ItemSelector * SelectIndex 8
LongSelectIndex Long press an item by index. ItemSelector * LongSelectIndex 8
Button Tap Taps(click) on the Button. On Android, plays a “click”. On iOS, plays a TouchDown/TouchMove/TouchUp sequence. Button LOGOUT Tap
DatePicker EnteDate Change the current date value.
A date with the format YYYY-MM-DD where YYYY is the year, MM is the month (01-12), and DD is the day (01-31).
NumericSelector select Select a numeric component value
RatingBar select Select a numeric component value
Scroller scroll Scroll to the specified coordinates.
x – the x-coordinate (horizontal)
y – the y-coordinate (vertical)
TextArea EnterText Enter text into the input field.
text – the text to enter
hitDone – iOS: if true, hit Done key after entering text. Android: ignored.
Where text and hitdone are arguments of entertext action.
TextArea * enterText “This is a textarea”
Clear Clear text from the input field TextArea * Clear
ToolBar SelectIndex Selects an item by index.
LongSelectIndex Long press an item by index.
VideoPlayer Play Play the video from the current playback point.
Pause Stop the video at the current playback point
Stop Stop the video and set playback to the starting point.
Menu Select Select an item by value. Menu * select About
Verify Menu * Verify About
SelectIndex Selects an item by index.
LongSelectIndex Long press an item by index.
Doc vars Document the named variables used in the script.
script Document the script itself.
Label All methods of view are applicable on label. Label #1 Verify “Welcome, test!”
Label LOGOUT VerifyNot LOGIN
Setup Run Run the setup script with the given args. SetUp login.mt run john “my password”
RunWith Data-drive the setup script with the given CSV data file. SetUp login.mt runwith cre.csv
(where the first arg is the data file filename )
Teardown Run Run the teardown script with the given args TearDown logout.mt run
RunWith Data-drive the teardown script with the given CSV data file. TearDown logout.mt runwith logout.csv
Test Run Run the test script with the given args. Test testcase1.mt run
RunWith Data-drive the test script with the given CSV data file. Test testcase1.mt runwith login.csv
Toggle On Enabled the switch on. Toggle MonkeyId On
Off Disabled the switch. Toggle MonkeyId Off

MonkeyTalk Test Suite:

MonkeyTalk Test Suite is a file with extension .mts in which you can manage the number of scripts. You can use SetUp, TearDown and Test commands in test suites. A test suite can only contain three types of commands.

Test is a script which runs as part of test suite.

Setup-A script to run before each test in the script.

TearDown – A script to run after each test in the script.

Steps to create Test Suite:

  • Right click on Project.
  • Select new.
  • Then Select Test Suite.

Scripts which you want to run through testsuite should have extension .mt.

Test Suite Must contains at least one Script.

Advantage:

We can Run no of scripts in one go and Screenshots are captured and stored in screenshot folder under project in report folder for failures automatically.

Test suites output the standard XML report, making MonkeyTalk easy to integrate into existing systems.

Results:

The results are displayed in the JUnit panel at the bottom of the screen.

You can also view Results from Test Xml file under project in report folder.

List of MonkeyTalk Component Types:

MonkeyTalk Android IOS
Device Device Device
Table ListView UITableView
View View View
ButtonSelector RadioGroup UISegmentedControl
Input EditText UITextField
Script
Slider SeekBar UISlider
TabBar TabHost UITabBar
Vars
CheckBox CheckBox UISwitch
ItemSelector Spinner UIPicker
Button Button UIButton
DatePicker DatePicker UIDatePicker
NumericSelector
RatingBar Slider RatingBar
Scroller Scroller UIScrollView
TextArea TextView UITextView
ToolBar ActionBar UIToolBar
VideoPlayer VideoView MPMoviePlayerController
Menu Menu TabBar
Doc
Label TextView UILabel
Setup
Teardown
Test
Toggle ToggleButton UISwitch