Customization of test conditions?
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?
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");
}
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
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?
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