Monday

Another reason why testing is so important!




Yet again we see a real life scenario showing what bad testing scenarios can do:

Nasdaq CEO Blames Software Design for Delayed Facebook Trading

  • May 21 (Bloomberg) -- Nasdaq OMX Group Inc., under scrutiny after shares of Facebook Inc. were plagued by delays and mishandled orders on its first day of trading, blamed "poor design" in the software it uses for driving auctions in initial public offerings.
  • "biggest IPO cross in the history of mankind" was occurring
  • Nasdaq's systems fell into a "loop" that prevented the second-largest U.S. stock venue operator from opening the shares on schedule following the $16 billion deal
  • Nasdaq will use an "accommodation pool" to pay back investors that should have received executions in the opening auction, based on the decisions of a third-party reviewer, Greifeld said. It may total $13 million, he said.
  • The IPO software "didn't work" even after thousands of hours of testing for "a hundred scenarios" aimed at anticipating problems
  • Volume during the auction amounted to 75.7 million shares, or almost 1 percent of trading during the entire day on all U.S. exchanges, according to data compiled by Bloomberg
Source: News

Automate recurring appointments on MS Outlook



Here is another piece of code that is fun when it comes to automating data from excel and setting up outlook recurring appointments.

strExcelPath = ""


Const olAppointmentItem = 1
Const olRecursWeekly = 1

Set objExcel = CreateObject("Excel.Application")
objExcel.WorkBooks.Open strExcelPath
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

intRow = 3
Do While objSheet.Cells(intRow, 1).Value <> ""
    strName = objSheet.Cells(intRow, 3).Value
    strDate = objSheet.Cells(intRow, 4).Value
   
    Set objOutlook = CreateObject("Outlook.Application")
    Set objAppointment = objOutlook.CreateItem(olAppointmentItem)

    strStart = strDate & "/2012 11:00 AM"
    strEnd = strDate & "/2099 11:00 AM"
    objAppointment.Start = strStart
    objAppointment.Duration = 30
    objAppointment.Subject = strName & " Birthday Reminder"
    objAppointment.Body = "Today is " &strName& "'s Birthday!"
    objAppointment.Location = "Team Decides"
    objAppointment.ReminderMinutesBeforeStart = 15
    objAppointment.ReminderSet = True

    Set objRecurrence = objAppointment.GetRecurrencePattern
    objRecurrence.RecurrenceType = 5
    objRecurrence.PatternStartDate = strStart
    objRecurrence.PatternEndDate = strEnd

    objAppointment.Save
   
    Set objRecurrence = nothing
    Set objAppointment = nothing
    Set objOutlook = nothing
 
    intRow = intRow + 1
Loop

' Close workbook and quit Excel.
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
set objSheet = nothing
set objExcel = nothing

Happy automating!

Thursday

DOM and IE Automation



There are many forums and posts from testers trying to automate scripts by using DOM(Document Object Model) of the internet explorer.

Here is a script that i used recently along , that will help anyone using the DOM and windows shell scripting :


Option Explicit

Sub WaitForLoad(obj)
    Do While ie.Busy
    Loop
    Do While obj.readyState <> 4
    Loop
    wscript.sleep(100)
End Sub

'Create ie and shell object
Set ie = WScript.CreateObject("InternetExplorer.Application")
Set WshShell = WScript.CreateObject("WScript.Shell")

'set the ie properties
ie.ToolBar = 1
ie.StatusBar = 1
ie.Width = 999
ie.Height = 999
ie.Left = 0
ie.Top = 0
ie.Visible = 1

'navigate to the web page
ie.Navigate("http:\\xyz.com")

'wait until the page has loaded before continuing
WaitForLoad(ie)

'Enter the user details
ie.Document.All.Item("txtUser").Value = strUser
'strUser = Trim (InputBox ("Plz enter the password"))
ie.Document.All.Item("pwdPass").Value = strPwd
ie.Document.All.Item("ddlHub").Value = "42d490a3-5107-435c-960d-a76e6d953ee9"
ie.Document.All.Item("butSubmit").Click
'ie.Document.getElementsByName("butSubmit").Item(0).Click

'wait until the page has loaded before continuing
WaitForLoad(ie)
WshShell.AppActivate "Main - Microsoft Internet Explorer"
For i=1 to 2
    wshShell.sendkeys "{TAB}"
    wscript.sleep(200)
Next
wshShell.sendkeys "{DOWN}"

ie.Document.getElementsByName("ctl00$ContentPlaceHolder1$btnView").Item(0).Click
ie.Document.All.Item("chkall").click

Set colLinks = ie.Document.getElementsByTagName("a")
intDay = Weekday(date)
If intDay = 2 then
    intOff = 2
elseif intDay = 3 then
    intOff = 4
End if

intcount = 0
For Each objLink In colLinks
    ' check text for link
    If InStr(UCase(objLink.innerHTML), "OFF") > 0 Then
    ' navigate to the first match and exit the for...next loop
        intcount = intcount + 1
     If intcount = intOff then
     'ie.Navigate objLink.href
     objLink.click
     Exit For
    End If
End If
Next

Set ie = nothing
Set colLinks = nothing
Set WshShell = nothing


Happy Testing!