Setup for Robot Framework Automation

World changes constantly..
We change each day..
Once U find itself U have to begin again.

Today we are changing and learning Robot Framework and thought of sharing the same with others co-learners, please add your expertise as comments to this post. We have already shared our posts on established automation tools like UFT and Selenium.

Do follow us on  Fb,G+,Twitter, it encourages us to learn and share more.

Lets start with the installation of Robot Framework(RF),

Prerequisites :-
1.Python:- This is the language on which the architecture of RF is based on.Most updated version of RF(2.9), supports Python-2.7, still contributing team is working on the support for Python -3.

Download Link:- Python  - Click on Downloads Menu - Download the latest version of python 2.7.* 


  • On most UNIX-like systems such as Linux and OS X you have Python installed by default
  • Latest Python Windows installers allow setting PATH as part of the installation. This is disabled by default, but Add python.exe to Path can be enabled on the Customize Python screen.
  • Python Installation
  • Now if we check (Control Panel\System and Security\System\Advance system settings\Environment Variables\System variables \path) we can see the value added in the starting itself C:\Python27\;C:\Python27\Scripts;
  • Where our = C:\Python27 and = C:\Python27\Scripts
  • We haven't discussed about installation of Jython and IronPython, these are interpreters we need incase we are coding in Java and .net technologies.

How to check python is installed on system?
Easiest approach is open the command prompt and execute the command “python –version”

Checking version of Robot Framework

2.Package Manger:-We can use any package manager like pip, easy_intstall for installing robot-framework.We would be using pip as it is coming bundled with latest version of python (starting 2.7.9) , else we need to install pip first and then utilize it.
So don't worry about this now.

Installing Robot Framework(RF):-
Using pip command:-
# Install the latest version
pip install robotframework
Install RobotFramework

It would take fractions of seconds to install the setup.The above command would install only the latest stable release in case we want a particular version like old or beta release we can use it like:-

# Install 2.9 beta 1
pip install robotframework==2.9b1

Using Windows installer:-
Installers are available on PyPI, select the one as per the OS(32 or 64 bit)

Installing Robot Framework

Note:-We can install RF by using “Source from GitHub”, “Using JAR in Maven Central” or “Manual” approach but we are not discussing this as above techniques are frequently used.

How to verify the installation of Robot Framework?
To verify, we need to use the Runner script, based on the interpreter used. Meaning a technique to trigger RF based on each type of interpreter. 

In our example we have used Python interpreter.
Simply type the command pybot –version in the command prompt and we are done.

Note:- Each type of interpreter have their own Runner scripts:-

Interpreters for Robot Framework

Where we can locate the Robot Framework code?

All the robot framework code after installation can be found inside C:\Python27\Lib\site-packages\robot

How to install “Selenium2Library”?

We need this library to work with web applications.

Execute the command pip install robotframework-selenium2library and we are done with the installation.

Installing SeleniumLibrary2

How to verify the installation of Selenium2Library:-
Open cmd prompt type python
type import Selenium2Library
if we are able to see >> symbol means we are succsessfull.

Check installation of Selenium2Library

We can use this IDE for writing our robot framework.As a beginner it is easy to grasp this IDE, further we can implement other IDE's like pyCharm also.

Preconditons:- We need python, robotframework and wxPython already installed to launch RIDE. Thus we still need to install wxPython as we already done with first 2 components.

wxPython:- RIDE's GUI is implemented using wxPython toolkit.

Install wxPython:- 
Select the required .exe as per the system requirement.

Download link:- wxPython

installing wxPython

Installing RIDE:-

We would install it using the following pip command.
Pip install robotframework-ride

Pip command to install RIDE


  • Using the pip command we are installing the latest stable release.Incase we want to check the beta/alpha release we can follow the RIDE github page.
  • To create the desktop shortcut on windows we need to use the .exe of the installer, that we can get again at the release link.

Launching RIDE :- type the command in command prompt and we are done


SQL Interview Questions -Set3

Lets explore more on SQL interview questions.

Keep sharing and Keep learning.

Do follow us for more updates on  Fb,G+,Twitter.

SQL interview Questions

  1. Why we use Triggers in SQL? Explain with real time example.
  2. Can we use pre triggers in SQL?
  3. We have Table A AS 10 MB space and Table B as 10 MB space, what would be the size of View created by joining both the tables.
  4. How to improve performance in SQL query execution.
  5. Is view called a physical object?
  6. How many rows would be shown in the result for query Select * from Table A , Table B.
    Where Table A have 10 rows and Table B have 20 rows
  7. Column Bool in Table A, have values 1,0,1,1,0,1,0,1
    write a query to replace all 0 with 5 and all '1' with 10
    Hint:-Update Table A SET Bool = CASE when Bool > 0 THEN 10 ELSE 5 END
  8. Table A , have column named First_Name, write a query to concatenate "LongName" at the end incase name is more than 10 alphabets long.
    Hint:-select len(FIRST_NAME) from employee
  9. Advantages of using SP(Stored procedures)?
    Stored procedure can reduced network traffic and latency, boosting application performance.
    Stored procedure execution plans can be reused, staying cached in SQL Server's memory, reducing server overhead.
    Stored procedures help promote code reuse.
    Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.
    Stored procedures provide better security to your data.
  10. What is a cursor and why would you use it?
  11. How do you auto number rows in SQL Server?
    Using Identity Column

How to optimize the performance of ng-repeat in AngularJS?

Today we would focus on improving the performance of Angular JS code by learning the basics of ng-repeat and then how to enhance its capabilities.

Follow us for more learning Fb,G+,Twitter.

ng-repeat :- 
It is directive which create instant of template for each item in the collection. It is identical to looping concept in any language say Java, for example we need to display all the items in an array we would use "ForEach item in items" in Java. Similarly we would say "ng-repeat = item in items" in Angular JS terms. 

Note:- We have angular.forEach function available in AngularJs used for iteration.

We need to display all the name-version pairs on the view.We would implement ng-repeat as we did inthe following example...

ng-repeat example code

Live Demo

Note:-By default, ngRepeat does not allow duplicate items in arrays. We can overcome this by defining our own track by expression. 
Example below we have key = Angular is repeating twice but still in the output we are getting the one key-value pair.
Duplicate key in ng-repeat

How many watches does ng-repeat create for above example?
We knew that Angular creates a $watch for every single ng directive, so above list has 3 + 1 watches (3 names + 1 for ng-directive).Imagine if we have huge array of names how many watches would be created.

How to improve the performance of ng-repeat?

1. Using track by:-
Track by assist Angular in recognizing unique items. Now by default for every item that is getting displayed using ng-repeat, AngularJS calculates hash value to uniquely identify the object. To make sure that whether it has an object before or new object need to be created to display it.

Suppose we are fetching our name-version array in above example on frequent basis this means reference to objects displayed changes multiple times in ng-repeat.So it is recommended to tell AngularJS, how it can identify the unique items. 

Our solution is track by.
"ng-repeat ="name in items track by"

This tells AngularJS that each name is uniquely identified by the value, and to reuse DOM elements as long as the id field does not change.Thus we have used our own key for ng-repeat to identify the objects, instead of generating the unique ID’s each time.

Learning: - implement track by to get unique values

2.Using filters in controller rather than directly in HTML
Filter helps in limiting our data by giving data in user required form, for example we want our version above  to have 2 decimal places at end so we can just change the code as

ng-repeat = "" | filter =limitto:2

But this becomes a headache and a performance issue incase we are filtering the data in the HTML. Better  optimize the triggering of filer in our controller rather than implementing it directly in HTML.

Learning: - Limit DOM filters

3. One-time data binding {{::expression}}

It can be done by simply using the prefix "::"( double colon) before the angular expression.

It helps as AngularJS stops watching the variable and updating it in the UI. So resources are freed for watchlist thus improving the performance.
Remember this approach is useful useful for data that is not expected to change after displayed to the user.

Learning: - Implement bind-once approach if possible

Learn more Angular Concepts

Best and affordable editor for writing visual Basic code??

What is your favorite VBS editor to write scripts?

If we search vb editor on Google you would find thousand of suggestions like notepad++,vbsedit and many more fancy IDE.But sometimes there are situations, like due to organization compliance policies or some other reasons, that we don’t have access to these editors .Then what to do in that case of scenarios.

“Don’t use a lot where a little will do.” -Proverb

Thus we have to achieve maximum out of what we have.

Solution is utilizing the inbuilt feature of developer tab  in  Microsoft excel to code our vbs/vba scripts.

We thought of sharing the same with you all, follow us on  Fb,G+,Twitter for more updates. 


1. Open excel instance.

2. Look for "Developer tab" -> Visual Basic

Opening Visual Basic editor in Excel
Note: - Incase "Developer tab" is not available in the excel ribbon, then, click on Microsoft icon on the top left corner of excel ->Excel Options -> Popular -> check the "Show Developer tab in the ribbon" > OK
We can directly launch Visual basic IDE by using ALT+ F11,after launching the excel instance.

3. Right click on VBA project in the “project explorer “ -> Insert -> module

Inserting Module in Excel

4. Now we ready to write our code, it provides intellisense and debugging 

Debug in VBA project Excel

facilities(like we have watch option in UFT same is available here) 

5. Save as type "Excel Macro-Enabled Workbook"

6. Run (F5) or green play icon on the ribbon panel.
Explore the other features on the panel to learn more.

Run VBA project Excel

Please share your views or your comments about what can be your favorite editor incase you have limited resources, other than Notepad offcourse :)

Learn Vbscript

Example scenarios for working with Dictionary Object Using vbscript.

Every day you wake up is a victory. Learn more and share more....

Concept 1:-How to find the occurrence count of item in a given sample?

Sorting using Dictionary object

Using dictionary object we would find the count of occurrence of given value in the sample.
Example: - we need to find the "Help" words in the given string say: - "God help those who help themselves"

Lets connect for more updates at  Fb,G+,Twitter.

'Input String
sSample = "God help those who help themselves"
'Splitting the given string
arrSample = Split(sSample)
'Calling the function to get the Count of all the items
Set objCount = fn_Count(arrSample)
arrKey = objCount.Keys
For iRun = 0 To objCount.Count - 1
 MsgBox "Count of '" & arrKey(iRun) & "' =" & objCount.Item(arrKey(iRun))
'Function Name:-        fn_Count
'Function Description:- Function find the occuerence of given word in the string
'Input Parameters:-     Given String
'Output Parameters:-    Dictionary object

Function fn_Count(arrSample)
    Dim iRow, iItem
    Dim objDic
    Set objDic = CreateObject("scripting.dictionary")
    'Looping through array
    For iRow = LBound(arrSample) To UBound(arrSample)
        iItem = arrSample(iRow)
        If Not objDic.Exists(iItem) Then
            objDic.Add iItem, 1
         objDic.Item(iItem) = objDic.Item(iItem) + 1
        End If
    Set fn_Count = objDic
End Function

Concept 2:- How to sort items in the given dictionary?
Note: - we can sort dictionary keys in the same manner as we did items.


'Function Name:-        fn_SortDictionary
'Function Description:- Function to sort the items in the given dictionary
'Input Parameters:-     Unsorted Dictionary object
'Output Parameters:-    Sorted Dictionary object
Function fn_SortDictionary(objdict)
  Dim i, j, temp
    For Each i In objdict
      For Each j In objdict
        If (objdict.Item(i) <= objdict.Item(j)) Then
          temp = objdict.Item(i)
          objdict.Item(i) = objdict.Item(j)
          objdict.Item(j) = temp
        End If
    Set fn_SortDictionary = objdict
End Function

Concept 3:- How to sort dictionary Key-Item pairs based on the Item or key?

This is different from the above concept as we are not simply sorting the items or keys present in the dictionary but actually we are creating a new sorted dictionary. Some time it is required to sort the Key-Value pairs in ascending or descending order.
Note: - Here we are sorting on the basis of items and some time our item values can be repeating.

    'Creating dictionary
    Dim objDic
    Set objDic = CreateObject("scripting.dictionary")
    objDic.Add "USD", "80"
    objDic.Add "SAG", "55"
    objDic.Add "CAD", "80"
    objDic.Add "AUD", "50"
   'Function call to sort the dictionary
   Set objSDic = fn_SortDictionary(objDic)
   'Printing the Result of sorted Dictionary in the Msgbox
    For i = 0 To objSDic.Count - 1
        Txt = Txt & objSDic.keys()(i) & objSDic.items()(i) & vbCrLf
    Next i
    MsgBox Txt

'Function Name:-        fn_SortDictionary
'Function Description:- Function to sort the Key and item pairs in the given dictionary
'Input Parameters:-     Unsorted Dictionary object
'Output Parameters:-    Sorted Dictionary object
Function fn_SortDictionary(objIDict)

    'Taking the Orginal Keys
    arrKey = objIDict.keys
    'Taking the count of items values
    arrSort = objIDict.items
    'We would sort on the basis of Items but for keeping track which item belongs to the key
    'we would add index value to the existing items
    'Incase we have duplicating items we be still be able to sort.
    'Adding index to all the items
    For i = LBound(arrSort) To UBound(arrSort)
        arrSort(i) = arrSort(i) & ";" & i
    'Logic for sorting
    For i = LBound(arrSort) To UBound(arrSort) - 1
        For j = i + 1 To UBound(arrSort)
            'Split the value of arrsort so that we dont consider the index part
              arrFSortI = Split(arrSort(i), ";")
              arrFSortJ = Split(arrSort(j), ";")
            If Cint(arrFSortI(0)) < Cint(arrFSortJ(0)) Then
                'Concatenating the split array and joining the Index at the end
                Temp = arrFSortJ(0) & ";" & arrFSortJ(1)
                arrSort(j) = arrFSortI(0) & ";" & arrFSortI(1)
                arrSort(i) = Temp
            End If
        Next j
    Next i
    'Creating the Temp Dictionary object
     Set TempDict = CreateObject("scripting.Dictionary")
    'Adding sorted values to the dictionary
    For i = LBound(arrSort) To UBound(arrSort)
        KeyIndex = Split(arrSort(i), ";")
        TempDict.Add Key:=arrKey(KeyIndex(1)), Item:=KeyIndex(0)
    Next i
    'Returning the sorted dictionary
   Set fn_SortDictionary = TempDict
End Function

SQL Interview Questions(Set-2)

Here comes our next bundle of SQL interview questions. We have also given a brush up for the brief answer hints at the bottom. Hope it help you all in achieving your target job.

Keep sharing and Keep learning.

Do follow us for more updates on  Fb,G+,Twitter.

Learn more and share more
Learn more to achieve more...

  1. What is the difference between which and having clause?
  2. What is composite key? How it differs from Candidate key?
  3. We have 2 tables A&B. Write a query to get just non matching account ID from B table using joins.
  4. In the above table modify the query to fetch non matching account ID from both the tables(Means removing the common ID’s)
  5. How to remove duplicate values from a Table A.
  6. In question 5? How to delete only one duplicate row from a table for each combination?
  7. We have 2 tables, Candidate (id, name) and vote (id, Count), write a query to give the name of winning candidate?
  8. Write a query to find the nth maximum salary in a emp table
  9. What is a join? Explain the different types of joins?
  10. Explain the sequence of query execution?

1. Where clause cannot be used with aggregate functions (like sum, max, min, count) so we need to implement having clause.
Example for a Table A we need to count the applications where count is greater than 5, so we cannot create a query like select count (applications) from table A where count (app) > 5, we need to use ‘having’ clause select count (app) from Table A having (count (app)) > 5
Note: - We generally use having clause with group by clause but we can use it alone. If the SQL SELECT statement does not contain aggregate functions, here it would act like a Where clause itself.

2. Composite primary key is used to define more than one primary column for a table.
(ID integer,test
NAME varchar (30),
CLASS varchar (50),
Candidate key: - A Candidate Key can be any column or a combination of columns that can qualify as unique key in database. And there could be multiple Candidate Keys in one table. Each Candidate Key can qualify as Primary Key but we have only one primary key.
Note:-A table can have multiple Candidate Keys that are unique as single column or combined multiple columns to the table. They are all candidates for Primary Key. Candidate keys that follow all the three rules – 1) Not Null, 2) Unique Value in Table and 3) Static – are the best candidates for Primary Key.

3. We need to implement Left outer join on Table B and Table A.Also we used ‘Where’ clause to restrict the common records in both the tables.
SELECT B.Accountid
LEFT JOIN Table A AS A ON A.ID = B.Accountid
Right Outer Join Example

4. This time we would exclude the common ID’s again by using ‘Where’ Clause and “Full Outer Join”
SELECT  B.Accountid, A.ID FROM Table B AS B
FULL OUTER JOIN Table A AS A ON A.ID = B.Accountid
Full Outer Join Example

5.  It deletes any of the rows which are repeating from the table.
delete from Table A  where ID in (select  A.ID  from Table  A  group by ID  having
    count (*) >1)

7. We need to use “Inner Join” as we need the common data of both the tables based on the candidate ID.
SELECT  B.CandidateName
FROM Table Candidate AS B

8. SELECT TOP 1 Salary
      FROM Employee
      ORDER BY Salary DESC
      ) AS Emp
How it works, sub query it finds the N highest salaries in the Employee table and arranges them in descending order.Now,the outer query will actually rearrange those values in ascending order, which is what the very last line “ORDER BY Salary” does, because of the fact that the ORDER BY Default is to sort values in ASCENDING order. Finally, that means the Nth highest salary will be at the top of the list of salaries, which means we just want the first row, which is exactly what “SELECT TOP 1 Salary” will do for us.

9. Join means a guide to database to combine data from more than one table.
Types of join:-
Inner,Outer,Cross&Self Join

Inner Join: - inner join produces a result set that is limited to the rows where there is a match in both tables, thus it sends the matching data from joining tables

Outer types: - Left Outer, Right outer and Full Outer.

Left outer join: - It gives data from the left join table + the common data from the joining tables.

Right outer join: - Reverse of above, data from the right joining table + common data from the joining tables.

Full outer join:-A full outer join, or just outer join, produces a result set with all of the rows of both tables, regardless of whether there are any matches.
Thus full is the combination of left and right outer joins

Cross join: - The row count of the result is equal to the number of rows in the first table times the number of rows in the second table. Each row is a combination of the rows of the first and second table.

Self join: - Joining the same table twice

10 .General sequence of query execution :-
2. ON
3. Joins
10. Aggregate functions

More interview Questions. 
Learn Excel Programming concepts.

Approach to find last row or column using VB script in Excel?

We are sharing these techniques so that we can work with dynamic set of data in an Excel.
Finding last row of excel using code

Do follow us for more learning’s Fb,G+,Twitter.

Technique 1:- 
Using UsedRange property:- 
This approach is frequently implemented and one of our favorite. But sometime we have seen that incase some formatting is present in the sheet, it points till the last range of the excel (like 1,048,576 rows in excel -2013) itself rather than the last occupied row of the sheet. 

Technique 2:-
  • Using “CTRL+SHIFT+END” to find the last row 
  • Using “CTRL+SHIFT+Down Arrow” to find the last row 
  • Using “CTRL+SHIFT+left/Right arrow” to find the last column
'Function Name:-        fn_CalRange
'Function Description:- Function to Calculate the last row & last column
'Input Parameters:-     N/A
'Output Parameters:-    N/A
Sub fn_CalRange()
    Dim iLastRow
    Set objExcel = CreateObject("Excel.Application")
    'Making Excel visible to user
    objExcel.Visible = True
    Set oCountWB = objExcel.Workbooks.Open("D:\Test.xlsx")
    Set oCountWS = oCountWB.Worksheets("Sheet1")
    'Counting the Last row using 'Range' Property
    iLastRow = oCountWS.UsedRange.Rows.Count
    'Counting the Last Column using 'Range' Property
    iLastCol = oCountWS.UsedRange.Columns.Count
    MsgBox "Using Range Property Last Row: " & iLastRow & " Last Column:" & iLastCol
    '-4162 meaning xlUp
    'Using CTRL+SHIFT+END to find the last row
    iLastRow = oCountWS.Cells(oCountWS.Rows.Count, "A").End("-4162").Row
     MsgBox "Using CTRL+SHIFT+END, Last Row:" & iLastRow
     '*****************CTRL+SHIFT+Left Arrow*************
    'Using CTRL+SHIFT+left arrow to find the last Column
    '-4159 for xlToLeft
    iLastCol = oCountWS.Cells(1, oCountWS.Columns.Count).End("-4159").Column
     MsgBox "Using CTRL+SHIFT+Left Arrow,  Last Column:" & iLastCol
     '*****************CTRL+SHIFT+Down/Right Arrow************
     iLastRow = oCountWS.Range("A1").CurrentRegion.Rows.Count
     iLastCol = oCountWS.Range("A1").CurrentRegion.Columns.Count
     MsgBox "Using CTRL+SHIFT+Down/Right Arrow,Last Row:" & iLastRow & " Last Column:" & iLastCol
End Sub

More Excel Examples