Customization of test conditions?

Hello everybody,
IMHO list of test conditions for a Database Unit Test is too restricted, and of course I'd like to customize both list itself, and parameters in existing conditions.
Is there any way to do it?
[218 byte] By [paolod] at [2007-12-22]
# 1

Sorry, you cannot add test conditions to the drop-down list. However, you can add custom verification code to the C# or VB files behind the designer. Below is an example where I compare the first value in the first table of the first result set to an expected value of "expected" (not very realistic but I hope it helps). :)

Thanks!

-Jon

// Execute the test script
//

if ((testData.TestAction != null))
{
System.Diagnostics.Trace.TraceInformation("Executing test script...");
ExecutionResult[] results = Execute(executionCtx, testData.TestAction.BatchSql);
EvaluateConditions(executionCtx, results, testData.TestAction.Conditions);

// custom verification code
if (results[0].DataSet.Tables[0].Rows[0][0].ToString() != "expected")
Assert.Fail("Unexpected value");
}

JonLiperi at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 2

Jon

We're using the database professional testing functionality but are not .Net developers. You're workaround would be very useful to us. If you could post the VB equivalent of:

results[0].DataSet.Tables[0].Rows[0][0].ToString()

that would be a great. Thanks.

Mark

mamo at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 3

Hi Mark,

results(0).DataSet.Tables(0).Rows(0)(0)

It looks like the VB project could have better references added to it when a DBUnitTest is added to enable intellisense for the DataSet; I will look at adding that for the next CTP. In the meantime, if you could add a reference to System.Xml to enable intellisense. Remember, the DataSet is populated by results from the test execution, so it is possible to specify an invalid index into one of the above collections.

If we were to add test conditions, which/what test conditions would you like to see added?

J.D.Laflen at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 4
The issues we have relate to Scalar Test. Results may vary according to the server or type of build that we're running. If there was a more elegant way to make expected results condition based it would benefit us.
mamo at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...
# 5

Things have changed since CTP3 and I wanted to update this thread so we don't give anyone the wrong impression. As of CTP5, you can now create your own custom test conditions and plug them into the environment. For more information, read the help topic "How to: Add a New Test Condition to the Database Unit Test Designer" in the CTP5 documentation.

Thanks!

-Jon

JonLiperi at 2007-8-30 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Database Professionals...

Visual Studio Team System

Site Classified