Ego Development 1 The Relationship Between Adolescent Ego ...
eGo meetup - Сalabash in mobile automated testing
-
Upload
ego-creative-media-solutions -
Category
Technology
-
view
287 -
download
0
description
Transcript of eGo meetup - Сalabash in mobile automated testing
eGo Creative Media Solutions
Acceptance testing
Behavior-driven development (BDD)
BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology
What is Calabash?
Calabash provides a bridge that allows Cucumber tests to run and validate on iOS and Android
Calabash
● Cucumber - framework that performs tests
● Calabash – bridge to device
● Gherkin - syntax
Cucumber + Calabash & Ruby + Gherkin
Calabash’s Client-Server Model
Calabash has a Client-Server model in which the server
portion is a lightweight web server that runs on the device
and listens for a client to connect and initiate the tests.
It then communicates via JSON over HTTP
Calabash in Android
Calabash in iOS
Calabash.app
Calabash-iOS setup
calabash-ios setup
calabash-ios gen
Calabash-iOS setup
Drag calabash.framework from Finder into your project's Frameworks folder in Xcode.
Make sure thata. Copy items into destination group's folder (if needed) is checked andb. only your "-cal " target is checked in Add to targets.
You must also link you -cal target with CFNetwork.framework (unless your production target is already linking
with CFNetwork). To do this click on your -cal target in XCode. Click on Build Phases, expand Link Binary
with Libraries, click + to add CFNetwork.framework.
o Click on your project and select your new "-cal" target.o Select "Build Settings".o Ensure that "All" and not "Basic" settings are selected in "build settings".o Find "Other Linker Flags" (you can type "other link" in the search field).o Ensure that "Other linker flags" contains: -force_load
"$(SRCROOT)/calabash.framework/calabash" -lstdc++
Calabash-iOS setup
Calabash with Xamarin
Calabash iOS/Android gen
Config
cucumber.yml
# config/cucumber.yml
##YAML Template
android: PLATFORM=android -r features/support -r features/android/support -r features/android/helpers -r features/step_definitions -r features/android/pages
ios: PLATFORM=ios SDK_VERSION=7.0 -r features/support -r features/ios/support -r features/ios/helpers -r features/step_definitions -r features/ios/pages
iPhone: DEVICE=iphoneiPad: DEVICE=ipad
Test anatomy
Test practice
● Write the feature – As described in the overview, the developer and a subject matter expert work together
to write the Calabash feature. They create a .feature file that describes how the scenarios should work.
● Run the feature – Next, the developer runs the feature that was created. It will fail because the steps have
not yet been defined. However, Cucumber will help us out by providing some code snippets that we can use
to create the step definitions.
● Create the Step Definitions – Using the snippets that Cucumber provided in step #2, we create a Ruby
source code file, and paste the snippet output into it.
● Explore the Application using the Calabash Console – Not strictly necessary, this step involves starting
up an instance of the Calabash console. The Calabash console is a command line utility that allows us to
issue commands to the Calabash test server communicating with our app. We can use this to discover the
Calabash queries necessary to interact with the UI object in the application.
Test practice
● Update Step Definitions – Once we have figured out the Calabash queries for locating and manipulating
the UI object, we can use these - along with the Calabash API - to implement the step definitions.
● Run the Feature – When the step definitions are finished, we can run the features. If this is a brownfield
application, the functionality has already been coded and the tests should all pass. If this is a greenfield
project, the tests will not pass as there is no application code – we will move on to step #7 below.
● Implement the Feature in the Application – This step is only necessary in a greenfield project. The
developer will shift attention to the application and write the code to implement the desired functionality, and
make the test pass.
● Repeat – Once the feature is implemented with a passing test, it is done. Time to move on and implement
the next bit of functionality in the application.
First feature example
credit_card_validation.feature
Feature: Credit card validation. Credit card numbers must be exactly 16 digits.
Scenario: Credit card number is to short Given I use the native keyboard to enter "123456" into text field number 1 And I touch the "Validate" button Then I see the text "Credit card number is to short."
First feature execution
Console Log$ cucumberFeature: Credit card validation. Credit card numbers must be exactly 16 digits.
Sceanario: Credit Card is too short # features/credit_card_validation.feature:4
Given I use the native keyboard to enter "123456" into text field number 1 # calabash-cucumber-0.9.162/features/step_definitions/calabash_steps.rb:140 And I touch the "Validate" button # calabash-cucumber-0.9.162/features/step_definitions/calabash_steps.rb:31 Then I see the text "Credit card number is to short." # calabash-cucumber-0.9.162/features/step_definitions/calabash_steps.rb:3731 scenario (1 passed)3 steps (3 passed)0m18.035s
Second feature
Implementing the Second Scenario
Scenario: Credit card number is to long Given I try to validate a credit card number that is 17 characters long Then I should see the error message "Credit card number is to long."
First rough going
Step definitions
Calabash Ruby API
Calabash has a client-server architecture. The Calabash Ruby API is the client side which communicates over HTTP with the server that is embedded in your app via the Calabash component.
Calabash query
Uploading and Executing Tests in Test Cloud
Resources
https://github.com/calabash/calabash-ios
https://github.com/calabash/calabash-android
http://docs.xamarin.com/guides/testcloud/calabash/
http://docs.xamarin.com/guides/testcloud/calabash/calabash-predefined-steps/
http://calaba.sh/
http://cukes.info/
https://github.com/xamarin/mobile-samples
Thank You