c# - 当前上下文中不存在名称 'AutomationId'

标签 c# testing ui-testing white-framework

我使用 UI 自动化测试进行组装(白色)。

我引入了一个类,其中包含要在此程序集中重用的所有 Autination Id:

public static class AutomationId
{
    public static class Toolbar
    {
        public const string MyControl = "MyControlId";
    }
}

现在我正尝试在我的测试类(同一个程序集)中使用它:

var control = mainWindow.Get<Button>(AutomationId.Toolbar.MyControl);

这段代码可以在本地编译。但是在 TeamCity 上我遇到了这样的错误:

The name 'AutomationId' does not exist in the current context

最佳答案

这是 C# 6 的一个特性。类似问题:The name 'nameof' does not exist in the current context

我刚才遇到了这个问题,导致我来到这里。我的研究表明您需要更新 Teamcity:

http://dave.ninja/2015/08/06/upgrading-teamcity-to-support-visual-studio-2015/

我们仍然必须这样做。上面的帖子展示了很多他们在升级过程中遇到的问题的解决方案。似乎不是一个太痛苦的过程。

关于c# - 当前上下文中不存在名称 'AutomationId',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29389615/

相关文章:

c# - 具有不可变类的 Entity Framework 6

testing - 在 Cypress 中运行测试的所有断言

swift - Xcode UI 测试记录器生成带有多个选项的长行

ios - 如何在 XCUIElementQuery 中获取 XCUIElement 的索引?

c# - 选择特定单选按钮时在 Gridview 中显示记录

C# - 验证基于 int 的 DateTime 没有异常?

c# - c#中的扩展方法和静态方法不匹配原型(prototype)匹配

javascript - React 的 Jasmine 测试给出错误并且不运行测试

unit-testing - 如何正确排序单元测试测试用例?

Android Espresso 失败 AssertionFailedWithCauseError