zoukankan      html  css  js  c++  java
  • 使用UIAutomation自动化测试

    参考链接:

    http://wenku.baidu.com/view/05b0c4886529647d272852b8.html###

    code:

    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using NUnit.Framework; 
    using White.Core; 
    using White.Core.UIItems.WindowItems; 
    using White.Core.Factory; 
    using White.Core.UIItems; 
    using White.Core.UIItems.Finders; 
    
    namespace spy_test_4
    {
         [TestClass] 
    public class Calculator
         {
             [TestMethod] 
             public void calc()
             {             
                 Application calcapp = Application.Launch("calc.exe");
                 Window calcwindow = calcapp.GetWindow("计算器", InitializeOption.NoCache);
                 Button two = calcwindow.Get<Button>(SearchCriteria.ByText("2")); 
                 two.Click();
                 //Button add = calcwindow.Get<Button>(SearchCriteria.ByText("+"));
                 Button add = calcwindow.Get<Button>(SearchCriteria.ByAutomationId("93")); 
                 add.Click();
                 Button three = calcwindow.Get<Button>(SearchCriteria.ByText("3"));
                 three.Click();
                 Button equals = calcwindow.Get<Button>(SearchCriteria.ByAutomationId("121"));
                 equals.Click();
                 //TextBox output = calcwindow.Get<TextBox>(SearchCriteria.ByAutomationId("150"));
                 //var actualresult = output.Text;
                 string actualresult = calcwindow.Get(SearchCriteria.ByAutomationId("158")).Name;
                 if (actualresult == "5")
                 {
                     NUnit.Framework.Assert.AreEqual("5", actualresult);
                 }
                 else
                 {
                     NUnit.Framework.Assert.AreNotEqual("5", actualresult);
                 }
             }
         } 
    }

  • 相关阅读:
    Flink的入门
    Hadoop/Spark相关面试问题总结
    什么事分布式系统
    分布式的本质
    spark的shuffle机制
    Yarn的资源隔离机制
    hadoop和spark相关参数的配置
    分布式常问问题
    转一篇分布式消息队列的文章
    jquery 重要知识点总结
  • 原文地址:https://www.cnblogs.com/wangkangluo1/p/2606162.html
Copyright © 2011-2022 走看看