hi,
I have very simple query but in there I am returning it as an queryRowToStruct I have tried with some of the asserts it doesn't successfully tested.
here is my query which I am wondering to test with.
<cfquery name="q" >
SELECT *
FROM users AS u
WHERE u.email = <cfqueryparam value="#arguments.email#" maxlength="60" cfsqltype="cf_sql_varchar" />
AND u.password = <cfqueryparam value="#arguments.password#" maxlength="8" cfsqltype="cf_sql_varchar" />
</cfquery>
<cfif q.RecordCount EQ 1>
<cfreturn queryRowToStruct(q) />
</cfif>
here what checking is in case the email and password are matched the query will return a record if not it will be zero. when i have tried the below testing i got error recordCount not found though the record exists in db table. can any help me what i have to do to make this testing working ?
<cffunction name="testLogin">
<cfargument name="email" required="false" default="
ad...@yahoo.com" />
<cfargument name="password" required="false" default="admin" />
<cfset var x = login.login(ArgumentCollection=arguments) />
<cfset var result = x.RecordCount />
<!--- <cfset assertIsStruct(x) /> --->
<cfset assertEquals(2,result) />
</cffunction>
Thanks.