fastlane-plugin-automated_test_emulator_run 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2eb526613eca13ae8ef9235ae150146a2016d3a0
4
- data.tar.gz: e22231a66a5fe51dbf336a5caf80be1685727cf9
3
+ metadata.gz: 7e18147578dd470fc470eb2feeb907dc4afaea65
4
+ data.tar.gz: 1a40948f6263352106fd9a28c4617b74ae65d853
5
5
  SHA512:
6
- metadata.gz: 0a60cafaef152b7380478860eaad74c412cf2bc792d7c649c984d04c4772aa670bed0f500f7de85e86d0934802b6da2be002a1f4fc7fa50a62563594747dbd5f
7
- data.tar.gz: eddb81d99cb8b79512d900e785adc3c6a0027dda1d88b593309879a2306aebae038afe46209ff4dcb3bff8994e416cbe338ba96498afec99004eca1169d6fb6f
6
+ metadata.gz: 3aa84d1590d52f4439d0bb8460ddb7ebac0dc5d8fb8f95248d7ebfee56c929f25d5c9f3e137f85cec03258878f0adb11dd849e198c326f07f046029e628f47f4
7
+ data.tar.gz: c50131d2ec13585436eed6214a70d7e7e3593828aaec025cafa2824d02a61cc40348329dd160bc74063860fda71c5bb1c15401eb3b4328343904cae99a3b3716
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-automated_test_emulator_run)
4
4
 
5
+ See [blog post related to this plugin](https://medium.com/azimolabs/managing-android-virtual-devices-during-test-session-98a403acffc2#.upcmonil1). You can learn there how to create basic setup for this plugin step by step.
6
+
5
7
  ## About automated_test_emulator_run
6
8
 
7
9
  Starts any number of AVDs. AVDs are created and configured automatically according to user liking before instrumentation test process starts (started either via shell command or from gradle) and killed/deleted after test process finishes.
@@ -52,13 +54,13 @@ JSON file scheme:
52
54
  ```
53
55
 
54
56
  Parameters:
55
- - `avd_name` - name of your AVD, avoid using spaces, this file is necessary
56
- - `create_avd_target` - Android target api level (https://developer.android.com/guide/topics/manifest/uses-sdk-element.html)
57
+ - `avd_name` - name of your AVD, avoid using spaces, this field is necessary
58
+ - `create_avd_target` - Android API Level (https://developer.android.com/guide/topics/manifest/uses-sdk-element.html)
57
59
  - `create_avd_abi` - CPU architecture used by AVD (https://developer.android.com/ndk/guides/abis.html)
58
- - `create_avd_hardware_config_filepath` - path to config.ini file containing custom config for your AVD device. After AVD is created this file will be copied into AVD location before it launches.
60
+ - `create_avd_hardware_config_filepath` - path to config.ini file containing custom config for your AVD. After AVD is created this file will be copied into AVD location before it launches.
59
61
  - `create_avd_additional_options` - if you think that you need something more you can just add your create parameters here (e.g. "--sdcard 128M", https://developer.android.com/studio/tools/help/android.html)
60
- - `launch_avd_snapshot_filepath` - plugin will delete and re-create AVD before test start. That means all your permissions and settings will be lost on each emulator run. If you want to apply qemu image with saved AVD state you can put path to it in this field. It will be applied by using "-wipe-data -initdata <path to your file>"
61
- - `launch_avd_launch_binary_name` - depending on your CPU architecture you need to choose binary file which should launch your AVD (e.g. "emulator", "emulator64-arm", "emulator64-x86")
62
+ - `launch_avd_snapshot_filepath` - plugin might (if you set it) delete and re-create AVD before test start. That means all your permissions and settings will be lost on each emulator run. If you want to apply qemu image with saved AVD state you can put path to it in this field. It will be applied by using "-wipe-data -initdata <path to your file>"
63
+ - `launch_avd_launch_binary_name` - depending on your CPU architecture you need to choose binary file which should launch your AVD (e.g. "emulator", "emulator64-arm")
62
64
  - `launch_avd_port` - port on which you wish your AVD should be launched, if you leave this field empty it will be assigned automatically
63
65
  - `launch_avd_additional_options` - if you need more customization add your parameters here (e.g. "-gpu on -no-boot-anim -no-window", https://developer.android.com/studio/run/emulator-commandline.html)
64
66
 
@@ -68,6 +70,7 @@ Hints:
68
70
  - pick even ports for your AVDs
69
71
  - if you can't launch more than 2 AVDs be sure to check how much memory is your HAXM allowed to use (by default it is 2GB and that will allow you to launch around 2 AVDs) If you face any problems with freezing AVDs then be sure to reinstall your HAXM and allow it to use more of RAM (https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager)
70
72
  - make sure you have all targets/abis installed on your PC if you want to use them (type in terminal: `android list targets`)
73
+ - we recommend adding `-gpu on` to your launching options for each device, it helps when working with many AVDs
71
74
 
72
75
  Example:
73
76
 
@@ -19,6 +19,19 @@ module Fastlane
19
19
  for i in 0...avd_schemes.length
20
20
  avd_controller = Factory::AvdControllerFactory.get_avd_controller(params, avd_schemes[i])
21
21
  avd_controllers << avd_controller
22
+
23
+ # Checking for output files
24
+ if File.exists?(avd_controller.output_file.path)
25
+ UI.message([
26
+ "Successfully created tmp output file for AVD:",
27
+ avd_schemes[i].avd_name + ".",
28
+ "File: " + avd_controller.output_file.path].join(" ").green)
29
+ else
30
+ UI.message([
31
+ "Unable to create output file for AVD:",
32
+ avd_schemes[i].avd_name + ".",
33
+ "Output will be delegated to null and lost. Check your save/read permissions."].join(" ").red)
34
+ end
22
35
  end
23
36
 
24
37
  all_avd_launched = false
@@ -144,6 +157,16 @@ module Fastlane
144
157
  else
145
158
  UI.message("AVD_clean_after param set to false. Created AVDs won't be deleted.".green)
146
159
  end
160
+
161
+ # Display output
162
+ if (File.exists?(avd_controllers[i].output_file.path))
163
+ UI.message("Displaying log from AVD to console:".green)
164
+ UI.message(avd_controllers[i].output_file.read.blue)
165
+
166
+ UI.message("Removing temp file.".green)
167
+ avd_controllers[i].output_file.close
168
+ avd_controllers[i].output_file.unlink
169
+ end
147
170
  end
148
171
  end
149
172
  end
@@ -1,8 +1,15 @@
1
+ require 'tempfile'
2
+
1
3
  module Fastlane
2
4
  module Factory
3
5
 
4
6
  class AVD_Controller
5
- attr_accessor :command_create_avd, :command_start_avd, :command_delete_avd, :command_apply_config_avd, :command_get_property, :command_kill_device
7
+ attr_accessor :command_create_avd, :command_start_avd, :command_delete_avd, :command_apply_config_avd, :command_get_property, :command_kill_device,
8
+ :output_file
9
+
10
+ def self.create_output_file(params)
11
+ output_file = Tempfile.new('emulator_output', '#{params[:AVD_path]}')
12
+ end
6
13
  end
7
14
 
8
15
  class AvdControllerFactory
@@ -67,13 +74,16 @@ module Fastlane
67
74
  sh_create_avd_abi,
68
75
  sh_create_avd_additional_options].join(" ")
69
76
 
77
+ avd_controller.output_file = Tempfile.new('emulator_output')
78
+ avd_output = File.exists?(avd_controller.output_file) ? ["&>", avd_controller.output_file.path, "&"].join("") : "&>/dev/null &"
79
+
70
80
  avd_controller.command_start_avd = [
71
81
  sh_launch_emulator_binray,
72
82
  sh_launch_avd_port,
73
83
  sh_launch_avd_name,
74
84
  sh_launch_avd_snapshot,
75
85
  sh_launch_avd_additional_options,
76
- "&>/dev/null &"].join(" ")
86
+ avd_output].join(" ")
77
87
 
78
88
  avd_controller.command_delete_avd = [
79
89
  path_android_binary,
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AutomatedTestEmulatorRun
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-automated_test_emulator_run
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kamil Krzyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-28 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry