This project is read-only.

Test the availability of an element in the cube or tabular structure

System under test

The sample here under explains how to check the availability of a measure but it's also possible to check the existence of a perspective, dimension, hierarchy, level or measure-group following the same way.
You can also apply this kind of tests for SSAS Tabular and SSAS Multidimensional models. For Tabular developments you can use tests all the elements (dimension, measures, ... and sets since v1.10) of the multidimensional model but also for a Table or a Column for Tabular models.
In order to let you check that a measure is available through a perspective, you need to stipulate where you'll be looking for. This is done by creating a tag named "structure" under the node "system-under-test".
<test>
    <system-under-test>
        <structure/>
    </system-under-test>
</test>
In this xml node, named "structure", you'll need to specify for which element you'll check availability. For this you'll need to specify the type of element (perspective, dimension, hierarchy, level, measure-group or measure), its caption and also the parents.
For 'tabular' models, you can also check on a 'table' or 'column' element.

In the sample bellow, we're checking if a measure 'MyMeasure' exists in a measure-group 'MyMeasureGroup' through the perspective 'MyPerspective'
<structure>
    <measure caption="MyMeasure" measure-group="MyMeasureGroup" perspective="MyPerspective"/>
</structure>
Finally, the last information needed is the connectionString to reach your cube. This information must be provided by the means of the Xml attribute named "connectionString".
<structure>
    <measure caption="MyMeasure" measure-group="MyMeasureGroup" perspective="MyPerspective"
        connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
</structure>

Assertion

The assertion consists in a check that the element specified above exists (by exists we mean visible for the end-user browsing your cube).

So we need to specify that we'll perform an assertion of type "exists":
<test>
    <assert>
        <exists/>
    </assert>
</test>
The full test should be:
<test>
    <system-under-test>
        <structure>
    	    <measure caption="MyMeasure" measure-group="MyMeasureGroup" perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Display-folder for measures and hierarchies

It's not possible to check that a display-folder for measures or hierarchies exists. But anyway you can check that a measure (or hierarchy) is effectively available in the expected display-folder. Using the attribute display-folder.
<test>
    <system-under-test>
        <structure>
    	    <measure caption="MyMeasure" 
		display-folder="MyDisplayFolder\SubFolder"
		measure-group="MyMeasureGroup" perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>
If you want to specify that the measure (or hierarchy) should be in the root of the measure-group simply apply an empty value for the display-folder.
<test>
    <system-under-test>
        <structure>
    	    <measure caption="MyMeasure" 
		display-folder=""
		measure-group="MyMeasureGroup" perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>
If you don't specify the attribute display-folder then NBi will not take into account the display-folder when looking for your element. It means that if your measure (or attribute) is specified in the root or in a display-folder will not influence the result of the existence test.

Other elements

Perspective

For a perspective, you must specify the caption and nothing else.
<test>
    <system-under-test>
        <structure>
    	    <perspective caption="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Dimension

For a dimension, you'll need to specify the caption and the perspective
<test>
    <system-under-test>
        <structure>
    	    <dimension caption="MyDimension" 
		perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Hierarchy

For a hierarchy, you'll need to specify the caption, the dimension, the perspective and optionally the display-folder
<test>
    <system-under-test>
        <structure>
    	    <hierarchy caption="MyHierarchy"
		dimension="MyDimension" 
		perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>
Note that for a role-playing dimension you don't have to prefix the caption of your hierarchy by the name of the your role-playing dimension: The caption should be "MyHierarchy" and not "MyRolePlayingDimension.MyHierarchy".

Level

For a level, you'll need to specify the caption, the hierarchy, the dimension and the perspective
<test>
    <system-under-test>
        <structure>
    	    <level caption="MyLevel"
		hierarchy="MyHierarchy"
		dimension="MyDimension" 
		perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Property

For a property, you'll need to specify the caption, the level, the hierarchy, the dimension and the perspective
<test>
    <system-under-test>
        <structure>
    	    <property caption="MyProperty"
		level="MyLevel"
		hierarchy="MyHierarchy"
		dimension="MyDimension" 
		perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Measure-group

For a measure-group, you'll need to specify the caption and the perspective
<test>
    <system-under-test>
        <structure>
    	    <measure-group caption="MyMeasureGroup" 
		perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Set (new in v1.10)

For a set, you'll need to specify the caption and the perspective
<test>
    <system-under-test>
        <structure>
    	    <set caption="MySet" 
		perspective="MyPerspective"
        	connectionString="Provider=MSOLAP.4;Data Source=MyServer;Integrated Security=SSPI;Initial Catalog=MyCube;"/>
	</structure>
    </system-under-test>
    <assert>
        <exists />
    </assert>
</test>

Table

For a table of a tabular model, you'll need to specify the caption and the perspective
<test name="In perspective 'Internet Operation', the table 'Customer' exists">
	<category>Tabular</category>
	<system-under-test>
		<structure>
			<table caption="Customer" perspective="Internet Operation"
				connectionString="Provider=MSOLAP.4;Data Source=(local)\SQL2012TABULAR;Initial Catalog='AdventureWorks Tabular Model SQL 2012';localeidentifier=1033"		  
			/>
		</structure>
	</system-under-test>
	<assert>
		<exists />
	</assert>
</test>

Column

For a column of a tabular model, you'll need to specify the caption, the table and the perspective
<test name="In perspective 'Internet Operation', table 'Customer', the column 'Birth Date' exists">
	<category>Tabular</category>
	<system-under-test>
		<structure>
			<column caption="Birth Date" table="Customer" perspective="Internet Operation"
				connectionString="Provider=MSOLAP.4;Data Source=(local)\SQL2012TABULAR;Initial Catalog='AdventureWorks Tabular Model SQL 2012';localeidentifier=1033"		  
			/>
		</structure>
	</system-under-test>
	<assert>
		<exists />
	</assert>
</test>

Last edited Feb 26, 2015 at 9:40 AM by Seddryck, version 8

Comments

No comments yet.