Troubleshooting- Screenshots on Fail

Learn how to generate screenshots on test's fail.

Example

[TestClass]
[IOS(Constants.IOSNativeAppPath,
    Constants.IOSDefaultVersion,
    Constants.IOSDefaultDeviceName,
    Lifecycle.RestartEveryTime)]
public class ScreenshotsOnFailTests : IOSTest
{
    [TestMethod]
    public void ButtonClicked_When_CallClickMethod()
    {
        var button = App.ElementCreateService.CreateByName<Button>("ComputeSumButton");

        button.Click();
    }
}

Explanations

If it is turned on the engine will capture a screenshot in case the test failed.

Configuration

If you open the testFrameworkSettings.json file, you find the screenshotsSettings section that controls this behaviour.

"screenshotsSettings": {
    "isEnabled": "true",
    "filePath": "C:\\Troubleshooting\\Screenshots"
}

You can turn off the making of screenshots for all tests and specify where the screenshots to be saved. In the extensibility chapters read more about how you can create different screenshots engine or change the saving strategy.