[Calabash] How to add android system log into calabash-android test scenarios

晚上11:25

How to add android system log into calabash-android test scenarios

Add follow adb command into app_life_cycle_hook.rb file, and the system log will log into file for each scenarios
Before do |scenario|
  `#{adb_command} logcat -c` # clears logcat output
  #Start Test Server
  start_test_server_in_background
end
After do |scenario|
  `#{adb_command} logcat -v time 2>&1 -d > $REPORT_PATH/sys_log.txt` # dumps log in time format to file and exits
  embed('sys_log.txt', 'text/plain', 'sys_log.txt')
  if scenario.failed?
    screenshot_embed
  end
  shutdown_test_server
end

You Might Also Like

0 意見