Troubleshooting- Screenshots on Fail

Learn how to generate screenshots on test's fail.


[App(Constants.WpfAppPath, AppBehavior.RestartEveryTime)]
public class AppScreenshotsOnFailTests : DesktopTest
    public void MessageChanged_When_ButtonHovered_Wpf()
        var button = App.ElementCreateService.CreateByName<Button>("E Button");


        var label = App.ElementCreateService.CreateByName<Button>("ebuttonHovered");
        Assert.AreEqual("ebuttonHovered", label.InnerText);

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


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.