Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph-Wang committed Nov 25, 2013
2 parents f97180f + 2b5781b commit 6db7131
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 3 deletions.
Binary file modified ADO.vbs
Binary file not shown.
Binary file modified CheckPoints.vbs
Binary file not shown.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ functions to start the Application under test

functions to generate random Test data

## checkPoints.vbs
## CheckPoints.vbs

functions to check the test result and report them into standard reporters.

## ReadConfigFromExcel.vbs
only one function here.
`GetConfigFromExcel`
use it to get config Item&Value from a Excel file(a \*.xls not a \*.xlsx)
use it to get config Item&Value from a Excel file(a \*.xls)

## log.vbs
write logs
not necessary for test lib.
used for controller

## test
use QTP to test the lib
ADO.vbs & log.vbs are not in tests
Binary file modified ReadConfigFromExcel.vbs
Binary file not shown.
Binary file modified Test/Action1/Resource.mtr
Binary file not shown.
34 changes: 34 additions & 0 deletions Test/Action1/Script.mts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,32 @@ assert (len(theRandUnique) = 14), "应该生成14位唯一字符串"
theSelected = Browser(":=").Page(":=").WebList("html id:=theSelect").randomSelect()
assert (inStr(1, "1234", theSelected) > 0), "随机选择应该在可选范围内(1234)"

'''''''''''''''''
' > ReadConfigFromExcel.vbs
'''''''''''''''''
' unstable for x86
'Set theDict = GetConfigFromExcel("C:\Users\Administrator\Desktop\github\lib-for-qtp\test.xls","test","sKey","sValue")
'assert (theDict.Item("theItem") = "theValue"), "theItem对应的值应该是theValue"
'' an implementation of assertion
'''''''''''''''''
' > CheckPoint.vbs
'''''''''''''''''
theMatch = regSearch("\d+", "test123match")
assert theMatch="123", "没有找都匹配的123"

theRes = assertEqual(1, 1, 0)
assert theRes=true, "1=1断言应为真"
theRes = assertEqual(1, 2, 0)
assert theRes=false, "1=2断言应为假"

theRes = assertEqual("一部分", "一部分123!!!", 1)
assert theRes=true, "'一部分', '一部分123!!!'模糊匹配断言应为真"
theRes = assertEqual("一部分123!!!", "一部分", 1)
assert theRes=true, "'一部分123!!!', '一部分' 模糊匹配断言应为真"
theRes = assertEqual("一部分123!!!", "xyz", 1)
assert theRes=false, "'一部分123!!!', 'xyz' 模糊匹配断言应为假"

Function assert(expression, errDescription)
If expression Then
reporter.ReportEvent micPass, "Assertion", "Pass"
Expand All @@ -75,6 +100,15 @@ End Function















Expand Down
Binary file modified Test/Parameters.mtr
Binary file not shown.
Binary file modified Test/Test.tsp
Binary file not shown.
2 changes: 1 addition & 1 deletion Test/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ FitThinkTime=0

[RtsUserInfo]
UserName=
Password=5289edcde
Password=528cd581e

[RtsGeneral]
EnableAutoTrans=1
Expand Down
Binary file modified log.vbs
Binary file not shown.

0 comments on commit 6db7131

Please sign in to comment.