Home - essenius/FitNesseFitSharpFixtureExplorer GitHub Wiki

Welcome to the FitNesseFitSharpFixtureExplorer wiki!

Finding Fixture Capabilities with Fixture Explorer

One of the concerns people sometimes have about FitSharp fixtures is that it isn’t clear which fixture functions are available unless you have the assembly documentation. Using .NET reflection, it is possible to identify the fixture functions that are available to FitSharp. The Fixture Explorer takes this approach and shows the result in a Table table. This repo contains the source code.

The assembly has a very simple interface. Here is an example:

!|table:fixture classes|TestAssembly.dll|

!|table:fixture functions|TestAssembly.dll|

The test run of the first table should show an overview of the available fixture classes in the assembly:

Fixture Classes of Test Assembly

It shows you only the classes in the fixture that can be used by FitSharp, i.e. public non-static ones. It does this based on the constructors; the Parameters column show which parameters the constructors expect. The column Supports Table Type shows which FitNesse test table types are supported in this class. It does this by checking if the minimum required interface for those table types is supported by the fixture code. The last column is Documentation. It fills this by examining the XML documentation facility that C# supports natively. Make sure to generate an XML documentation file in the builds to make use of this. This file should have the same name as the assembly that it describes, but then with the extension .xml instead of dll.

Here is an example of the documentation of the test assembly:

public class PublicClass
    {
        /// <summary>
        ///     Just a demo public class constructor with one parameter
        /// </summary>
        /// <param name="input"></param>
        public PublicClass(int input) => PrivateProperty = input;

Notice how the content of the summary attribute are visible in the screenshot above.

Fixture Explorer also uses attributes such as Obsolete("Message") to highlight that a function has been deprecated. You can also see that in above screenshot. Here is how to specify that:

namespace TestAssembly
{
    /// <summary>A deprecated class</summary>
    [Obsolete("Use Public Class instead")]
    public class DeprecatedClass
    {
        private readonly string _parameter;

        public DeprecatedClass() => _parameter = "none";

        /// <summary>
        ///     Documentation for constructor with one parameter
        /// </summary>
        /// <param name="parameter">documentation for the parameter</param>
        public DeprecatedClass(string[,] parameter) => _parameter = parameter[0, 0];

        public string PublicMethodInObsoleteClass() => _parameter;
    }
}

A few points to highlight here:

  • The first constructor does not have documentation, but the class has. So that is used instead.
  • The second constructor has documentation for summary and params. Both are shown. The class documentation is not used here.
  • While the constructors are not marked obsolete, they are still marked as deprecated in the screenshot, since the class is marked obsolete.

The second table shows all the functions that are available per fixture class. Here are the first few lines of that:

Fixture Functions of Test Assembly

Some notes:

  • If the Documentation field happens to be empty, then there is no corresponding XML documentation for the element, and it doesn’t have an Obsolete attribute.
  • If you mark a class Obsolete, then members without their own documentation will also receive the deprecation notification.
  • If you don’t document constructors but do document the class, the class documentation will be taken over for the constructors.
  • The table will also show internal methods or properties, but by convention these are not intended for public use, and the Documentation column will warn about that via `Internal use only. Do not use in tests'.
  • Also the documentation elements <returns> and <remarks> are taken over in the Documentation field if they exist.

Acceptance Testing Wiki

⚠️ **GitHub.com Fallback** ⚠️