# Thread: Does TCsupport computation of complex math formula

1. ## Does TCsupport computation of complex math formula

For example... the following is a simple one...

q = Ut*Apf(tout-tin)+(SHGC*Apf*Et)

Where: q = instantaneous enery flow (W)
Ut = overall coefficient of heat transfer (W/m2-K)
tin = interior air temp (K)
tout = exteriour air temp (K)
Apf = total projected area of fenestration (m2)
SHGC = overall solar heat gain coefficient (unitless)
Et = incident total irradiance (W/m2-K)

Thanks

2. ## Re: Does TCsupport computation of complex math formula

Hi NiniRiya,

TestComplete uses the scripting engine by Microsoft. So, its calculating abilities are the same as those of the scripting language you are using in your TestComplete project.

3. ## Re: Does TCsupport computation of complex math formula

Usually I prefer not to use complex equations in a test script itself but rather just use a data-driven test to provide the expected output for the given inputs. (with optionally a level of acceptable deviation) It's bad practice to test an implementation of an calculation with your implementation of a calculation.

Problem is if the developers say find a more efficient algorithm that says produces the solution faster but only say .00001 percent less accurate, then you have to change out your hard coded equation in your test scripts.

4. ## Re: Does TCsupport computation of complex math formula

Actually, leaving in the slower, more accurate function would be a better test, because you would not only be testing that the function still operates within acceptable parameters, but also provides the appropriate response. If they've made the calculation faster, you'd be able to quantify the performance improvement and you'd also be able to show that the performance improvement is gained at the cost of accuracy.

5. ## Re: Does TCsupport computation of complex math formula

Thanks for the information. I have been able to write MS SQL queries for the formulas and get thr right results but how I'm looking for the best way to execute the same from TestComplete . A stored proc or a bunch of SQL Queries.

Here is a sample of my query.. TestComplete does not allow me to use temp tables and throws errors that the Temp table does not exist or you donot have permissions to delete.

Qry.SQL = "Drop Table #temp " +
"SELECT Energy,DNI,AvgTemperature,AvgWindSpeed ," +
"(((EXP(((AvgWindSpeed *-0.08672 )+-3.191)))*DNI)+ AvgTemperature)AS TMI," +
" Convert (float,0.0) TCelli, Convert (float,0.0) EN_DC INTO #temp " +
"FROM Detailed_Site_Output " +
" WHERE DateHourMinuteSiteTZ &gt;= :bDate AND DateHourMinuteSiteTZ &lt;= :lastDate AND DNI &gt;=200 and SiteID = :sid " +
" Order By DateHourMinuteSiteTZ "

Qry.SQL ="Update #temp set TCelli = TMI + ((DNI/1000) * 12.778)"

Any ideas would be appreciated.

Two things,

1.How to handle temp tables from TestComplete?
2. How to work with multiple queries from TC?

Need any best practices for these kind of scenarios.

Thanks
Riya

6. ## Re: Does TCsupport computation of complex math formula

TestComplete looks like does not support #hash tables but you can create a physical temp table and drop it after use.

And for multiple queries you can either write the queries seperately ..

Qry.SQL = " Select...."
Qry.EXECSQL();
Qry.SQL = "Update ..."
Qry.EXECSQL();

Or better yet use a Stored Proc to put all your queries..the following is the syntax to run it from TC.

Qry.SQL = "exec [usp_AutomatedTesting_DropIfExists] @tableName='Automationtemp1'"

Qry.EXECSQL();

Works well...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.