Tizen.Appium
is a service library that supports running Appium for Tizen .NET applications. It can simulate user interactions on Tizen .NET applications (ElmSharp
,NUI
) and also cross platform Xamarin.Forms
application. As its name implies, it works based on the Appium that is an open source test automation framework.
Tizen.Appium
allows developers to write automated UI tests for Tizen .NET.
This link show how to setup the Appium.
To automated your Tizen .NET applications, add Tizen.Appium
as a pacakage referernce to your application project.
<PackageReference Include="Tizen.Appium" Version="1.0.0-preview2" />
ElmSharp and NUI applications require a Tizen.NET package version 6.0 or higher.
Xamarin.Forms application requires a Tizen.NET 4.0.0.
Add the following code to initialize Tizen.Appium
.
using Tizen.Appium;
class App : CoreUIApplication
{
protected override void OnCreate()
{
base.OnCreate();
#if UITEST
TizenAppium.StartService(AppType.ElmSharp);
#endif
//...
}
//...
}
using Tizen.Appium;
class Program : NUIApplication
{
protected override void OnCreate()
{
base.OnCreate();
#if UITEST
TizenAppium.StartService(AppType.NUI);
#endif
//...
}
//...
}
using Tizen.Appium;
class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
protected override void OnCreate()
{
base.OnCreate();
#if UITEST
TizenAppium.StartService();
#endif
LoadApplication(new App());
//...
}
//...
}
Tizen.Appium
automates the user interface by activating controls on the screen and performing input. To do this, you should assign a unique identifier to each controls.
Note that an exception will be thrown if an attempt is made to set the
AutomationId
property more than once.
In ElmSharp, the recommended way to set this identifier is by using AutomationId
property as shown below.
var button = new Button(window)
{
Text = "button",
AutomationId = "button"
};
The true is same on NUI application.
PushButton button = new PushButton
{
LabelText = "Button",
AutomationId = "button"
}
The true is same on Xamarin.Forms application.
Button button = new Button
{
Text = "Button",
AutomationId = "button"
}
Visual Studio has a template to help add a Tizen .NET UI Test projenct to an existing your application solution:
Upcoming Visual Studio Tools for Tizen will support this template. Until then, you can manually create and use the UI test project.
-
Right click on the solution, and select File > New Project
-
From the Tizen Templates, select the UI Test App template
-
Create a test project in Visual Studio
Select Visual C# -> Test -> Nunit Test ProjectIf you know use to other test project, you can use it.
-
Add
Appium.WebDriver
as a package reference to your project (*.csporj)
Tizen driver is supported from
Appium.WebDriver 4.0.0.2-beta
. Therefore, we recommend that you use the version or later.
- Add the following code to initialize the
TizenDriver
and set theAppiumOptions
public class UITest
{
TizenDriver<TizenElement> _driver;
[SetUp]
public void Setup()
{
AppiumOptions appiumOptions = new AppiumOptions();
appiumOptions.AddAdditionalCapability("platformName", "Tizen");
appiumOptions.AddAdditionalCapability("deviceName", "emulator-26101");
//Xamarin.Forms
appiumOptions.AddAdditionalCapability("appPackage", "org.tizen.example.FormsApp.Tizen.Mobile");
//ElmSharp
//appiumOptions.AddAdditionalCapability("appPackage", "org.tizen.example.ElmSharpApp");
//NUI
//appiumOptions.AddAdditionalCapability("appPackage", "org.tizen.example.NUIApp");
_driver = new TizenDriver<TizenElement>(new Uri("http://127.0.0.1:4723/wd/hub"), appiumOptions);
}
[Test]
public void Test1()
{
_driver.FindElementByAccessibilityId("Button").Click();
}
}
Write scripts with reference to Supported Commands
Make sure you set the appium server ip(ex:127.0.0.1:4723) and port number. You should set same server port number. (appium default port number is '4723')
If you want to find a device name, use 'sdb devices' command. You can find device list and the name.
-
Install Nunit3 Test Adapter
Go to Tools -> Extesion and Updates -> Select Online -> Search 'Nunit 3 Test Adapter'
Right-click on your test, and select ‘Run Test’.
If the test is fails, you can determine the cause.
- 4.0 or later version of
Wearable devices
andEmulator
.
- 4.0 or later version of
Emulator
.
- Not Supported due to security policy at the moment.