我已经搜索了 Windows Phone 8 应用程序中的自动化 UI,但我没有找到任何有用的工具或框架,那么是否有任何框架可以在 Windows Phone 8 中自动化 UI 应用程序?
最佳答案
您可以使用 Winium。
Why Winium?
-
You have Selenium WebDriver for testing of web apps, Appium for
testing of iOS and Android apps. And now you have Selenium-based
tools for testing of Windows apps too. What are some of the benefits? As said by Appium: -
You can write tests with your favorite dev tools using any WebDriver-compatible language such as Java, Objective-C, JavaScript with Node.js (in promise, callback or generator flavors), PHP, Python, Ruby, C#, Clojure, or Perl with the Selenium WebDriver API and language-specific client libraries.
-
You can use any testing framework.
How it works?
Winium.StoreApps consists of two essential parts:
-
Winium.StoreApps.Driver implements Selenium Remote WebDriver and listens for JsonWireProtocol commands. It is responsible for launching emulator, deploying AUT, simulating input, forwarding commands to Winium.StoreApps.InnerServer, etc.
-
Winium.StoreApps.InnerServer (the one that should be embedded into AUT) communicates with Winium.StoreApps.Driver.exe and executes different commands, like finding elements, getting or setting text values, properties, etc., inside your application.
Test samples:
Python
# coding: utf-8
import unittest
from selenium.webdriver import Remote
class TestMainPage(unittest.TestCase):
desired_capabilities = {
"app": "C:\\YorAppUnderTest.appx"
}
def setUp(self):
self.driver = Remote(command_executor="http://localhost:9999",
desired_capabilities=self.desired_capabilities)
def test_button_tap_should_set_textbox_content(self):
self.driver.find_element_by_id('SetButton').click()
assert 'CARAMBA' == self.driver.find_element_by_id('MyTextBox').text
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()
Please check the link below. It can help you a lot.
You just have to follow guidance in this project.
C#
using System;
using NUnit.Framework;
using OpenQA.Selenium.Remote;
[TestFixture]
public class TestMainPage
{
public RemoteWebDriver Driver { get; set; }
[SetUp]
public void SetUp()
{
var dc = new DesiredCapabilities();
dc.SetCapability("app", "C:\\YorAppUnderTest.appx");
this.Driver = new RemoteWebDriver(new Uri("http://localhost:9999"), dc);
}
[Test]
public void TestButtonTapShouldSetTextboxContent()
{
this.Driver.FindElementById("SetButton").Click();
Assert.IsTrue("CARAMBA" == this.Driver.FindElementById("MyTextBox").Text);
}
[TearDown]
public void TearDown()
{
this.Driver.Quit();
}
}
我目前正在使用这个开源开发 Windows Phone 自动化
项目,它对我来说效果很好。
关于testing - Windows Phone 8 应用程序中的 UI 自动化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16544730/