Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To: Variable Checkpoint?
#1
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":

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? :(
Reply
#2
Got it:
Code:
strSQL= "select [...]" DbTable("DbTable").SetTOProperty "Source", strSQL DbTable("DbTable").Check CheckPoint("DbTable")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Variable in Checkpoint kapsig431 0 3,924 03-30-2012, 01:02 AM
Last Post: kapsig431
  Checkpoint on variable jove1776 1 4,427 11-30-2010, 10:38 AM
Last Post: manishbhalshankar
Wink standard checkpoint and text checkpoint kiran10_rm 1 5,965 11-18-2010, 05:16 AM
Last Post: nandu
  fullscreen and bitmap checkpoint error "Cannot create bitmap checkpoint" meuline 2 5,294 12-10-2009, 09:17 PM
Last Post: meuline
  Checkpoint problems: Checkpoint starts before web page is loaded & therefore fails! IdontGetIt 1 4,401 11-20-2009, 11:45 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)