General steps

In this section, the basic requirements to run the test project will be explained, such as the .runsettings file, how to execute the unit, integration and functional tests.

Run settings

The .runsettings file is a xml file, that is used to configure the testing environment in a Visual Studio solution. This file is customizable, so for example, the .NET version used for the tests can be changed, also the parameters needed for the conversion tool test execution or the code coverage configuration. This file can be used for Unit, Integration/System and Functional Tests.

Run settings configuration example for unit and integration tests

Please check the paths in the TestRunParameters block, that variable should be modify according to the local repository path.

<RunSettings>
  <TestRunParameters>
    <Parameter name="Technology" value="Desktop" />
    <Parameter name="TestTimeout" value="10000" />
    <Parameter name="ApplicationUrl" value="D:\Repositories\WebMAPSilverlightConversionTool\bin\CmdRunner\Debug\net462\silverct.exe" />
    <Parameter name="OutputPath" value="C:\Automation" />
    <Parameter name="ConversionTool" value="D:\Repositories\WebMAPSilverlightConversionTool\bin\CmdRunner\Debug\net462\silverct.exe"/>
    <Parameter name="InputFolder" value="D:\Repositories\WebMAPSilverlightConversionTool\TestAssets"/>
    <Parameter name="OutputFolder" value="D:\Repositories\WebMAPSilverlightConversionTool\TestOutputs"/>
  </TestRunParameters>

  <!--CodeCoverage-->
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
        <Configuration>
          <CodeCoverage>
            <ModulePaths>
              <Include>
                <ModulePath>.*.dll</ModulePath>
              </Include>
              <Exclude>
                <ModulePath>.*.tests.dll</ModulePath>
                <ModulePath>.*.test.dll</ModulePath>
              </Exclude>
            </ModulePaths>
            <Attributes>
              <Exclude>
                <Attribute>.*Angular.*</Attribute>
              </Exclude>
            </Attributes>            
            <CompanyNames>
              <Exclude>
                <CompanyName>.*microsoft.*</CompanyName>
              </Exclude>
            </CompanyNames>
          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

Run settings configuration example for functional tests

Please check the technology used in the TestRunParameters, this variable is to indicate which QuallityMate support will be used for the functional tests.

<RunSettings>
  <!-- Configurations that affect the Test Framework -->
  <RunConfiguration>
    <DisableParallelization>false</DisableParallelization>
  </RunConfiguration>
  <!-- Parameters used by tests at runtime -->
  <TestRunParameters>
    <Parameter name="Application" value="http://localhost:4200/" />
    <Parameter name="Technology" value="WM_ISilver"/>
    <Parameter name="WebBrowser" value="Chrome"/>
    <Parameter name="StepTimeout" value="80000"/>
    <Parameter name="RunInBackground" value="false"/>
    <Parameter name="Incognito" value="true" />
  </TestRunParameters>
</RunSettings>

How to manually add the .runsettings file

For Visual Studio solutions, the first step is to add the .runsettings file. To do this, in Visual Studio 2019, click in the menu the Test option. Then click on Configure Run Settings, then in Select Solution Wide runsettings File.

The Windows File Chooser will be opened. Usually, the .runsettings file is located in the TestAssemblies folder. Please see the following image as guide.

How to execute unit and integration/system tests

To execute the unit tests in a Visual Studio solution, open the Test Explorer. To open the Test Explorer, please click in the menu the View option, then click on Test Explorer, or just press Ctrl+E, T in the keyboard.

In the left panel, the Test Explorer should be visible. To run all the tests click in the Run All Tests in View button.

To run each test individually, right click on the desire test, and the click in the Run or Debug option, depending on the purpose.

How to run functional tests

To execute the functional tests of WebMAP demos, follow the path WebMAPDemos\test\ui. For the desire solution, please follow the steps to add the .runsettings file. Usually, for WebMAP product demos, the functional tests work on a migrated version of the legacy application. For this reason, the migration process should be made before running the functional tests.

When the demo application is migrated and in a localhost site, the functional tests can be executed. As in the How to execute unit and integration/system tests section, the functional test can be executed in the same way, with the Test Explorer, right click on the desire test, and click Run button to execute the test individually.

Last updated