We are using WatiN – 2.1.0 to take a screenshot when an integration test fails. When running these tests locally on my dev VM all screenshot’s are recorded correctly (using IE8 or IE9).
However, when they are running on our integration server:
- windows server 2008 VM
- internet explorer 8
- we are running the watin tests from team city via nunit-console
The screenshots recorded on test failure are all black. I have reviewed several posts that cover similar concepts however they were all referencing earlier version of Watin. Has anyone had similar issues with the latest version?
Screenshot on test failure code:
[TearDown]
public void TearDown()
{
if (TestContext.CurrentContext.Result.State == TestState.Failure ||
TestContext.CurrentContext.Result.State == TestState.Error)
{
Browser.BringToFront();
Browser.CaptureWebPageToFile(DateTime.Now.ToString("ddmmyyyyHHmmss") + GetType().Name + ".png");
}
Browser.Close();
}
Well we found our issue. We had previously logged into our integration server as the user the tests were running as to monitor the tests.
If you connect a remote desktop to the test machine, make sure to reboot the machine when you are done, otherwise the desktop will remain locked and screen captures will not work.