Thursday, 7 January 2016

Senuji Keyword Library



Keyword Library for Senuji Version 003.004

Senuji Basic Keyword Syntax:  Keyword[Space]"Value"[Space]"Object"


Keyword
Introduction
Syntax
Example
AlertAccept
AlertAccept is used to accept alert.  AlertAccept can accept one alert at a time. 
AlertAccept

AlertAccept

AlertDismiss
AlertDismiss is used to dismiss an alert. AlertDismiss can dismiss one alert at a time. 
AlertDismiss

AlertDismiss

AlertGetText
AlertGetText is used to read text from an alert and validate it with expected result. AlertGetText can work with one alert at a time.  
AlertGetText[Space]"Expected Result"

AlertGetText "Test Alert"

BrowserPosition
BrowserPosition used Position the Location of Running Browser.
 You can use value text box to key in x and y by separating them using coma

BrowserPosition[Space]"x coordinates,y coordinates"

BrowserPosition "100,100"
CaptureScreen
CaptureScreen is used to take screen shots while text execution.
 Screen shots will be saved in your  ..\Default\ScreenShots folder.
 Screen shot file name is a combination of the date and time.
CaptureScreen
CaptureScreen
ClearTextBoxValue
ClearTextBoxValue is used to clear a textbox or text aria in a web page. 
ClearTextBoxValue can clear one object at a time.
 ClearTextBoxValue requires the target object or the locator to identify the test box and type of the locator you use. 
You can use select locator dropdown to select corresponding locator type.
ClearTextBoxValue [Space]<”null”>[Space]"<Locator Type><:><Object>"

ClearTextBoxValue "null" "Xpath://*[@id='lst-ib']"

Click
Click is used to click an object in a web page.
 Click can click one object at a time.
 Click requires the target object or the locator to identify the object and type of the locator you used.
 You can use select locator dropdown to select corresponding locator type.

Click [Space]"null"[Space]"<Locator Type><:><Object>"

Click "null" "Xpath://*[@id='lst-ib']"

CloseBrowser
CloseBrowser is used to close the active browser.

CloseBrowser

CloseBrowser

DataInput
Introduction:
DataInput is used to read data from csv file and input to a textbox or text aria in a web page.
 DataInput can input values for one object at a time.
 DataInput requires the target object or the locator to identify the test box and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type.
DataInput [Space]<"Data Field Sequence ID"> [Space]"<Locator Type><:><Object>"

DataInput "1" "Xpath://*[@id='lst-ib']"

DeselectAll
DeselectAll is used to de select items form list box or from combo box 
  DeselectAll can work with one list at a time. 
DeselectAll[Space]"null"[Space]"Object"

DeselectAll "null" "Xpath://*[@id='lst-ib']"

DisplayCurrentUrl
DisplayCurrentUrl is used to log current URL on the browser
  DisplayCurrentUrl can log one URL at a time. 
DisplayCurrentUrl

DisplayCurrentUrl

DisplayPageTitle
DisplayPageTitle is used to log current page title
  DisplayPageTitle can log one title at a time. 
DisplayPageTitle

DisplayPageTitle

EndLoop
EndLoop is used mark end of the Loop

EndLoop

EndLoop

EnterText
EnterText is used to input a static keyboard input to a textbox or text aria in a web page.
  EnterText can input values for one object at a time. 
EnterText requires the target object or the locator to identify the test box and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type.
EnterText [Space]<"input value"> [Space]"<Locator Type><:><Object>"

EnterText "I like Senuji" "Xpath://*[@id='lst-ib']"

InputNumberVariableToTextbox
InputNumberVariableToTextbox is used to move number variable value to text box 
  InputNumberVariableToTextbox can work with one test box at a time. 
You must define the variable using VariableNumber keyword and number varible should read the value from the object using StoreNumberToVariable keyword.
 Length of the variable is not limited but you cant have spaces in-between.
InputNumberVariableToTextbox[Space]"$Varible_Name"[Space]"Object or Locator"
InputNumberVariableToTextbox "$PageID" "Xpath://*[@id='lst-ib']"


Open "http://stackoverflow.com/questions/5766318/converting-double-to-string"
VariableNumber "$ABC=0"
StoreNumberToVariable "$ABC" "Xpath:.//*[@id='answer-9963574']/table/tbody/tr[1]/td[1]/div/span[1]"
InputStringVariableToTextbox "$ABC" "Xpath:.//*[@id='fsr']/a[1]"
InputStringVariableToTextbox
InputStringVariableToTextbox is used to move string variable value to text box 
  InputStringVariableToTextbox can work with one test box at a time. 
You must define the variable using VariableString keyword and String varible should read the value
 from the object using StoreStringToVariable keyword.
 Length of the variable is not limited but you cant have spaces in-between.
InputStringVariableToTextbox[Space]"$Varible_Name"[Space]"Object or Locator"
InputStringVariableToTextbox "$PageTitle" "Xpath://*[@id='lst-ib']"


Open "https://www.google.lk/"
VariableSring "$ABC="
StoreStringToVariable "$ABC" "ID:_eEe"
InputStringVariableToTextbox "$ABC" "ID:.//*[@id='lst-ib']"
LogMessageToConsole
LogMessageToConsole is used to log a message during test run in Senuji Console
LogMessageToConsole can display one message at a time. 
LogMessageToConsole [Space]<"Message"> 

LogMessageToConsole "Test Execution Started"

Loop
Loop is used to scan a ";" delimited csv file witch can use to hold data as input to a test.
 Loop will iterate all the statements until it find EndLoop. 
You can use any amount of loops with in the script but loop with a loop is not possible.
CSV file has to be placed inside ..\Default\Data folder

Loop[Space]"csv File Name"

Loop "Test.cvs"
Sample Data table
"Gayan Perera";"20"
"Nirosan Bandara";"22"
"Erandika umal hungampola";"30"

MaximizeBrowser
MaximizeBrowseris used Maximize Running Browser
MaximizeBrowser

MaximizeBrowser

MoveSlider
MoveSlider is used to move or change value of a Slider object
  MoveSlider can be used on one Slider at a time. 
MoveSlider requires the target object or the locator to identify the Slider and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type
MoveSlider [Space]<"Value for Slider to select"> [Space]"<Locator Type><:><Object>"

MoveSlider "40" "Xpath://*[@id='lst-ib']"

NavigateURL
NavigateURL is used to navigate to URL from active web page 
NavigateURL can work with one URL at a time. 
NavigateURL[Space]"URL"[Space]"null"
NavigateURL "www.gmail.com" "null"
NavigateBack
NavigateBack is used to perfrom browser back button 
NavigateBack[Space]"null"[Space]"null"
NavigateBack "null" "null"
NavigateForward
NavigateForward is used to perfrom browser forward button 
NavigateBack[Space]"null"[Space]"null"
NavigateForward "null" "null"
ObjectSelected
ObjectSelected is used to check if given object is selected or not. If selected test will be passed.
 ObjectSelected can check one object at a time.
 ObjectSelected requires the target object or the locator to identify the object and type of the locator you used.
 You can use select locator dropdown to select corresponding locator type.
ObjectSelected is useful objects such as Checkbox
ObjectSelected [Space]"null"[Space]"<Locator Type><:><Object>"

ObjectSelected "null" "Xpath://*[@id='lst-ib']"

Open
Open is used to call the browser and open a specific URL.
 Open keyword will create a new instant of a browser. 

Open[Space]"<URL>"

Open "https://www.google.lk/ "

ResizeBrowser
ResizeBrowser used Resize Running Browser.
You can use value text box to key in Height and Width by separating them using coma

ResizeBrowser[Space]"Hight,Width"

ResizeBrowser "100,100"

SelectByIndex
SelectByIndex is used to select Combo Box or list Box item using object index
  SelectByIndex can select one item at a time. 
SelectByIndex requires the target object or the locator to identify the Menu Item , Combo box or list Box and type of the locator you use.
 You can use select locator dropdwn to select corresponding locator type.

SelectByIndex [Space]<"Index or ID"> [Space]"<Locator Type><:><Object>"

SelectByVisibleTextKey "2" "Xpath://*[@id='lst-ib']"

SelectByVisibleTextKey
SelectByVisibleTextKey is used to select Combo Box or List Box item using visible text
  SelectByVisibleTextKey can select one item at a time. 
SelectByVisibleTextKey requires the target object or the locator to identify the Menu Item , Combo box or List Box and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type.

SelectByVisibleTextKey [Space]<"Text value you need to select"> [Space]"<Locator Type><:><Object>"

SelectByVisibleTextKey "Senuji" "Xpath://*[@id='lst-ib']"
StoreNumberToVariable
StoreNmberToVariable is used store number object value to number variable 
 StoreNmberToVariable can work with one object at a time. Variable Name can be any alpha numeric string without special chars.
 Length of the variable is not limited but you cant have spaces in-between.
 You must define the variable using VariableNumber keyword

VariableNumber[Space]"$Varible_Name=initial value"[Space]"Object or Locator"

VariableNumber "$ExpectedPageNO" "Xpath://*[@id='lst-ib']"

StoreStringToVariable
StoreStringToVariable is used store string object value to string variable 
  StoreStringToVariable can work with one object at a time. Variable Name can be any alpha numeric string with out special chars.
 Length of the variable is not limited but you cant have spaces in-between.
 You must define the variable using VariableSring keyword

VariableNumber[Space]"$Varible_Name=initial value"[Space]"Object or Locator"

VariableNumber "$ExpectedPageTitle" "Xpath://*[@id='lst-ib']"

Submit
Submit is used to perform submit action on a web form 
Submit requires the target object or the locator.
 You can use select locator dropdown to select corresponding locator type.
Submit[Space]"null"[Space]"Object"
Submit "null"Xpath://*[@id='lst-ib']"
ValidateObjactValue
ValidateObjactValue is used to search a static value in object/target.
  ValidateObjactValue can search values for one object at a time. 
ValidateObjactValue requires the target object or the locator to identify the object and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type.

ValidateObjactValue [Space]<"Search value"> [Space]"<Locator Type><:><Object>"

ValidateObjactValue "I like Senuji" "Xpath://*[@id='lst-ib']"
VariableNumber
VariableNumber is used create numaric variable 
  VariableNumber can work with one variable at a time. Variable Name can be any alpha numeric string without special chars.
 Length of the varible is not limited but you cant have spaces in-between.
 You must provide initial value for the variable
VariableNumber[Space]"$Varible_Name=initial value"[Space]"null"

VariableNumber "$ExpectedPageNO=10" "null"

VariableSring
VariableSring is used create String variable 
  VariableSring can work with one variable at a time. Variable Name can be any alpha numeric string without special chars.
 Length of the variable is not limited but you cant have spaces in between.
 You must provide initial value for the varible

VariableSring[Space]"$Varible_Name=initial value"[Space]"null"

VariableSring "$ExpectedPageTitle=My Page Title" "null"

VerifyTxtBoxValue
VerifyTxtBoxValue is used to read value form textbox and verify with expected value
  VerifyTxtBoxValue can search values for one textbox at a time. 
ValidateObjactValue requires the target object or the locator to identify the test box and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type.

VerifyTxtBoxValue [Space]<"Search value"> [Space]"<Locator Type><:><Object>"

VerifyTxtBoxValue "I like Senuji" "Xpath://*[@id='lst-ib']"

Wait
Pause process

Wait[Space]"<Wait Time in ms"

Wait "3000"

WaitForElementPresent
WaitForElementPresent is used to check for an object in a web page.
 WaitForElementPresent can validate one object at a time.
 WaitForElementPresent requires the target object or the locator to identify the test box and type of the locator you use.
 You can use select locator dropdown to select corresponding locator type.

WaitForElementPresent [Space]"null"[Space]"<Locator Type><:><Object>"

WaitForElementPresent "nill" "Xpath://*[@id='lst-ib']"













Wednesday, 6 January 2016

Basic Structure Of Senuji Test Script

 

Introduction

As I explained before Senuji is a Keyword driven wraps around Selenium. Senuji has set of Keywords witch calls Selenium functionality and execute during run time. For this Senuji Keyword needs two main components.
  1. Value attribute witch carry parameters to actual selenium run time.
  2. Locator/Object attribute witch carry the HTML object information to actual selenium run time.
Senuji has stranded syntax to manage above attributes. Evey Senuji Keyword looks like following
KeyWordName[Space]"Value attribute"[Space]"Locator/Object attribute".

My First Senuji Test Script


For example, Assume we want to Google.lk web site in Fire Fox Browser. Then I need to create a Project and  Test Script as per my previous post How to create Senuji project and run.

Then I need to go to Keyword List and select Open Keyword and Enter Google.lk URL into Value TextBox. Please refer to below screen shots

 

Now Click Add New Line Button. Then Senuji Keyword will be automaticaly compute and Keyword will be added as a script line to active script.




Now for example say you want to wait until Gmail Link appear in the browser. For this I am going to use Senuji Keyword WaitForElementPresent. WaitForElementPresent requires Object/Locator of the Gmail Link. I use Fire Path object spy to understand the object and enter it to Senuji Object TextBox.




 Fire path object spy helped me to identify Locator for Gmail link. It class="gb_P". Now I am going to select WaitForElementPresent from Keyword List and select Class Name as Locator type from Locator type combo box and locator ID "gb_P" in to object textbox. However
WaitForElementPresent dose not require value parameter so I am keeping it as blank.





Now I click add new line button. Now WaitForElementPresent Keyword will be appended into our existing script.




Now assume I want to read caption "Google.lk offered in: සිංහල தமிழ்" exists in the page. For this I use Fire path spy to identify the object of the caption.



Then I use ValidateObjactValue keyword. I pass expected result of  "Google.lk offered in: සිංහල தமிழ்" into Value Textbox and select Locator type as ID and Object ID into Object Textbox and click Add new line button



Now I am going to save the test script as My First Test and Project as My First Project and run the script using Run Script Button. Just to show the fail scenario, I have changed the expected results of ValidateObjactValue. Now I am expecting a Fail in ValidateObjactValue. 

Now you can see the detail test log in Log section and Summary as a pie chart.





How to Create Senuji Project and Run









Senuji Project file contain your test scripts, Video recordings, Screen captures, External Data files and etc. File extension is .sep and projects are save in your Default Save Path you set during settings.

How to Create Senuji Project and Run

  1. Click New Script (M) icon from test script aria
  2. Select the keyword from keyword list (K) Example "Open"
  3.  Enter Value for the selected keyword using Value Textbox. (I) Example "www.Google.com"
  4. You can enter locator/object value using Target object Textbox (j) Example "//*[@id='lst-ib']"
  5. You can select locator type from Locator Combo box. (L) Example Xpath
  6. Click Add New Line Button (O) to add the line to active script.
  7. You can add any number of lines to a script box
  8. If you remeber the sysntax of the keyword you can type directly into script box.
  9. Click Run button (H) to execute active script.
  10. Click Save Button (N) to Save active script. Saved scripts will be added to Project Aria
  11. You can save all script into one project by Save Project button (C)
  12. You can Open a Project using Open Project Button (A)
  13. List Video Button (D) will open all Video recordings for the open project. Videos will be saved to the project when you click Save Project Button.
  14. List Screen Shot Button (E) will open all Screen shots for the open project. Screen shots will be saved to the project when you click Save Project Button.
  15. List Data Files Button (F) will open all Data Files for the open project.Data Files will be saved to the project when you click Save Project Button.
  16. When you run the project Test results will be log to Log Aria. You can clear the log using Clear Log Button (P) or You can Save the log using Save Log Button (Q)  
  17.  Please refer Image 2 for Sample Screen shot of a Test Script and Test results
  18.  Please Refer to Image 3 for Sample Test Script 


Image 2: Senuji Project View




This Script will open google page and wait for Gmail link and other objects in the page. Then it will open Test.cvs file and input 1st data element into google search box and wait for 3000ms. Then it will input the next record and loop until EOF.

Image 3 : Sample Test Script








Tuesday, 5 January 2016

How to Install Senuji



1. Make sure you have Java 1.8 or higher in your PC and it is accessible to Senuji. Please note that as of now Senuji is tested only on Windows. Therefore we are officially supporting Windows only.

 

2. Copy downloaded Senuji archive to your hard drive
3. Unzip the archive
4. Run Settings.jar by double click Settings.jar
5.Create a Folder for Senuji to use during execution and select the folder location as Default Folder in Settings
6. When you unzip Senuji archive you see a folder call System. Please select System folder location as System Folder in Settings
7. Create a Folder for Senuji to use as defect save location and select it as Project Save Path in Settings
8. When you unzip Senuji archive you see a folder call Driver. Select that location as Chrome Web 9.
Driver Location in Settings. If you have Chrome Web Driver installed Please select that location
9. When you unzip Senuji archive you see a folder call Driver. Select that location as MS Web Driver Location in Settings. If you have MS Web Driver installed Please select that location
10. Enter a Default Project name and Script name
11.Click Save button to save your settings 

12. Double click Senuji.jar to open Senuji main screen.
 

Senuji Web Testing Framework - Introduction

 

Introduction

Senuji is my second QA initiative. After Manuji's success as a tool I through of helping the QA community, especially guys who intersected in WEB test automation. (Lots of people asking me what is the meaning of  Manuji. Manuji is my first daughter and Senuji is the second. They are twins)

Selenium is the best web test automation tool affordable to most of us. However as you know it require some programming capability with Java and some technical know-how about java.  Lots of QA guys are lacking programming capability but they want to use the power of Selenium.  I designed Senuji to assist such people.

Senuji is a keyword driven Selenium based test automation framework witch designed to cut down Java programming complexity. Senuji can be very useful to test automation starters or none technical testers to use the power of Selenium test automation capabilities.

Senuji is hosted on https://sourceforge.net/projects/senuji-web-testing-framework/ . These days I am in the process of preparing the site and  getting ready for the first beta release of Senuji.

 

Senuji has following built in capabilities witch provide advanced test automation features instantly with zero Java and Selenium know-how.

1. Advanced cross browser test execution ability without changing Senuji test script
2. Advanced exception management capability during test run
3. Complete and durable logs and test reporting
4. Full video coverage of your test run
5. Easy to use keyword library
6. Instant help facility once you select the keyword.
7. Easy installation (Just extract the archive file)


Features


  • External Data Handling Capability
  • Advance Exception Management
  • Full Video Coverage of a Test Run
  • Script Level and Suite Level Test Execution
  • Full Functional Looping Ability
  • Screen Capture Capability
  • Comprehensive Keyword Library
  • Easy Installation
  • No Java or Selenium Knowledge required

Release Plan

I am planing to release my first version to SourseFroge by mid of January 2016. You all can download the release form https://sourceforge.net/projects/senuji-web-testing-framework/files/