Archive for October, 2012

Selenium logo

Selenium 2 Introduction:

Selenium 2:

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

Test Cases for Security Testing:                                                                                                                                               

1. Try to directly access bookmarked web page without login to the system.

2. Verify that system should restrict you to download the file without sign in on the system.

3. Verify that previous accessed pages should not accessible after log out i.e. Sign out and then press the Back button to access the page accessed before.

4. Check the valid and invalid passwords, password rules say cannot be less than 6 characters, user id and password cannot be the same etc.

5. Verified that important i.e. sensitive information such as passwords, ID numbers, credit card numbers, etc should not get displayed in the input box when typing. They should be encrypted and in asterix format.

6 .Check Is bookmarking disabled on secure pages? Bookmarking Should be disabled on secure pages.

7. Check Is Right Click, View, Source disabled? Source code should not be visible to user.

8. Is there an alternative way to access secure pages for browsers under version 3.0, since SSL is not compatible with those browsers?

9. Check does your server lock out an individual who has tried to access your site multiple times with invalid login/password information?

10. Verify the timeout condition, after timeout user should not able to navigate through the site.

11. Check Are you prevented from doing direct searches by editing content in the URL?

12. Verify that relevant information should be written to the log files and that information should be traceable.

13. In SSL verify that the encryption is done correctly and check the integrity of the information.

14. Verify that restricted page should not be accessible by user after session time out.

15. ID / password authentication, the same account on different machines cannot log on at the same time. So at a time only one user can login to the system with a user id.

16. ID / password authentication methods entered the wrong password several times and check if the account gets locked.

17. Add or modify important information (passwords, ID numbers, credit card number, etc.). Check if it gets reflected immediately or caching the old values.

18. Verify that Error Message does not contain malicious info so that hacker will use this information to hack web site.

Windows Phone Test Checklist-II

Test cases for Windows app:

16. Test Name:  Technical Support Information

Test Description:

  • Launch your application.
  • Verify that the application displays the application name, version information, technical support and contact information in a location that is easy to discover.

Expected Result:

  • Ensure that the application displays all the details regarding name, version information and technical support contact information about the application in a location that is easy to discover by the user.

17.  Test Name: Enabling/Disabling location services globally and within the app (Test case valid for an app that uses location based settings)

Test Description:

  • Navigate to settings page of the app under test
  •  Enable the loction based setting
  • Launch your application
  • Use the app so that it provides location based output
  • Click the Home button on the device to return to Home screen (your app becomes inactive)
  • Navigate to the setting page of the windows phone (global and particular to any app)
  • Disable the location based service
  • Verify that the app is still working correctly and cannot provide location based services

Expected Result:

  • Ensure that the application should be responsive even after closing the location services in the device.

18. Test Name:  Configurable Functionality(if any)

Test Description:

  • Launch your application.
  • Verify that the application UI or Settings menu enables the user to disable toast notifications(if any).

Expected Result:

  • Verify that there should be an option available to user in the menu to disable toast notifications.

19. Test Name:  Toast Notification Opt-In(if any)

Test Description:

  • Launch your application.
  • Verify that the application prompts the user upon first use of the BindToShellToast method.
  • This prompt must request explicit permission to receive toast notifications.

Expected Result:

  • Ensure that a message should be prompt  asking for an explicit permission from user to receive toast notifications.

20. Test Name:  Verify for Minimize Power Usage When Running Under a Locked Screen (Test case applicable to apps that use the windows idle detection service. If idle detection is enabled in provided in the app then the OS will be able to deactivate the app when it is idle. The only exception is when the app has a feature to play music and the feature is being utilized when the phone is locked)

Test Description:

  • Launch your application
  • Lock the device
  • Verify that any app’s user interface updates, active timers and other non-critical processing activities are halted by the OS

Expected Result:

  • Ensure that  any active timers, user interface updates or non-critical processing activities are halted by the application while running under locked screen.

 21. Test Name: Idle Behavior Under a Locked Screen (Test case applicable to apps that use the windows idle detection service. If idle detection is enabled in provided in the app then the OS will be able to deactivate the app when it is idle. The only exception is when the app has a feature to play music and the feature is being utilized when the phone is locked)

Test Description:

  • Launch your application which allows windows OS to detect if it is in idle state
  • Ensure that app is not playing music if it has such a feature in it, otherwise ignore this step
  • Lock the device
  • Verify that the application does not play music, and the device stays idle

Expected Result

  • Ensure that the device should stay idle when the application is paused under lock screen
  • Application should not play any music/sound under the lock screen

 22. Test Name:  Verify History List Updates if the application uses Music + Video Hub

Test Description:

  • Launch your application.
  • Play back a video or music media file within the application.
  • Navigate to the Music + Videos Hub
  • Verify that the History list contains information about the video or music media file that you played.

Expected Result:

  • Ensure that the History list in Music + Videos Hub contains information about the video or music media file that was played in the test application.

23. Test Name:  Verify Initial Launch Functionality of the test application

Test Description:

  • Play a music file.
  • Launch Test application.
  • Verify that while the application loads, it does not pause, resume or stop the actively playing music.

Expected Result:

  • Ensure that while the application loads, it does not pause, resume or stop the actively playing music.

24. Test Name:  Verify Configurable Functionality of the application

Test Description:

  • Launch your application.
  • Verify that the application allows a user to configure the background music or background music volume of the application.
  • Verify that changes made to these settings do not affect music playback on the device after the application closes.

Expected Result:

  • Ensure that there should an option available to user to configure the application’s  background music.
  • Ensure that changes made in the application’s settings do not affect music playback on the device after the application closes.

25.Test Name:  Verify if Application Plays a Video or Audio Segment

Test Description:

  • Play a music file from the  Music + Video Hub in the device.
  • While the music file plays, launch your application.
  • Play a non-interactive, full-motion video file or a non-interactive audio segment within the application.
  • When the file or audio segment completes, the background music of the device must resume from where it was paused.

Expected Result:

  • Ensure that After completing the video/audio segment in the test application the background music of the device must resume from where it was paused.

26.Test Name:  Verify Applications That Extend The Picture Viewer: Launch Behaviors

Test Description:

  • Tap the Pictures application in Windows phone.
  • Navigate to the Application Bar.
  • Tap Test Application name.
  • Verify that the application allows manipulation of the photo.
  • Navigate back to the Start screen and launch your application from the application list.
  • Verify that the application allows the user to choose a photo.

Expected Result:

  • Ensure that the application allows manipulation of the photo if the user is navigated through the picture application.
  • Ensure that the application allows the user to choose a photo if the user is navigated to the application from the start screen.

 27.Test Name: Verify Applications That Extend the Share Picker: Functionality

Test Description:

  • Launch the application.
  • Verify that the primary functionality of the application is to upload photos.

Expected Result:

  • Ensure that there should be an option available to user to upload or share photos.

 28.Test Name: Verify Universal Volume Control Commands with the test application

Test Description:

  • Launch your application.
  • Begin audio playback.
  • Close the application.
  • Verify that the audio continues to play in the background.
  • View the universal volume control.
  • If the playback service supports the pause command, pause the audio through the universal volume control, verify that
  • playback is paused, restart the audio through the universal volume control, and verify that playback restarts.
  • Stop the audio through the universal volume control.
  • Verify that the playback stops.

Expected Result:

  • Ensure that the application volume (music or sound etc.) can be adjusted by the universal controls
  • Ensure that if the volume is  muted or demuted from the universal control, the application’s volume should also be operated accordingly.
  • Ensure that if the playback is paused from the universal control, then the application’s playback should also be paused.
  • Ensure that if the playback is restarted from the universal control, application’s playback should also be restarted.

29.Test Name:Verify Universal Volume Control Strings

Test Description:

  • Launch your application.
  •  Begin audio playback.
  • Run the application in the background.
  • View the universal volume control.
  • Verify that the metadata for the audio playback appears and is relevant to the audio content.

Expected Result:

  • Ensure that the metadata for the audio playback appears in the universal control window and is relevant to the audio content which is playing.

30.Test Name: Verify if the application uses Audio Streaming Agent

Test Description:

  • Launch your application.
  • Close the application.
  • Verify that the Background Audio Streaming Agent is only being used to stream the intended audio content and relatedmetadata management.

Expected Result:

  • Ensure that the  audio streaming agent is used only for intended audio streaming and related meta data management.

Difference between Test case and Test scenario:

  • Test case consist of set of input values, execution precondition, excepted Results and executed post condition, developed to cover certain test Condition. While Test scenario is nothing but test procedure.
  • A Test Scenarios have one to many relation with Test case, Means A scenario have multiple test case. Every time we have write test cases for test scenario. So while starting testing first prepare test scenarios then create different-2 test cases for each scenario.
  • Test cases are derived (or written) from test scenario. The scenarios are derived from use cases.
  • Test Scenario represents a series of actions that are associated together. While test Case represents a single (low level) action by the user.
  • Scenario is thread of operations where as Test cases are set of input and output given to the System.

For example:

Checking the functionality of Login button is Test scenario and
Test Cases for this Test Scenario are:
1. Click the button without entering user name and password.
2. Click the button only entering User name.
3. Click the button while entering wrong user name and wrong password.
Etc…

In short,

Test Scenario is ‘What to be tested’ and Test Case is ‘How to be tested’.