Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

Advanced Selenium RC logging with MSpec

Today I pushed some new features to MSpec to allow you to see this in MSpec’s html report when you get Selenium RC failures:

2009-10-19_1810

This is very similar to ruby’s selenium client’s rspec report. You can see a real example of that here.

So how do you get this? It’s pretty easy. All you need to do is grab and build the latest MSpec, add a reference to Machine.Specifications.SeleniumSupport.dll and add a class like the following to your assembly that contains your selenium specs in it:

  public class SeleniumSupport : SeleniumResultSupplementer
  {
    protected override string ImagesPath
    {
      get { return GetTempPath(); }
    }

    protected override DefaultSelenium Selenium
    {
      get { return ...; } // Replace with the DefaultSelenium in use 
                          // by the current running spec
    }

    static string tempPath;

    private static string GetTempPath()
    {
      if (string.IsNullOrEmpty(tempPath))
      {
        tempPath = Path.Combine(Path.GetTempPath(), "selenium");

        if (Directory.Exists(tempPath))
        {
          Directory.Delete(tempPath, true);
        }

        Directory.CreateDirectory(tempPath);
      }

      return tempPath;
    }
  }

That’s pretty much it. Like I said, this is brand new, just got it up today so please let me know if you have any problems with it. You can do so on twitter or the machine google group. Enjoy!

This entry was posted in mspec, selenium. Bookmark the permalink. Follow any comments here with the RSS feed for this post.