Functional Automation

RSS
  • Home
  • Manual
  • Automation
  • Performance
  • PMP
  • Interview Tips
  • Work Ethics
  • Contact

Benifits of Framework

Monday, May 17, 2010 by Mallik | 0 comments
Some key benefits of using this framework are listed below:

Moderate technical competency required for the use
– The framework in itself is very easy to use and does not require special automation skills unless there is a need for modifications or enhancements

Re-usability– The framework with its existing set of scripts and keywords can be used for automating any set of applications

Low maintenance cost – The only cost involved is when there is any change in the framework or requires a new Keyword

Rapid Automation Suite Development – The framework is ready to use and has minimal efforts required in terms of setting up the automation bed. Thus one can quickly come up with an automation solution for any application that has been identified for automation

Custom Reporting – Apart from the report generated by the test automation tool the framework supports custom reporting based on the parameters defined during the requirements stage of automation. This helps the QA analysts to quickly know the behavior of the application after an execution which is easy to read and understand from the application perspective

Tool independent – The framework can be used with various Test Automation tools, giving the freedom to the organization to choose any tool

Customization - The framework can be customized for application specific needs


Automation Objective & Framework

by Mallik | 0 comments
Test Automation is adopted in many projects with the objective of reduction in testing cycle times, reduction in efforts and resources and in turn attaining more focus on testing the critical and complex areas of application that need to be tested manually.

 Many people believe that test automation is record and play back, but it is not true. Test Automation Framework will be best approach to automate an application. Before I explain about Automation Framework, I want to illustrate few disadvantages of automation without Framework.

It worked when I recorded it!
This is a common problem across most of the Test Automation projects where the “Capture and Replay” method is used for automation. Scripts work perfectly when they are created while recording the test cases and stop working after a while with the same objects or after a few minor modifications to the application

 Skills required by the testers to use the tool
Since the scripts have to be changed frequently with the changes in the application, the testers necessarily have to know the scripting language and a level competency is required to support such changes

Reusability
Without frameworks it becomes difficult to apply any automation methodologies like keywords or functional decomposition. This reduces the chances of having any reusable scripts and leads to bulky scripts making it difficult to manage. This increases the script maintainability

Standardization
Automation engineers working on different automation projects tend to have their own set of the design, structuring, coding standards of scripts.


Emailing File as attachment using Function

Wednesday, May 12, 2010 by Mallik | 0 comments
SendTo = "abc@abc.com
Attachment = "C:\abc.txt"
 Set ol=CreateObject("Outlook.Application")
     Set Mail=ol.CreateItem(0)
     Mail.to = SendTo
     Mail.Subject="Test Results "
     Mail.Body=" Test Results"
   '  If (Attachment <> "") Then
       Mail.Attachments.Add(Attachment)
    ' End If
     Mail.Send
     'ol.Quit
     Set Mail = Nothing
     Set ol = Nothing

         


Time Stamp Function

by Mallik | 0 comments
MyTime = Now()
TimeStamp =  Year(MyTime) & Month(MyTime) &  Day(MyTime) &  "_" & Hour(MyTime) &  Minute(MyTime) & Second(MyTime)
MsgBox TimeStamp


VB Script Samples

Thursday, April 8, 2010 by Mallik | 0 comments
Setup Global Variable for Path
Method# 1
Set WshShell = CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("Process")
sWinDir = WshSysEnv("WINDIR")
sWinDir = sWinDir+"\OptionValidation.ini"
Note: OptionValidation.ini this is a ini file should be created and stored in C:\. The file should contain directory of working folder for script


Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(sWinDir,1)
ProjDir = ts.ReadLine
ts.Close

Method# 2
Set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
ProjDir = strDesktop&"\"&"Folder name in desktop"
_________________________________________________________________

Create Excel Objects
Set ExcelObj = CreateObject("Excel.Application")
Excelobj.visible = True
ExcelObj.Workbooks.Open

Set WorkSheetAct = ExcelObj.ActiveSheet

Retrieve Value from Excel
Variable = ExcelObj.cells(Row,Column).value
Variable will have value of particular row and column value.  
Ex:- Value1 = ExcelObj.cells(1,2).value
Value1 will have value in row 1 and Column 2 in excel spread sheet
_______________________________________________________________________
Sending Mail using Outlook


 Set ol=CreateObject("Outlook.Application")
     Set Mail=ol.CreateItem(0)
     Mail.to =
     Mail.Subject="Test Results For : "

     Mail.Body=" Test Results are generated  "
     If (Attachment <> "") Then
      Mail.Attachments.Add()
     End If
     Mail.Send
     ol.Quit

_____________________________________________________________________________
Database Connection

Driver_Name =  "Define name of database Ex: SQL Server or Oracle or ODBC"
Database_Name = "Name of Database for your app"
Server_Name = "Server name database is available"
User_Id =  " User id "
Pass_Word =  "Password"
Query_String =  "Query you want to execute"

 Function DatabaseConnection(Driver_Name,Database_Name,Server_Name,User_ID,Pass_Word,Query_String)
Dim con, rs,strSQL

Set con=Createobject("ADODB.Connection") 'Creates the connection object
Set rs=Createobject("ADODB.recordset") 'Creates a resultset

rs.CursorLocation = 3
rs.CursorType =3

con.connectionstring= "Driver={"&Driver_Name&"};Server="&Server_Name&";Database="&Database_Name&";Uid="&User_ID&";Pwd="&Pass_Word&";"
con.CommandTimeout = 7000
con.open 'connSTR 'Opens the connection
strSQL=Query_String 'Querry string
rs.open strSQL, con 'Executes the querry
Set DatabaseConnection = rs 'Returns the result set

End Function 


Retrive Records
Set reTable = DatabaseConnection(Driver_Name,Database_Name,Server_Name,User_ID,Pass_Word,Query_String)
If reTable.recordcount>0  Then 'Checks if there are rows in recordSet
For x=1 to reTable.recordcount

msgbox (reTable("provide Database column name").Value)
reTable.movenext 

Next
________________________________________________________________________________


String Length Function
There are many ways to find string length and depends on your scenario. I copied here most of scenarios i have used but these many not be suitable for you. 

Function Stlen(ProjDir,Str)
                Set DT = CreateObject("Excel.Application")
                DT.visible = True
                Set ab = DT.Workbooks.Open(ProjDir&"\File.xls")
                abc= 2
                st2 = Len(Str)
                Do while ( ab.Worksheets(1).cells(abc,16).value <> "EOD")
                        For j = 1 to st2-len( ab.Worksheets(1).cells(abc,16).value)+1
                                    mystring = Mid(Str,j,Len( ab.Worksheets(1).cells(abc,16).value))
                                    If lcase(mystring) =  LCase(ab.Worksheets(1).cells(abc,16).value) Then
                                            Stlen = lcase(mystring)
                                            Checked = "True"
                                            exit for
                                    end if
                        Next

                        If Checked = "True" Then
                                Exit Do
                        else
                        abc = abc+1
                        End If
            Loop
            'Next
            If Checked <> "True" Then
                    abc= 2
                    Do while ( ab.Worksheets(1).cells(abc,3).value <> "EOD")
                            For j = 1 to st2-len( ab.Worksheets(1).cells(abc,3).value)+1
                                    mystring = Mid(Str,j,Len( ab.Worksheets(1).cells(abc,3).value))
                            If LCase(Trim(mystring)) = LCase(ab.Worksheets(1).cells(abc,3).value) Then
                                    Stlen = mystring
                                    Checked = "True"
                                    exit for
                            end if
                        Next
                            If Checked = "True" Then
                                    Exit Do
                            else
                                    abc = abc+1
                            end if

                           
                    Loop
                End If

                ab.close
                DT.Quit
                Set DT = Nothing
End Function

Function Stlen2(ProjDir,Str)
                Set DT = CreateObject("Excel.Application")
                DT.visible = True
                Set ab = DT.Workbooks.Open(ProjDir&"\HFile.xls")
                abc= 2
                st2 = Len(Str)
         
                Do while ( ab.Worksheets(1).cells(abc,17).value <> "EOD")
                        For j = 1 to (st2-len(ab.Worksheets(1).cells(abc,17).value))+1
                                    mystring = Mid(Str,j,Len( ab.Worksheets(1).cells(abc,17).value))
                                    If lcase(trim(mystring)) =  lcase(trim(ab.Worksheets(1).cells(abc,17).value)) Then
                                            Stlen2 = lcase(mystring)
                                            Checked = "True"
                                            exit for
                                    end if
                        Next

                        If Checked = "True" Then
                                Exit Do
                        else
                        abc = abc+1
                        End If
            Loop
            ab.close
            DT.Quit
            Set DT = Nothing
End Function



Function Stlen(Str)
stlen = Len(Str)
for i = 1 to stlen
mystring = Mid(Str,i,1)
If mystring = "(" then
mystring2 = Mid(Str,i,stlen)
If i >20 Then
    mystring1 = mid(Str,1,20)
else
    mystring1 = mid(Str,1,i-4)
End If
'msgbox(mystring2)
exit for
end if
Next
Stlen = mystring1&mystring2
End Function
___________________________________________________________________________

Convert Excel file to CSV

Set ExcelObj = CreateObject("Excel.Application")
Excelobj.visible = True
ExcelObj.Workbooks.Open "C:\File1.xls"
ExcelObj.ActiveWorkbook.saveas "C:\File1.csv",6

ExcelObj.Quit
Set ExcelObj = Nothing


__________________________________________________________________________
Create a File 
   Dim fso, MyFile, x
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set MyFile = fso.CreateTextFile("C:\Documents and Settings\mallik\Desktop\test\testfile_"&i&".xml", True)
 MyFile.WriteLine("")
 MyFile.WriteLine ("")
 MyFile.WriteLine("")
 MyFile.Close
next 






Subscribe to: Posts (Atom)

View My Profile

View Mallik Dhupaguntla's profile on LinkedIn

Blog Archive

  • ▼  2010 (5)
    • ▼  May (4)
      • Benifits of Framework
      • Automation Objective & Framework
      • Emailing File as attachment using Function
      • Time Stamp Function
    • ►  April (1)
      • VB Script Samples

QA Followers

Copyright © 2010 Functional Automation