02-10-2009, 02:04 AM
I have a variable and want to create a checkpoint to pass/fail based on its value (i.e. pass if >= 1; fail of <= 0). How can this be done?
Specifically, I have a database call that retrieves rows based on a parameterized query. I want to fail if no rows come back, but pass if any do, regardless of the content.
I have tried modifying my query to select count(field) and return a number, then compare that using a database checkpoint, but I need to build the query progmatically because it contains arguments being passed in from the Global DataTable.
I am a Developer, not a Tester. I'm not really even sure why I'm the one doing this. Here is my "code":
I want to pass or fail based on the value of rs.recordcount. Why can't there be a Value Checkpoint that can be inserted anywhere in code? :(
Specifically, I have a database call that retrieves rows based on a parameterized query. I want to fail if no rows come back, but pass if any do, regardless of the content.
I have tried modifying my query to select count(field) and return a number, then compare that using a database checkpoint, but I need to build the query progmatically because it contains arguments being passed in from the Global DataTable.
I am a Developer, not a Tester. I'm not really even sure why I'm the one doing this. Here is my "code":
Code:
'ModelMaster lookup
Dim con, rs,strSQL, Param1, Param2
Param1 = DataTable("B", dtGlobalSheet)
Param2 = DataTable("A", dtGlobalSheet)
Set con=Createobject("ADODB.Connection")
Set rs=Createobject("ADODB.recordset")
rs.CursorLocation = 3
rs.CursorType =3
connSTR= "Driver={SQL Server};Server=vsql0001;Database=DB0001;Dsn=myRegistryName"
con.open connSTR
strSQL= "select Field1, Field2 from dbo.Table1 where Field1 in (select Field1 from dbo.Table2 where Param2 like '%"+Param2+"%' and active = 1) and (Field2 = '"+Param1+"' or Field2 like '"+Param1+" %' or Field2 like '%*"+Param1+"' or Field2 like '%*"+Param1+"*%')"
rs.open strSQL, con
msgbox rs.recordcount
rs.close
con.close
I want to pass or fail based on the value of rs.recordcount. Why can't there be a Value Checkpoint that can be inserted anywhere in code? :(