AppService

Learn how to use BELLATRIX AppService.

Example

[TestClass]
[App(@"C:\demo-apps\WPFSampleApp.exe", AppBehavior.RestartEveryTime)]
public class AppServiceTests : DesktopTest
{
    [TestMethod]
    public void MessageChanged_When_ButtonHovered_Wpf()
    {
        var button = App.ElementCreateService.CreateByName<Button>("E Button");

        button.Click();
        
        Debug.WriteLine(App.AppService.Title);

        App.AppService.Maximize();
        App.AppService.Forward();
        App.AppService.Back();
        App.AppService.Refresh();
    }
}

Explanations

With the BELLATRIX desktop library, you can test various Windows applications written in different technologies such as- WPF, WinForms or UWP (Universal Windows Platform).

[App(@"C:\demo-apps\WPFSampleApp.exe", AppBehavior.RestartEveryTime)]

For the first two, you need to pass the path to your application’s executable.

[App(@"C:\demo-apps\WindowsFormsSampleApp.exe", AppBehavior.RestartEveryTime)] 

Starts WinForms app.

[App("369ede42-bebe-41ea-a02a-0da04991478e_q6s448gyj2xsw!App", AppBehavior.RestartEveryTime)]

For UWP applications you need to set the application’s installation GUID.

Debug.WriteLine(App.AppService.Title);

App.AppService.Maximize();
App.AppService.Forward();
App.AppService.Back();
App.AppService.Refresh();

Through AppService you can control the certain aspects of your application such as getting its title, maximise it or going backwards or forward.