testing - Windows Phone 8 应用程序中的 UI 自动化

标签 testing windows-phone-8 ui-automation

我已经搜索了 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:

  1. 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.

  2. 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.

enter image description here

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();
  }
}

Winium.StoreApps

我目前正在使用这个开源开发 Windows Phone 自动化

项目,它对我来说效果很好。

关于testing - Windows Phone 8 应用程序中的 UI 自动化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16544730/

相关文章:

testing - "Can' t 打开 perl 脚本 "t/spec/fudgeall": File or directory not found"

scala - 使用 ScalaTest 中的 ScalaFutures 与 Await.result 的优势

unit-testing - 功能复杂的TDD如何应用?

windows-phone-7 - 目标 WP7 和 WP8.1(8.0 设备将获得 WP7 应用程序)?

php - 预览 PHP 中的电子邮件开发

c# - 获取 Windows Phone 8 中的电话号码

c# - 在 WINRT 应用程序中使用转换器

selenium - 获取 Appium 1.2 上的所有子元素

cocoa - Mac OS X (Cocoa) 应用程序的自动化 UI 测试工具

testing - 唤醒 : How to set output directory