我是 C++ 应用程序开发的初学者。我使用 Visual Studio,并且有一个应用程序可以像 Photoshop 一样处理图像。我希望通过保存处理过的文件来自动化我的应用程序的 UI 并自动测试各种场景。我在我的 Win 7 机器上使用 Visual Studio 进行开发,没有 .NET。我有哪些选项可以自动化我的测试?
谢谢
我对 XAML 或绑定不太熟悉,但我一直在每个 GUI 元素上设置 AutomationID。不幸的是,我找不到在ComboBox.
以下是在 XAML 中声明 ComboBox 的方式。
<ComboBox AutomationProperties.AutomationId="DialogRODB_TypeComboBox"
Height="23"
Margin="80,64,27,0"
VerticalAlignment="Top"
SelectedValue="{Binding Message.Move.Type}"
ItemsSource="{Binding Source={StaticResource MoveType}}" />
Run Code Online (Sandbox Code Playgroud)
在一个单独的类中,这是创建组合框中项目的地方。
public enum MoveType
{
[StringValue("INBOUND")] Inbound,
[StringValue("OUTBOUND")] Outbound
}
Run Code Online (Sandbox Code Playgroud)
我无法真正提供更多代码,但我可以尝试回答任何问题。
出于好奇,我决定编写一个简单的工具,其功能类似于UI Spy。基本上,它显示控件树并允许查看每个控件的属性。现在,我已经开始实现模式交互,并遇到了以下问题:一旦用户在我的应用程序 UI 自动化中单击“InvokePatter.Invoke”,就会将焦点切换到我的目标应用程序。其他模式也会发生同样的情况。它在原始 UI Spy 应用程序中的行为方式也相同。
这种行为使得我无法使用我的应用程序操作菜单,因为当我再次单击我的应用程序时,测试的应用程序将失去焦点并且菜单正在关闭。我想做的是使用 UI 自动化与应用程序交互,但保持我的(UI Spy)应用程序的重点。有什么想法如何实现它?或者至少如何实现所需的功能 - 允许用户与菜单交互?
我正在使用C#Excel VSTO加载项,该加载项利用user32.dll与excel UI进行一些黑魔法.我在使用Win32方面不是很有经验,我想知道:
我是否需要担心确保应用程序适用于XP及之后的所有Windows版本?或者假设我的Win32调用将在所有这些版本中一致地工作是否合理?
编辑:这是我正在使用的电话:
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static public extern IntPtr FindWindowEx(IntPtr hWnd, IntPtr hChild, string strClassName, string strName);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static public extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static public extern bool IsWindowEnabled(IntPtr hWnd);
Run Code Online (Sandbox Code Playgroud) 我正在运行一组测试,用于在网站的许多视图上验证URL和一些HTML/Angular项.基本上,测试会在左侧面板中抓取一个图标(在您悬停时移入和移出),然后出现一个菜单,其中包含您可以单击的按钮.一旦菜单出现并显示第一层按钮,就可以点击另一组按钮(子菜单).
当我将鼠标悬停在子菜单按钮上并单击这些按钮时,我将被发送到页面/视图,我可以在其中执行断言/验证.
菜单将在此时消失,直到我将鼠标悬停在图标上并再次执行上述操作.除了最多有15个子按钮点击之外,我的所有测试都通过了.我试图颠倒顺序,因为当时看不到几个按钮,但测试再次失败.
有没有人遇到过在浏览器中重复执行大量操作后测试失败的情况?我在想我是在装载司机或其他什么东西......
我收到以下错误:
Message:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Stack:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
3 specs, 1 failure
Finished in 63.217 seconds
ui-platform/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:113
var template = new Error(this.message);
Run Code Online (Sandbox Code Playgroud) 我正在使用 nightwatch.js,我对这个自动化测试还很陌生,我想通过 nightwatch.js 将值设置到元素的 style 属性中,所以我问,这可能吗?如果可能的话我们如何实现它。
我可以访问样式属性值,并可以通过以下 nightwatch api 命令进行检查,但我找不到任何方法来使用 nightwatch.js 将样式值设置为元素
browser.expect.element('#main').to.have.css('display').which.equals('block');
Run Code Online (Sandbox Code Playgroud) 使用 java 和 gradle 3.4 版编译 selenium 自动化应用程序时出现以下错误。
错误:
method until in class FluentWait<T> cannot be applied to given types;
return getWebDriverWait().until(ExpectedConditions.elementToBeClickable(GOTO_ICON));
^
required: Function<? super WebDriver,V>
found: ExpectedCondition<WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; ExpectedCondition<WebElement> cannot be converted to Function<? super WebDriver,V>)
where V,T are type-variables:
V extends Object declared in method <V>until(Function<? super T,V>)
T extends Object declared in class FluentWait
Run Code Online (Sandbox Code Playgroud)
构建.gradle
compile 'io.appium:java-client:3.1.0'
compile 'com.applitools:eyes-selenium-java-jersey1x:2.29'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.46.0'
compile 'org.seleniumhq.selenium:selenium-firefox-driver:2.52.0'
compile 'org.seleniumhq.selenium:selenium-ie-driver:2.52.0' …Run Code Online (Sandbox Code Playgroud) 在我的情况下,我很难理解和利用依赖注入。我想使用 Pico-container ( https://cucumber.io/blog/2015/07/08/polymorphic-step-definitions )。
这是我的情况......我目前有一个包含我所有 selenium 的 step 定义类,并且它变得太大了:
public class StepDefinitions{
public static WebDriver driver; // a driver is returned here from a static Driver Factory Class
LoginPage loginPage = new LoginPage(driver); //Page Object Model(s)
@Before("setup")
@After //screen snapshot
@After("destroy")
@Given //many methods with this tag
@When //many methods with this tag
@Then //many methods with this tag
}
Run Code Online (Sandbox Code Playgroud)
现在我想可能有一个包含我的驱动程序、POM 和 Hooks 的类:
public static WebDriver driver; //driver is returned from a static Driver Factory Class
LoginPage loginPage …Run Code Online (Sandbox Code Playgroud) 我已经在我的项目中安装了 Cypress,当我尝试使用 运行 Cypress 时npx cypress run,它给了我以下错误:
找不到要运行的任何测试。
我们查看了但没有在这个文件夹中找到 cypress.json 文件...
我正在使用Vividus来测试我的应用程序。
单击下载按钮后,如何测试文件是否已下载?
ui-automation ×10
java ×2
javascript ×2
.net ×1
angularjs ×1
automation ×1
c# ×1
combobox ×1
cucumber ×1
cypress ×1
focus ×1
frameworks ×1
gradle ×1
node.js ×1
protractor ×1
vividus ×1
winapi ×1
wpf ×1
xaml ×1