Search code examples
calabash-android

How to run scenarios in calabash android without reset


I want to run a feature file containing different szenarios. Without a reset after each szenario.

I tried to run this test by command line with 'RESET_BETWEEN_SCENARIOS' tag.

RESET_BETWEEN_SCENARIOS=0 calabash-android run

doesn't work.

I tried to uncomment ('#') some lines in app_life_cycle_hooks.rb file:

require 'calabash-android/management/adb'
require 'calabash-android/operations'

Before do |scenario|
 #start_test_server_in_background
end

After do |scenario|
 if scenario.failed?
 screenshot_embed
end
#shutdown_test_server
end

doesn't work.

I tried to uncomment die following lines in app_installation_hooks.rb

uninstall_apps
install_app(ENV['TEST_APP_PATH'])
install_app(ENV['APP_PATH'])

doesn't work.


Solution

  • Got it.

    I removed (by comment) this line in app_installation_hooks.rb

    uninstall_apps
    

    and this lines in app_life_cycle_hooks.rb

    start_test_server_in_background
    shutdown_test_server
    

    I created a file start_server.rb in /step_definitions defined a custom step:

    Given /^I started the server$/ do
     start_test_server_in_background
    end
    

    which I used in my first scenario

    Scenario: S1
    Given I started the server
    ...
    

    I run this by my .sh script (in shell) including the run statement

    calabash-android run PATH_TO_APK