Use Calabash-android to brush ads

Source: Internet
Author: User

Calabash-android is a unit test tool that is used to test the UI. This feature is ideal for swiping app ads. This article uses a simple example to teach you to use calabash-anroid to brush the app's ads. Code: Https://github.com/bigconvience/poker_hu

Before using the examples provided in this article to test, please ensure that the test environment is installed, you can refer to this article:Windows installation calabash-android

After the code is downloaded, go to the project directory and enter Calabash-android run as shown in:

At this point, the catalog features is created at the first edge of the project catalog. This app is a three-person bucket landlord's mini-game, click on the menu-> ad recommendation, just pop up the ad, as shown in:



In order to achieve the purpose of the Brush advertisement, add the following code in Features/my_first.feature

Feature:click ads Feature    scenario:i can Click menu item to show Adsthen I wait for the ' pokeractivity ' screen to AP Pearthen I wait for ten secondsthen I press the menu Keythen I wait for 5 seconds then I touch on screen m from the        l EFT and the Topthen I wait for secondsthen I go back

Since the Android version of the touch coordinates step has not yet been defined, you can add the file touch_steps.rb in the Step_definitions code as follows:

#--Touch--#Then/^i (?:p ress|touch) on screen (\d+) from the left and (\d+) from the top$/do |x, Y|touch (nil, {: offset = = {: x = x.to_i,: y = = y.to_i}}) sleep (3) End

Open the Windows command line, set the command line font: CMD input: chcp 65001, specifically for reference: http://blog.sina.com.cn/s/blog_628e2ab30101ajcg.html

On the command line, enter: Calabash-android run poker_hu.apk to start the ad. After that, the command is encapsulated with a shell script or batch file, and the ad is automatically brushed.

Use Calabash-android to brush ads

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.