Thursday, December 3, 2009

Using Check and Cross mark in excel sheet

Use Marlett font for that cell
a refers to Check mark
r refers to Cross mark

Friday, November 27, 2009

TestComplete: - Programme customization

Sub Test1
Dim cpd
Dim frmCustomizeProgram
Dim panel
Dim textBox
Dim treeView
Dim button
Dim frmCustomizeForms
Dim label
Set cpd = Aliases.CPD
Call cpd.frmCPDMain.StripMainMenu.Click("Tools|Customize Database|Customize Programme")
Set frmCustomizeProgram = cpd.frmCustomizeProgram
frmCustomizeProgram.panel1.pnlTop.btnAddProgram.ClickButton
Set panel = frmCustomizeProgram.panel2
Set textBox = panel.txtProgramName
Call textBox.Click(152, 8)
textBox.wText = "Test Programme"
Call textBox.Keys("[Tab]")
Call panel.txtProgramMetadata.Keys("test description")
frmCustomizeProgram.pnlbottom.btnNext.ClickButton
Set panel = frmCustomizeProgram.panel3
Set treeView = panel.tvForms
j=3
MsgBox("|"+treeview.Nodes.Item(j).Text)
call treeview.ExpandItem("|"+treeview.Nodes.Item(j).Text)
for c=0 to 3
i=random(0,treeview.Nodes.Item(j).Nodes.Count-1)
call treeview.DblClickItem("|" + treeview.Nodes.Item(j).Text+"|" +treeview.Nodes.Item(j).Nodes.Item(i).Text)
aqUtils.Delay(1000)
if (panel.lstVwForms.Items.item(c).text=treeview.Nodes.item(j).Nodes.Item(i).Text) Then
Log.Message("Form selection thru double click Pass")
Else
Log.Message("Form selection thru double click Fail")
end If
Next
' --------------Checking Select button Functionality------------------------------------------
i=random(0,treeview.Nodes.Item(j).Nodes.Count-1)
Call treeview.ClickItem("|" + treeview.Nodes.Item(j).Text+"|" +treeview.Nodes.Item(j).Nodes.Item(i).Text)
Call panel.btnSelect.Click()
if (panel.lstVwForms.Items.item(4).text=treeview.Nodes.item(j).Nodes.Item(i).Text) Then
Log.Message("Form selection thru double click Pass")
Else
Log.Message("Form selection thru double click Fail")
end If
'------------verify result on doublicking already selected form--------------------------------
call treeview.DblClickItem("|" + treeview.Nodes.Item(j).Text+"|" +treeview.Nodes.Item(j).Nodes.Item(i).Text)
if panel.lstVwForms.Items.Count>5 Then
Log.Message("Double Clicking Already Selected Form | Fail")
Else
Log.Message("Double Clicking existing Form| Pass" )
end If
End Sub



function Random(min,max)
Randomize()
Random =Int ((max-min+1)*rnd+min)
end Function


Sub Test2
Dim panel
Set panel = Aliases.CPD.frmCustomizeProgram.panel3
Call panel.tvForms.DblClickItem("|Family Tracing and Reunification|FTR Adult Verification Form")
Call panel.lstVwForms.ClickItem("FTR - Rapid Registration Form", 0)
End Sub

Tuesday, November 24, 2009

Reading and Writing in Text File Vb Script

// VB Script
Sub WritetoFile( txtvalue)

dim fs,f
const ForReading=1,Forwriting=2,ForAppending=8,TristateFalse=0

path="d:\myfile.txt"

set fs=createObject("Scripting.FileSystemObject")
If not fs.FileExists(path) Then
set objFile=fs.CreateTextFile(path)
objfile.close()
End If
Set f=fs.OpenTextFile(path,ForAppending, TristateFalse)
f.write txtValue & vbCrLf
f.close()

End Sub


Sub ReadFile()

Const ForReading=1
Set fs=sys.OleObject("Scripting.FilesystemObject")
Set f= fs.OpenTextFile("d:\myfile.txt",ForReading)
f.skipline
While not f.AtEndOfstream
s=f.readline()
Count=getcsvcount(s)
For i=0 to count-1
Log.Message(Getcsvitem(s,i))
Next
Wend
f.close()

end Sub

sub test

call WritetoFile("Nitin")
call WritetoFile("Nitin")
call ReadFile()

end sub

Friday, November 20, 2009

Extending Test Complete Trial License

Delete the "regkey.dat" file on your machine. The file should be located in the following folder:

"C:\ProgramData\AutomatedQA\TestComplete\7.0" (for Windows Vista, Windows Server 2008)

"C:\Documents and Settings\All Users\Application Data\AutomatedQA\TestComplete\7.0" (for any other version of Windows


9876EDDA-9DE430BF-5BA4BEE1-6B84F60B-7BC395CD-D04A8A89-9509

TestComplete: Random Function

function Random(min,max)

Randomize()
Random =Int ((max-min+1)*rnd+min)

end Function

Accessing Grid Cell value

Property used to access grid cell value :

grid.wValue(rowindex,colindex)

Wednesday, November 18, 2009

VB Script and excel playing aroubd...

// Following code will read and write in an excel file.


Set objXL = CreateObject("Excel.Application")
Set objWB = objXL.WorkBooks.Open("C:\Documents and Settings\nsharma\Desktop\VB scripts\test1.xls")
Set objWS = objXL.ActiveWorkBook.WorkSheets("Sheet1")
Dim CellArray()
ACount = 0
For i = 1 To 10
If objXL.Cells(i, 8).Value = "" Then
CellValue = "Empty"
objXL.Cells(i, 9).Value="Pass"
Else
CellValue = objXL.Cells(i, 8).Value
End If
ReDim preserve CellArray(ACount)
CellArray(ACount) = CellValue
msgbox(cellvalue)
ACount = ACount + 1
Next
objWB.Close
objXL.Quit