>From this stackoverflow question:
http://stackoverflow.com/questions/10113800/including-images-in-mbunit-report-exports

We execute MBunit tests in a CI system that generate HTML reports, as
well as machine readable reports. I'd like to attach images to the
HTML reports.

When running via Gallio.Icarus, the images show in the execution log.
Unfortunately, they are not available to the HTML report. MBunit saves
the images in "C:\Users\username\AppData\Local\Temp\Gallio\".

Background and Goal: We run WebDriver tests in all our supported
browsers through our CI system. When tests fail, we spend a lot of
time debugging. A picture speaks a thousand words, so I'll attach a
screen shot to the report. Running Icarus to see the output would be a
manual process, which defeats the point of automated testing.

Code sample: (The RemoteScreenShot implementation is a port of java
RemoteScreenShot to C#:

http://code.google.com/p/selenium-remotewebdriver-screenshot/source/browse/src/main/java/RemoteScreenshot.java
)

    [SetUp]
    public void SetUp()
    {
        var capabilties = new DesiredCapabilities(new
Dictionary<string, object>() {{"browserName", "internet explorer"}});
        // This is a subclass of RemoteWebDriver that supports
screenshots.
        _driver = new RemoteScreenShot(new Uri(HubServer),
capabilties);
        _google = new GoogleHome(_driver);
    }

    [Test]
    public void TestScreenShot()
    {
        _driver.Navigate().GoToUrl("http://www.google.co.uk";);
        var screenShot = ((ITakesScreenshot)_driver).GetScreenshot();
        screenShot.Should().Not.Be.Null();
        using (var stream = new MemoryStream(screenShot.AsByteArray))
        {
            var image = new Bitmap((stream));
            TestLog.Write("Hello");
            TestLog.AttachImage("Screenshot", image);
        }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mbunituser?hl=en.

Reply via email to