Manually create my first test suite with NBi

First, create an Xml file with your favourite Xml editor. If you want to validate the syntax of your file during its creation, you can reference, in your editor, the XSD available in file NBi-TestSuite.xsd.

Your xml file should start with standard metadata information
<?xml version="1.0" encoding="utf-8"?>

Then, you must create a test suite and give it a name
<testSuite name="My first test suite" xmlns="http://NBi/TestSuite">

Inside your test suite, you need to specify your test and its name. This name will be used by the underlying framework (NUnit) and so will be displayed in reports and UI.
<test name="my first test">

For each test, you need to specify the system under test and the assertion that will be executed on this system. These two parts of the test are defined by the following xml elements:
<system-under-test />
and
<assert />

In our sample, we'll test the structure of a cube. The full test's desciption is to assert that through the perspective "my perspective's caption", I've a dimension (my dimension) with an hierarchy displayed to end-user with the name "my hierarchy".

First, we need to specify which kind of test we'll perform. Here we'll perform a test of structure. For this, we're using the xml element named structure inside the xml element system-under-test.
<system-under-test>
      <structure>
      </structure>
</system-under-test>

Then we'll need to specify on which specific element of the cube we want to apply our test. In this case on an hierarchy (under a dimension through a perspective). This is done be the means of the xml element hierarchy. The attribute caption will be filled with the caption of the hierarchy. Attributes dimension and perspective will be set to the name of the dimension and perspective. Finally we need to specify the connectionString to connect to the cube.
<system-under-test>
      <structure>
            <hierarchy caption="my hierarchy" dimension="my dimension" perspective="my perspective's caption" connectionString="Provider=MSOLAP.4;Data Source=.;Integrated Security=SSPI;Initial Catalog=MyCube;" />
      </structure>
</system-under-test>

After the definition of the system under test, you need to define what will be tested on this system. Here, we will assert that this system (the hierarchy) really exists. The xml element for this assertion is exists
<assert>
      <exists/>
</assert>

The full listing for this test is available here under:
<?xml version="1.0" encoding="utf-8"?>
<testSuite name="My first test suite" xmlns="http://NBi/TestSuite">
  <test name="My first test">
    <system-under-test>
      <structure>
            <hierarchy caption="my hierarchy" dimension="my dimension" perspective="my perspective's caption" connectionString="Provider=MSOLAP.4;Data Source=.;Integrated Security=SSPI;Initial Catalog=MyCube;" />
      </structure>
    </system-under-test>
    <assert>
      <exists/>
    </assert>
  </test>
</testSuite>

Naturally, you can specify more than one test in a test suite by creating more test elements.

Your next step is to effectively Run a test suite with NUnit GUI.

Test-Suite XML.png

Last edited Oct 28, 2014 at 6:43 PM by Seddryck, version 8

Comments

No comments yet.