Robobench _ only tests triggered by APK test packages

Source: Internet
Author: User

I accidentally found that only the test package of APK could be used for automated testing. I was curious, so I recorded it and shared it with you.
1. Environment Configuration:
Android-SDK
Robotium-solo-3.0.jar has been downloaded to local
Re-sign.jar
Test package coup0.apk

2. Create a coupon0 project in eclipse, package name and activity name and Test

The package coupon.apk is the same.
3. Create an android test project coupon800test and a class

Coupontest. Java
The Code is as follows:
Package com. tuan111.coupon111;

Import com. tuan800111 .*;
Import com. jayway. Android. robotium. Solo. Solo;
Import Android. Test. activityinstrumentationtestcase2;
Import Android. Test. suitebuilder. annotation. smoke;

Public class coupon11test extends

Activityinstrumentationtestcase2 {

Private Solo;
Public coupontest () throws classnotfoundexception {
Super ("com. tua0.coupon", splashactivity. Class );
}

Public void setup () throws exception {
Solo = new solo (getinstrumentation (),

Getactivity ());
}

@ Smoke
Public void testopentext () throws exception {
Solo. clickonscreen (120,310); // open item text
Solo. clickinlist (1); // open item

Linkify
Boolean expected = true;
Solo. Sleep (3000 );
Boolean actual = solo. searchtext ("(? I ).*? Some

Text ");
Assertequals ("some text is not found ",

Expected,

Actual); // assert that some text is found

Solo. gobacktoactivity ("apidemos ");
Solo. Sleep (3000 );
}
@ Override
Public void teardown () throws exception {
Try {
Solo. Finalize (); // robotium will finish all

Activities that have been open
} Catch (throwable e ){
E. printstacktrace ();
}
Getactivity (). Finish ();
Super. teardown ();
}
}

4. The code in androidmanifest. XML is as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<Manifest

Xmlns: Android = "http://schemas.android.com/apk/res/androi

D"
Package = "com. tuan800.coupon"
Android: versioncode = "1"
Android: versionname = "1.0" type = "codeph" text = "/codeph">
<Uses-SDK Android: minsdkversion = "8"/>
<Instrumentation

Android: targetpackage = "com. tuan800.coupon"

Android: Name = "android. Test. instrumentationtestrunner"/>
<Application Android: icon = "@ drawable/icon"

Android: Label = "@ string/app_name">

<Uses-library Android: Name = "android. Test. Runner"/>
</Application>
</Manifest>
5. The following problems occur after running:
[2012-03-04 21:57:44-coupo0test] launching

Instrumentation Android. Test. instrumentationtestrunner

On device emulator 555
[2012-03-04 21:57:46-coupon0test] collecting Test

Information
[2012-03-04 21:57:51-coupon8test] Test Run failed:

Unable to find instrumentation info for: componentinfo

{Com. tua00.coupon/Android. Test. instrumentationtestrunn

Er}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.