我使用 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/