Learn how to use the BELLATRIX logging library.


[App(Constants.WpfAppPath, Lifecycle.RestartEveryTime)]
public class LoggingTests : DesktopTest
    public void CommonActionsWithDesktopControls_Wpf()
        var calendar = App.ElementCreateService.CreateByAutomationId<Calendar>("calendar");


        var checkBox = App.ElementCreateService.CreateByName<CheckBox>("BellaCheckBox");
        Logger.LogInformation("$$$ Before checking the transfer checkbox. $$$");



        var comboBox = App.ElementCreateService.CreateByAutomationId<ComboBox>("select");


        Assert.AreEqual("Item2", comboBox.InnerText);

        var label = App.ElementCreateService.CreateByName<Label>("Result Label");


        var radioButton = App.ElementCreateService.CreateByName<RadioButton>("RadioButton");


        radioButton.ValidateIsChecked(timeout: 30, sleepInterval: 2);


By default, you can see the logs in the output window of each test. Also, a file called logs.txt is generated in the folder with the DLLs of your tests. If you execute your tests in CI with some CLI test runner the logs are printed there as well. outputTemplate - controls how the message is formatted. You can add additional info such as timestamp and much more. For more info visit- https://github.com/serilog/serilog/wiki/Formatting-Output

Logger.LogInformation("$$$ Before checking the transfer checkbox. $$$");

Sometimes is useful to add information to the generated test log. To do it you can use the BELLATRIX built-in logger through accessing it via static Logger class.

Generated Log, as you can see the above custom message is added to the log.

Start Test
Class = EnsureAssertionsTests Name = CommonActionsWithDesktopControls_Wpf
Ensure control (AutomationId = calendar) is NOT disabled
$$$ Before checking the transfer checkbox. $$$
Check control (Name = BellaCheckBox) on WPF Sample App
Ensure control (Name = BellaCheckBox) is checked
Select 'Item2' from control (AutomationId = select) on WPF Sample App
Click control (Name = RadioButton) on WPF Sample App
Ensure control (Name = RadioButton) is checked


"logging": {
    "isEnabled": "true",
    "isConsoleLoggingEnabled": "true",
    "isDebugLoggingEnabled": "true",
    "isEventLoggingEnabled": "false",
    "isFileLoggingEnabled": "true",
    "outputTemplate":  "{Message:lj}{NewLine}",
    "addUrlToBddLogging": "false"

In the testFrameworkSettings.json file find a section called logging, responsible for controlling the logs generation. You can disable the logs entirely. There are different places where the logs are populated.