Search code examples
pathfitnessefitsharp

How to get FitNesse root or page folder in FitSharp


Recently I encountered this problem and have searched a lot but no solution by now. Does somebody know how I can get the root directory or the page folder of FitNesse in FitSharp fixture codes? One of the troubles is that we have a lot of existing pages arranged in different suites and I want to add some new features to all these pages requiring an absolute path of FitNesse folder. Using a fixture together with the environmental parameter in pages could require a lot of effort. I was even trying to use hard configuration in app.config for example!

Big thanks in advance! Looking forward to your kind answer.


Solution

  • The root path is available as a FitNesse predefined variable. Pass that into a fixture that can expose it as a property. This could go in a setup page.

    |rootpath|
    |load|${FITNESSE_ROOTPATH}|
    
    public class RootPath {
      public static string Path;
      public void Load(string value) { Path = value;}
    }