Articles On Testing

Wecome to !!!

Articles On Testing

Wecome to !!!

Articles On Testing

Wecome to !!!

Articles On Testing

Wecome to !!!

Articles On Testing

Wecome to !!!

Following code can be used to Read XML file by VBscript :-------------------------

Dim description, filepath
Set xmlDoc = CreateObject(”Msxml2.DOMDocument”)
Set ElemList = xmlDoc.getElementsByTagName(”segment”)
filepath = ElemList.item(0).getAttribute(”filePath”)
MsgBox filepath
Set ElemList = xmlDoc.getElementsByTagName(”description”)
plot = ElemList.item(0).Text
MsgBox plot

Difference between Rational Functional Tester & Rational Robot:

Rational Functional Tester is an automated functional testing and regression testing tool.
Provides testers with automated testing capabilities for functional testing, regression testing, GUI testing and data-driven testing.
- Enables testers to automate tests resilient to frequent application user interface changes with ScriptAssure™ technology
- Validates dynamic data with multiple wizards, verification points and support for regular expression patterns
- Automated wizard for data-driven testing increases test coverage by reusing individual tests with multiple sets of test data
- Allows the use of keywords to power portions of manual tests with automated testing
- Offers testers a choice of scripting language for test authoring and customization: Java in Eclipse® or Microsoft® Visual Basic .NET® in Visual Studio.NET
- Supports custom controls through proxy SDK (Java/.Net)
- Includes out of the box support for Web-based, .Net, Java, terminal emulator based applications such as 3270 (zSeries™) and 5250 (iSeries™), PowerBuilder, AJAX, Adobe Flex, Dojo Toolkit, Siebel, and SAP® applications
- Operating systems supported: Linux, Windows

Rational Robot is a test automation tool for functional testing of client/server applications.
Test automation tool for QA teams for testing client/server applications. Enables defect detection, includes test cases and test management, supports multiple UI technologies.
- Provides a general-purpose test automation tool for QA teams for functional testing of client/server applications
- Lowers learning curve for testers discovering the value of test automation processes
* Enables test-automation engineers to detect defects by extending test scripts and to define test cases
- Provides test cases for common objects and specialized test cases to development environment objects
- Includes built-in test management, integrates with IBM Rational Unified Process tools
- Aids in defect tracking, change management and requirements traceability
- Supports multiple UI technologies
- Operating systems supported: Windows

Functional testing and black box is a methodology used to test the behaviour that has an application from the viewpoint of their functions, validated for this purpose various aspects ranging from the aesthetics of the front end, the navigation within your pages between pages within the forms, the compliance of technical specifications associated with fields, buttons, bars, among other pages, entry permits and access to consultations and modifications, management of parameters, the management of the modules that constitute , and other conditions that make up the various "features" expected to provide the system to operate the end user as a normal and correct.

To meet this objective, the tester must choose a set of inputs under certain pre-defined within a certain context, and to check whether the outputs are correct or incorrect depending on the outcome defined in advance between the parties and / or techniques for the customer / supplier.

This form of testing an application is made "outside", that is why "black box testing" because the test covers the roads that follow the internal procedures of the program.
In connection with this test, although there are many tools now that this one out for various reasons will be published in future articles is: Selenium.
Selenium works directly on the web browser, its installation is simple and handling is so intuitive that allows quickly define and configure a test case, recording the journey in a page and then save the sequence of steps as a test script and and then play it when you want.
Selenium is an open-source tool that not only allows the testing of the system but also facilitates the acceptance testing of web applications.
Integrates with Firefox, and includes the ability to write the tests directly in Java, C #, Python and Ruby.
This solution has three basic tools to record a sequence of steps within a website, simulate the test with different browsers and automated test generation.
Selenium IDE is a plug-in for Firefox which allows you to record and execute scripts directly from your browser.
Selenium RC is a library and server written in Java that allows you to run scripts from local or remote through commands.
Grids Selenium: Selenium server allows multiple coordinate in order to run scripts on multiple platforms and devices at the same time.

Any Excel sheet 's inherent Code that executes with its first time opening :
Private Sub Workbook_Open()
Call ProtectSheets
End Sub

The code used to Protect or rather Lock down the cells within the Sheets and its Vice Versa :

Public Sub ProtectSheets()
    Dim ws As Worksheet
      For Each ws In Worksheets
          If Not (ws.Name = "Login Details") Then
             ws.Protect "Password:=a", UserInterfaceOnly:=True
          End If
          'Sheets("Queries").Visible = 2
  End Sub

Public Sub UnProtectSheets()

     Dim ws As Worksheet
          For Each ws In Worksheets
              ws.Unprotect "Password:=a"
  End Sub

Establishing Db Connection From An excel sheet and Vice Versa:


Private Function OpenDBConnection(objCon, Server, db_Instance, UsrId, Passwd)
   Dim connectionvarStringing
     Set objCon = CreateObject("ADODB.Connection")
    connectionvarStringing = "Provider=SQLOLEDB;Server=" & Server & ";Trusted_Connection=No;Initial Catalog=" & db_Instance & ";User ID=" & UsrId & ";Password=" & Passwd & ";"
   objCon.Open connectionvarStringing
End Function

' Close DB connection
Private Function CloseDB(objCon)
   Set objCon = Nothing
End Function

Getting Column Number for any particular column name witihn a Sheet :

Private Function getColumnNumber(varStringColName, varStringSheet)
     Dim i
       For i = 1 To 1000
           If varStringComp(UCase(Cells(1, i).Value), UCase(varStringColName), 0) = 0 Then
               getColumnNumber = i
       Exit For
          End If
 End Function

A generalised query Executed to fetch DB - Query results herein returning a sngle value :

Private Function Getval(Query, objCon)
      Dim var, p, objRec1, lavarStringowden
      Set objRec1 = CreateObject("ADODB.Recordset")
        ''executing denominator query
         objRec1.CursorLocation = adUseClient
        objRec1.Open Query, objCon, adOpenStatic, adLockOptimistic
       'count of records retrieved for den query
       lavarStringowden = objRec1.RecordCount

  If Not (objRec1.EOF) Then
          'writing query results to an Excel sheet "Results_Den_Records" of the file "worksheetqtp.xls" in Datasheet path
                 p = objRec1.getrows(lavarStringowden, 0)
                  var = p(0, 0)
              'DataTable.ExportSheet FileName, SheetName
            var = "No Data"
      End If
        'cleaning up
          Set objRec1 = Nothing
          Getval = var
 End Function

Code Segment Used To Clear The Contents From Sheets :

Private Sub RemoveContents_from_Sheets()
     Range("'" & OverallSheet & "'!A2:C30").ClearContents
     Range("'" & PDSheet & "'!A2:E50").ClearContents
     Range("'" & SMQSheet & "'!A2:E50").ClearContents
     Range("'" & ReleaseSheet & "'!A2:E30").ClearContents
     Range("'" & FunctionalSheet & "'!A2:E30").ClearContents
     Range("'" & WorkTypeSheet & "'!A2:E30").ClearContents
End Sub

User Input Via INput BOx and storing it into some Global Variables :

Private Function GetProjectId()
    Dim var
    Dim message, title
    Dim a
    message = "Enter Project Id"
    title = "Input Project id value"
     var = InputBox(message, title)
        If Not (IsNumeric(var)) Or var = "" Then
          a = MsgBox("Project Id value is not valid!" & vbCrLf & "Click Ok to enter valid Project Id OR" &    Lf & "Cancel to Exit", vbOKCancel, "Mandatory value")
       If a = vbOK Then
         GoTo EnterInputValue
      ElseIf a = vbCancel Then
          GetProjectId = ""
      'Exit Function
     End If
  End If
  GetProjectId = var
End Function

Selecting The First Cell in All sheets witihn a Excel Workbook except a particular one :

Private Sub selectFirstCell()
    Dim ws As Worksheet
     For Each ws In Worksheets
        If Not (ws.Name = "Queries") Then
        End If
 End Sub

Fetching Some values from Db with a connection varStringing Passed In As a Parameter :

Private Function FetchDates(connectionObject1)
    Dim varStringProjectId
    Dim varStringSheet
    Dim varStringQuery
    Dim ObjRecSet
    Dim rowCount, ColumnCount, a, b, p, i, j, ObjMsg

    varStringProjectId = GetProjectId()

   If varStringProjectId = "" Then
       NoRepDates = 0
   Exit Function
   End If

varStringQuery = "select distinct ReportingPeriodFromDate,ReportingPeriodToDate from dbo.MetricsCollectionPeriod where ProjectID ='" & varStringProjectId & "' and isdeleted='0'"
Set ObjRecSet = CreateObject("ADODB.RecordSet")

ObjRecSet.CursorLocation = adUseClient
ObjRecSet.Open varStringQuery, connectionObject1, adOpenStatic, adLockOptimistic

'count of records retrieved from the query
rowCount = ObjRecSet.RecordCount
'MsgBox rowCount
ColumnCount = ObjRecSet.fields.Count
' If no Reporting Dates are found Exit The Sub
If rowCount = 0 Then
NoRepDates = 0
ObjMsg = MsgBox("No Reporting dates available for the Project id: " & varStringProjectId, vbOKOnly, "Reporting Period")
Exit Function
NoRepDates = 1
End If

If Not (ObjRecSet.EOF) Then
a = 1
p = ObjRecSet.getrows()

a = 2
For i = 0 To (rowCount - 1)
   b = 2
      For j = 0 To (ColumnCount - 1)
          Sheets(OverallSheet).Cells(a, b).NumberFormat = "m/d/yyyy"
          Sheets(OverallSheet).Cells(a, b) = p(j, i)
          b = b + 1
     Sheets(OverallSheet).Cells(a, 1) = varStringProjectId
     a = a + 1

    MsgBox "No data retrieved for the query! "
End If
'cleaning up
Set ObjRecSet = Nothing

End Function

Validation Of The DB Credentials as specified in The excel sheet :

Private Sub ValidateExcelDBDetails()
   Dim Server_Name, db_Instance, User_name, Password
   Dim connectionvarStringing, objCon
    Dim i
     i = 2
  While (Sheets(LoginSheet).Cells(i, 1) <> vbNullvarStringing)
    Server_Name = Sheets(LoginSheet).Cells(i, 1)
    db_Instance = Sheets(LoginSheet).Cells(i, 2)
    User_name = Sheets(LoginSheet).Cells(i, 3)
    Password = Sheets(LoginSheet).Cells(i, 4)
   Set objCon = CreateObject("ADODB.Connection")
    On Error Resume Next
     connectionvarStringing = "Provider=SQLOLEDB;Server=" & Server_Name & ";Trusted_Connection=No;Initial Catalog=" & db_Instance & ";User ID=" & User_name & ";Password=" & Password & ";"
    objCon.Open connectionvarStringing
   If Not (Err.Number = 0) Then
       MsgBox "Error Code : " & Err.Description
      ExitFlag = 0
    Exit Sub
   ExitFlag = 1
  End If
   On Error GoTo 0
   i = i + 1
End Sub