我们一直在计划使用Selenium对我们的Web应用程序进行UI测试.我们现在有了第二个想法.据我所知,Android和iOS设备的网络驱动程序不使用用户将使用的实际浏览器.相反,他们使用WebView,它可能与实际浏览器类似,也可能不同.我已经看到了针对Android的各种报告,这些报告似乎表明WebView的行为与内置浏览器和Chrome不同,后者现在是某些设备的默认设置.
您是否发现使用Selenium在实际硬件设备上进行测试是否值得?它比使用模拟器更准确还是更准确?您发现什么是使用自动化测试的最有效方法,让您觉得您的Web应用程序可以在您支持的所有硬件平台上正常运行?
在我们的案例中,我们需要在PC,Mac,平板电脑和手机上支持最新版本的主流浏览器.Selenium在PC测试中运行良好,但我对平板电脑和手机测试很关注.我们正在考虑是否应该自己推广或使用类似uitest.js的东西,我们实际上可以在实际的设备浏览器上运行.
我想对使用Jetpack Compose 的Activity 进行 UI 测试。该文档提供了有关如何使用两种变体测试此类屏幕的一些信息:
@get:Rule val composeTestRule = createComposeRule()
Run Code Online (Sandbox Code Playgroud)
如果我不需要活动本身运行并且只想测试我的可组合项或
@get:Rule val composeTestRule = createAndroidComposeRule<MyActivity>()
Run Code Online (Sandbox Code Playgroud)
如果我确实需要这项活动。
在第二种情况下,我如何将带有 Extras 的 Intent 传递给活动?
我试过了:
@Before
fun setUp() {
composeTestRule.activity.intent = Intent().apply {
putExtra(
"someKey",
123
)
}
}
Run Code Online (Sandbox Code Playgroud)
但活动中的意图额外内容仍然为空。
我正在windows上运行intelliJ idea 14.0.2 android开发环境,我正在尝试使用espresso UI测试框架来测试我的app.However当我按下运行androidTest配置时,我遇到以下情况:
Testing started at 12:09 PM ...
Waiting for device.
Target device: lge-nexus_5-05b1bd8af0ddba12
Uploading file
local path: C:\Users\AsiAnSeNsAtIoN\Documents\note\ECSE428\AssB_2\build\classes\main\AssB_2.apk
remote path: /data/local/tmp/com.cyc115.VectorCalculator
Installing com.cyc115.VectorCalculator
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.cyc115.VectorCalculator"
pkg: /data/local/tmp/com.cyc115.VectorCalculator
Success
Running tests
Test running startedFinish
Empty test suite.
Run Code Online (Sandbox Code Playgroud)
这是截图:

我的测试类看起来像这样:
package com.cyc115.VectorCalculator.test;
import android.support.test.espresso.assertion.ViewAssertions;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.SmallTest;
import com.cyc115.VectorCalculator.MyActivity;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
@LargeTest
public class MyActivityTest extends ActivityInstrumentationTestCase2<MyActivity> {
public MyActivityTest(){
super (MyActivity.class);
} …Run Code Online (Sandbox Code Playgroud) 我正在使用带有swift的Xcode 7构建一个自动化套件.
我的应用加载了以下警报视图:
在使用应用程序时,允许"Light Alarm"访问您的位置?
当我使用UI测试进行录制并单击此警报时,我会收到以下代码:app.alerts ["允许\ U201cLight警报\ U201c在您使用应用程序时访问您的位置?"]
注意:引号已替换为\ U201c
但是,当我尝试编译时,我收到以下错误:"文字中的转义序列无效"
有谁知道怎么绕这个?
我正在使用Xcode 7中的UI测试自动化应用程序.我有一个带有XCUIElements(包括按钮等)的滚动视图.有时XCUIElements是可见的,有时它们在scrollview上隐藏得太远(取决于我在scrollview上的位置).
有没有办法将项目滚动到视图中,或者可能会告诉它们是否可见?
谢谢
我使用Jenkins为各种xcode项目运行UI测试套件.大多数项目都显示"测试结果趋势"图表没有问题.
但是,我的一个项目无法显示图表.
我已经发现了几次构建,但是在显示图形的项目和那些不显示的项目之间找不到任何明显的差异:
真的对这一个感到茫然,所以我想发帖看看是否有其他人之前已经解决了这样的问题?
更新了更多详情:
可以手动完成在iOS中更改动态类型设置(设置>常规>辅助功能>较大文本).
但这似乎不适用于当前的模拟器(编写本文时为v9.3),并且手动执行此操作并不是需要自动化的解决方案.
问题:有没有办法启动具有动态类型设置的应用程序来启动具有更大字体大小的应用程序?
注意:这不仅对UI测试有用,而且还用于使用具有更大字体大小的Fastlane Snapshot创建屏幕截图.
只是想知道是否有可能在xcode中使用UITesting以某种方式在模拟器的自定义位置编码.我们有一个应用程序涉及许多位置更改,如果我们可以自动化位置更改作为我们的UITesting套件的一部分将是很好的.
我正在使用Spoon 2.0.0快照使用gradle-spoon-plugin为Android UI测试设置Spoon .我的项目是使用Android Gradle插件3.0.1设置的.
通过截屏时spoonRule.screenshot(activity, "hello"),我得到了这个RuntimeException:
java.lang.RuntimeException: Unable to create output dir: /storage/emulated/0/app_spoon-screenshots
at com.squareup.spoon.SpoonRule.createDir(SpoonRule.java:167)
at com.squareup.spoon.SpoonRule.createDir(SpoonRule.java:164)
at com.squareup.spoon.SpoonRule.createDir(SpoonRule.java:164)
at com.squareup.spoon.SpoonRule.obtainDirectory(SpoonRule.java:108)
at com.squareup.spoon.SpoonRule.screenshot(SpoonRule.java:66)
Run Code Online (Sandbox Code Playgroud)
如果我在Nexus 4 API 19仿真器上运行它,但它在Pixel 2 API 27仿真器上无法正常工作.权限已从19变为27,所以这并非完全出乎意料.
我已经尝试了当前可用的大部分建议,包括在我的androidTest目录中添加一个清单,用于授予读写外部存储(使用和不使用maxSdkVersion):
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="tv.twitch.android.test">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-sdk tools:overrideLibrary="android.support.test.uiautomator.v18"/>
</manifest>
Run Code Online (Sandbox Code Playgroud)
在这两种情况下,我都看到这些权限被合并到我的应用程序AndroidManifest的最终清单中(不确定如何检查测试应用程序的清单).
我已经尝试通过UIAutomator向应用和测试包授予权限:
val device = UiDevice.getInstance(getInstrumentation())
device.executeShellCommand("pm grant tv.twitch.android.test android.permission.READ_EXTERNAL_STORAGE")
device.executeShellCommand("pm grant tv.twitch.android.debug android.permission.READ_EXTERNAL_STORAGE")
device.executeShellCommand("pm grant tv.twitch.android.test android.permission.WRITE_EXTERNAL_STORAGE")
device.executeShellCommand("pm grant tv.twitch.android.debug android.permission.WRITE_EXTERNAL_STORAGE")
Run Code Online (Sandbox Code Playgroud)
这将输出一个Permission …
我在Pixel设备上尝试Android P预览,目前遇到使用UiAutomator框架编写的仪器测试问题.
每当使用UiAutomator通过以下代码模拟按钮点击时:
onView(withId(R.id.button_activity_login)).perform(click())
Run Code Online (Sandbox Code Playgroud)
我遇到一个带有消息的AlertDialog
Detected problems with API compatibility (visit g.co/dev/appcompat for more info)
Run Code Online (Sandbox Code Playgroud)
这导致了这个链接:
这打破了UiAutomator测试,因为我的测试目前不考虑每个动作之间的额外AlertDialog.
这只发生在UiAutomator的按钮点击,而不是Espresso的.我相信UiAutomator可能会在引擎盖下使用一些反射来实现跨应用程序测试功能(事先不知道UI组件的文本或ID),而Espresso负责处理被测试应用程序内的所有内容.
这有点奇怪,因为UiAutomator是Google自己在开发者网站上建议的测试框架(https://developer.android.com/training/testing/ui-automator.html#ui-automator-apis).有没有人经历过或解决过以下问题?