App Automated Testing Exploration 5-Calabash Trampling Summary

Keywords: Ruby Android SDK xcode

For reprinting, please indicate the source: https://lizhaoxuan.github.io

Preface

In order to ensure the process of reading the previous chapters, we will summarize all the problems that Calabash encountered from the environment to the specific use. Most of them are pits that I actually experienced. At the same time, I will try my best to record the problems I saw from other blogs in the learning process.

Pit 1: Ruby Error Reporting During Calabash Installation

$ sudo gem install calabash-android
Password:
Building natie extensions. This could take a while...
RROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
    mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

It seems that most people will not encounter this problem. Although it looks like Ruby is missing a header file, the real problem is not Ruby.

Execute the following commands:

$ xcode-select --install

Install Xcode and OK! Looks like ruby relies on xcode? Heart plug ~

Pit 2: Can not find an Android SDK please make it install

No test server found for this combination of app and calabash version.Recreating test server
ERROR:Could not find an Android SDK please make it is install
...

Other JDK and ANT problems are the same.

First, make sure that you do have Android SDK installed and that environment variables are properly configured.
If you have confirmed that there are no problems, you should report the error.
Execute orders:

$.bash_profile

Or do you report this mistake? Hahaha, the next trick is to restart Dafa.~
Well, restarting the computer should be all right.

Pit 3: App did not start or WARN:Did not find'android.jar'...

WARN: Did not find 'android.jar' in any standard directory of '.../sdk/platforms'.Calabash will therefore take longer to load
Feature: /**
    Scenario: /**
    App did not start(RuntimeError)
    ./feature/support/app_life_cycle_hooks.rb:5:in'Before'
    ...

First, confirm the phone or virtual machine to link to the computer, and debug mode and everything is on.
Confirm whether network privileges are granted in the App configuration, for example, Android

manifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

Pit 4: **. apk is not signed with any of the available keystores

No test server found for this combination of app and calabash version.Recreating test server
**.apk is not signed with any of the available keystores

This is not really a pit. Calabash test apk needs to be re-signed to solve this problem according to error prompts or official documents. There are too many tutorials to go through. Pay Official Solutions.

Pit 5: Calabash custom Steps that are not defined during execution

You can implement step definitions for undefined steps with these snippets:

Then /^I through welcomePages $/ do
  pending # Write code here that turns the phrase above into concrete actions
end

I did not write anything wrong, how can I always prompt the undefined?
If you encounter this problem, please check your code strictly first. If there's nothing wrong with checking everything, just see if I've made this mistake as well! __________ I don't think the average person can make this mistake.

At first my definition was as follows:

Then /^I through welcomePages $/ do
    Then I drag from 90:50 to 20:50 moving with 20 steps 
    Then I drag from 90:50 to 20:50 moving with 20 steps 
    Then I drag from 90:50 to 20:50 moving with 20 steps 
end

It doesn't seem to be a problem, does it? The problem here is that there can't be a space before the $/ do end dollar sign!!!

Change to the following so that you can!

Then /^I through welcomePages$/ do
    Then I drag from 90:50 to 20:50 moving with 20 steps 
    Then I drag from 90:50 to 20:50 moving with 20 steps 
    Then I drag from 90:50 to 20:50 moving with 20 steps 
end

App Automated Testing Exploration 1 - Dahua App Automated Testing
App Automated Testing Exploration 2-Run Calabash
App Automated Testing Exploration 3-Calabash Usage Explanation
App Automated Testing Exploration 4-Calabash Advancement
App Automated Testing Exploration 5-Calabash Trampling Summary

Posted by Victorm on Wed, 27 Mar 2019 13:09:31 -0700