Taibai---Falling swallow the first heavy Android unit test instrumentation and Irobotium

Source: Internet
Author: User
Tags save file

PS: Called the white---falling yan pure fun (the end of the Moon game screen sense, the impact, although the collision is not satisfactory, but the white this occupation is good, as the beginning, to do a narration just).

Unit tests here, whether instrumentation or irobotium, are not suitable for games, and the automation of the game can be referred to in-company Wetest's engine-based object recognition automation solution or in front of the Sikuli scenario. This applies only to the traditional industry application category. But the basic idea is similar, is to find the corresponding object, execute the corresponding method, and here the target is the specific class inside a function.

Generally speaking, a story always has an opening monologue, here also, but not so cool, but not how God (Xing) Secret (Gan) scenes ...

The background of the story is very simple, with the wind blowing in autumn trees, yellowing of the leaves are blown down generally simple, direct. It is necessary to store (non-sdcard) space in the machine itself when the user clicks on the save file and deposits the specified content into the file. And as a Xia (xi) for the test, want to make a white box directly, verify ...

Material required for the copy: Eclipse+ddms, an already rooted Android phone (must be root, no root I got a hole)

Copy brush, loading copy one of the components:

The final little boss who needs to kill the copy is here, go to the Dungeon Room and view the dungeon scene Details:

Level Limited, can only first to brush a little boss room, do not blame, do not abandon, as long as the experience of fun, not too (Zuo) care details (SI) ~ ~

Copy the brush and start preparing murderous:

In the project being tested, the corresponding Androidmainfest is added

Pay attention to the location of the kill, kill the wrong position, everything is wasted ~

<uses-library android:name= "Android.test.runner"/>---------to introduce the dependent libraries required for Android unit testing

Instrumentation android:name = "Android.test.InstrumentationTestRunner" android:targetpackage= " Com.example.fileoper "

The key material and the corresponding kill copy name that will be used to kill the item.

Ready almost, can start to kill the small boss, saw then clapped,,, a white light across

New out of your class, used to test the method of the class being tested. Watch out for new when extends

It, or you will find that after the white light fell on the little boss of the Wave sound ~ ~ ~

Then, brush, the knife up and down, the little boss will fall down, you can get copy props: Android Instrumentation Unit Test Small dagger. Attack 1-10 Defense 1-10 additional properties: Mysterious props can be seen

In the dungeon kill process, by the small boss to engage in the small damage to the place:

1, must carry the corresponding props, or even the small boss can also kill you (root Android phone)

2, with good props, remember to set the corresponding gems (see/data/data/com.example.fileoper/files whether 777, in the Ddms file Explorer can be seen, you can also add the ADB shell, see , be sure to look at the last files directory, if it does not 777, before more than 777, and finally you will kneel to sing conquest

3, the object to be measured and the method to be tested in the class can be placed under different packages, import under can also.

Also, if you are a person who sees no warn, and exactly the middle of a similar

no instrumentation runner found for the launch, using 
android.test.instrumentationtestrunne r problem, select the project's properties, right if there are duplicate keep up-to-date, the delete replica can be run again

Tips: Irobotium in the beginning of the title? What is the relationship with this,,, in fact, there is no big relationship, Irobotium just use their own solo class. In essence, there seems to be no difference with the Android.test.runner Android.test.instrumentationTestRunner here (the individual is not feeling any big difference)

Taibai---Falling swallow the first heavy Android unit test instrumentation and Irobotium

Related Article

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.