标签: functional-testing

你使用WaTiR吗?

对于Ruby Web测试,是否有比WaTiR更好的单元测试工具?或者是事实上的标准?你使用什么单元测试工具?

integration-testing automated-tests web-testing watir functional-testing

2
推荐指数
1
解决办法
1766
查看次数

Android 2.1中的ActivityInstrumentationTestCase2有问题吗?

在为我的Android应用程序设置了所有单元测试用例后,我现在也想进行功能测试.但我解决了一个问题.当我为HTC Legend开发时,我现在只能使用高达2.1的Android平台.但从某种程度上看,ActivityInstrumentationTestCase2似乎不起作用.

public SupplierSelectoinTest() {
    super("com.sap.catalogue.activities", SupplierSelection.class);
}
Run Code Online (Sandbox Code Playgroud)

当我尝试运行测试时,这段简单的代码会给我以下错误:

java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.sap.catalogue.activities/com.sap.catalogue.activities.SupplierSelection }
at android.app.Instrumentation.startActivitySync(Instrumentation.java:371)
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:120)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:98)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:87)
at com.sap.catalogue.test.acceptance.SupplierSelectoinTest.setUp(SupplierSelectoinTest.java:27)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
Run Code Online (Sandbox Code Playgroud)

我阅读了所有教程,我得到的是,它应该可以工作,但事实并非如此.无论如何,当我切换到android 2.2(现在没有解决方案)并且我使用新的构造函数时,我只需要提交活动类而不是pkg字符串,模拟器将运行测试而不会抱怨.

但必须有一种方法让它在Android 2.1中运行!

另外 这些是我的两个Manifest.xml文件.第一个,是应用程序本身之一.另一个是测试项目之一.

应用程序Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.sap.catalogue"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Catalogue"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    <activity android:name=".activities.CategoryBrowser"></activity>

<activity android:name=".activities.ProductDetails"></activity>
<activity android:name=".activities.ProductSearch"></activity>
<activity android:name=".activities.ProductView"></activity>
<activity …
Run Code Online (Sandbox Code Playgroud)

testing android functional-testing

2
推荐指数
1
解决办法
4066
查看次数

功能测试中的路由问题

我正在做一个简单的测试项目,为我的测试做好准备.我对嵌套资源相当新,在我的例子中我有一个newsitem,每个newsitem都有注释.

路由如下所示:

resources :comments

resources :newsitems do
    resources :comments
end
Run Code Online (Sandbox Code Playgroud)

我正在为评论设置功能测试,但我遇到了一些问题.

这将获得newsitem的注释索引.@newsitem在setupc中声明.

test "should get index" do
    get :index,:newsitem_id => @newsitem
    assert_response :success
    assert_not_nil assigns(:newsitem)
end
Run Code Online (Sandbox Code Playgroud)

但问题出在这里,在"应该变得新".

 test "should get new" do
    get new_newsitem_comment_path(@newsitem)
    assert_response :success
 end
Run Code Online (Sandbox Code Playgroud)

我收到以下错误.

ActionController::RoutingError: No route matches {:controller=>"comments", :action=>"/newsitems/1/comments/new"}
Run Code Online (Sandbox Code Playgroud)

但是当我查看路线表时,我看到了这个:

new_newsitem_comment GET    /newsitems/:newsitem_id/comments/new(.:format)      {:action=>"new", :controller=>"comments"}
Run Code Online (Sandbox Code Playgroud)

我不能使用名称路径或我在这里做错了什么?

提前致谢.

resources nested ruby-on-rails functional-testing nested-resources

2
推荐指数
1
解决办法
1591
查看次数

如何在Android 4.0.3上运行CTS(兼容性测试套件)

我想在Android 4.0.3设备上运行CTS(兼容性测试套件).任何人都可以为我提供完整的步骤.我正在使用Ubuntu Linux机器连接到设备.我从http://source.android.com/compatibility/downloads.html下载了CTS文件.

请提供相同的步骤.

关心Rke

android functional-testing cts android-4.0-ice-cream-sandwich

2
推荐指数
1
解决办法
2万
查看次数

在Robotium中按下一个或完成的键

我只是遇到了Robotium试图通过功能测试重现错误.在登录期间从用户名字段移动到密码字段时,我的活动未设置为正确处理"下一个"键.我谷歌搜索了一下,我无法解决问题.我在我的Galaxy Nexus上尝试过这个:

    solo.clearEditText(0);
    solo.enterText(0, Constants.TEST_ACCOUNT_1.getUsername());
    solo.clickOnEditText(0);
    solo.clickOnScreen(672,1132);
    solo.clickOnEditText(0);
    solo.sleep(15000);
    solo.enterText(1, Constants.TEST_ACCOUNT_1.getPassword());
Run Code Online (Sandbox Code Playgroud)

我们的想法是在文本字段中单击以抬起键盘,然后尝试单击下一个按钮,但编辑文本字段中的单击不会抬起键盘.我也试过发送回车键,我尝试用FLAG_EDITOR_ACTION发送回车键,它们都没有模拟"下一步"键.救命!

android functional-testing robotium

2
推荐指数
1
解决办法
1637
查看次数

字符串的断言失败消息包含子字符串

我最近在文本生成软件的文本输出上做了很多功能测试,发现自己写了很多

assertTrue(actualString.contains(wantedString));
Run Code Online (Sandbox Code Playgroud)

但是,失败的消息是非描述性的

Expected [true], but was [false]
Run Code Online (Sandbox Code Playgroud)

另一种方法是将自定义失败消息包括为

String failMsg = String.format("Wanted string to contain: %s, Actual string: %s", wantedString, actualString);
assertTrue(failMsg, actualString.contains(wantedString));
Run Code Online (Sandbox Code Playgroud)

但是一直手动执行此操作感觉有点乏味.有没有更好的办法?

java string junit functional-testing assertions

2
推荐指数
1
解决办法
7599
查看次数

calabash-android:执行press_back_button时的INJECT_EVENTS权限(RuntimeError)

Action 'press_key' unsuccessful: java.lang.SecurityException:
Injecting to another application requires INJECT_EVENTS permission (RuntimeError)
Run Code Online (Sandbox Code Playgroud)

这是我在Calabash press_back_button在步骤定义中遇到命令时收到的错误.通过控制台执行时它可以正常工作,在测试中会产生错误.

有人可以帮忙吗?


操作系统:OS X 10.10

设备:Genymotion v2.3.1 Android v4.4仿真

calabash-android v0.5.5


android automated-tests functional-testing calabash-android

2
推荐指数
1
解决办法
2025
查看次数

如何让实习生运行功能测试

我正在努力将我们的单元/功能测试框架切换到实习生,但我尝试的所有不同配置导致实习生只运行单元测试而根本没有完成功能测试.

Selenium Standalone和ChromeDriver确实在4444端口运行.

我有一个配置文件,如下所示:

// Learn more about configuring this file at <https://github.com/theintern/intern/wiki/Configuring-Intern>.
// These default settings work OK for most people. The options that *must* be changed below are the
// packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites.
define({
    // The port on which the instrumenting proxy will listen
    proxyPort: 9000,

    // A fully qualified URL to the Intern proxy
    proxyUrl: 'http://localhost:9000/',

    // Default desired capabilities for all environments. Individual capabilities can be overridden by any …
Run Code Online (Sandbox Code Playgroud)

javascript functional-testing intern

2
推荐指数
1
解决办法
1782
查看次数

主机测试带有硬编码内存地址的C程序

我们将编写C代码的功能/单元测试.该C程序将作为嵌入式软件运行.但是,我们需要在Linux环境中运行测试.

问题是被测代码的部分内容如下所示:

my_addresses.h:

#define MY_BASE_ADDRESS     (0x00600000)
#define MY_OFFSET_ADDRESS   (0x108)
Run Code Online (Sandbox Code Playgroud)

my_code.c

#include "my_addresses.h"

static const My_Type* my_ptr =
  (My_Type*)(MY_BASE_ADDRESS + MY_OFFSET_ADDRESS);

/* my_ptr is dereferenced and used ... */
Run Code Online (Sandbox Code Playgroud)

显然,这在Linux主机环境中运行得不好.

我们有什么方法可以在测试期间解决这个问题吗?我们可以以某种方式"重定向"程序以使用其他地址,这些地址是在测试过程中分配的内存的有效地址吗?

我们的第一次尝试是在测试期间将"my_addresses.h"替换为另一个头文件,其中(extern)声明变量而不是硬定义 - 然后将malloc内存分配给MY_BASE_ADDRESS,等等.问题是"静态const" c文件中的声明.当然,您无法将变量分配给静态const类型.

优选地,我们不应该修改被测试的代码(尽管在最坏的情况下可能会出现这种情况).

c linux unit-testing memory-management functional-testing

2
推荐指数
1
解决办法
498
查看次数

Android执行功能测试订单

我有一个应用程序,其中MainActivity布局由两个TextView(tvName和tvEmail)和一个按钮(btnLogout)组成.

我有这些测试方法的功能测试(最后的代码):

  • testUserDetailsAreShown:检查TextView是否包含正确的文本值.
  • testLoginActivityStarts:对btnLogout按钮执行单击操作,并检查是否已加载LoginActivity.

我的问题是,如果我评论testLoginActivityStarts,那么testUserDetailsAreShown传递.但是,当两者都被取消注释时,两者都会失败.

java.lang.NullPointerException
at android.support.test.espresso.intent.Intents.resumedActivitiesExist(Intents.java:235)
at android.support.test.espresso.intent.Intents.intended(Intents.java:184)
at android.support.test.espresso.intent.Intents.intended(Intents.java:169)
at net.example.login.MainActivityTest.testLoginActivityStarts(MainActivityTest.java:46)
Run Code Online (Sandbox Code Playgroud)

android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: net.example.login:id/tvName
Run Code Online (Sandbox Code Playgroud)

我认为这是因为testLoginActivityStarts在testUserDetailsAreShown之前执行,并且当testUserDetailsAreShown正在执行时,加载的活动不是MainActivity,而是LoginActivity.

谁能帮我这个?我需要让两个测试通过.我相信他们应该通过.

这里测试代码:

public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
private String USER_NAME = "UserName";
private String USER_EMAIL = "UserEmail";

public MainActivityTest(){
    super(MainActivity.class);
}

public void testUserDetailsAreShown() {
    onView(withId(R.id.tvName)).check(matches(withText(USER_NAME)));
    onView(withId(R.id.tvEmail)).check(matches(withText(USER_EMAIL)));
}

public void testLoginActivityStarts() {
    onView(withId(R.id.btnLogout)).perform(click());
    intended(hasComponent(LoginActivity.class.getName()));
}
}
Run Code Online (Sandbox Code Playgroud)

testing android functional-testing android-testing

2
推荐指数
1
解决办法
558
查看次数