Get a query from an assembly

If you want to test a Data Access layer there is a probability that queries are generated by .Net code contained in an assembly. Since version 1.1, NBi is able to perform a call to a method in an assembly and receive a string or a command (sql, adomd or oledb).

This feature offers the opportunity to test a query generated by a dll compiled in .Net and assert the syntax but also the result or the performance.

System-under-test

You need to define a system-under-test as an execution. Inside your execution element, you'll need to define from which method in which assembly you want to execute to retrieve your query. This is done by specifying the path of your assembly, the class and the method (attributes).
<system-under-test>
		<execution>
			<assembly path="NBi.Testing.dll" class="NBi.Testing.Acceptance.Resources.AssemblyClass" method="GetSelectMdx"/>
		</execution>
	</system-under-test>

Parameters

If your method expect some parameters you can specify them to NBi. When calling your method NBi will pass them. To do this, specify an element parameter and the attribute name filled with the name of the parameter in your method. The value that you want to pass is specified in the element.
<system-under-test>
		<execution>
			<assembly path="NBi.Testing.dll" class="NBi.Testing.Acceptance.Resources.AssemblyClass" method="GetSelectMdx"/>
				<parameter name="calendarYear">CY 2004</parameter>
			</assembly>
		</execution>
	</system-under-test>

It's possible to pass value for parameters of type string, any numerical type, enum and DateTime. If you want to pass a DateTime the value must be provided under the format YYYY-MM-DD or YYYY-MM-DD HH:mm. For an enum, just specify the string representation of the value for the enum (expl: Blue or MatchingCase).

Static method

If your method is static, you need to inform NBi by specifying the attribute isStatic to true

Last edited Apr 27, 2013 at 1:19 PM by Seddryck, version 1

Comments

No comments yet.