fastlane-plugin-aws_device_farm 0.3.15 → 0.3.16.pre.alpha.pre.122

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
  SHA256:
3
- metadata.gz: 0a4f91b2dcaa04d45f271873463033fa6067b8ecf5e2ba765081fd1b1228ed06
4
- data.tar.gz: 201b87d7f51fc381eb6fd140aca875785cedeb156365a8a4f83dde4b5ed98a69
3
+ metadata.gz: 037e17e8443e5c0441c269bd1717639b624378822a5e5091d39498424afa57fa
4
+ data.tar.gz: c8f0329c53e805c4cf053845add58762d741edfe087fca269c05a344092c74ed
5
5
  SHA512:
6
- metadata.gz: d432179968ddb5c007cf41402eed49e5c4ff8570b435ea8925497434e431ad2c8019d590aa681e7df7e11b10cf055ef87849dde09712ad47f747903790f9828e
7
- data.tar.gz: d7d281db72d5348bf25fc5cbaf03e4f893d12efd8802c8fe686228e9f5639b2818691490c62cbc1eac976dd821c0eaaa567b7a91a87f0a65876df14f02918084
6
+ metadata.gz: 020061f9f4e93395a89c038d92588aa7d3f9789067b3eeb5762d3dea841da78e9af05b69948b2c2dde950b7f33136f3f27028ea8b8f8b3143b2bbf4eaa9181cd
7
+ data.tar.gz: 593c605d1d8722e880ad488aa6de555377f800f3bc340334e15de381f2c150d63680936c4bd0bafe530122e7080a597c4ed1af5a4552dfbb9cff2a55aeba0235
@@ -1,4 +1,5 @@
1
1
  require 'aws-sdk'
2
+
2
3
  module Fastlane
3
4
  module Actions
4
5
  # rubocop:disable Metrics/ClassLength
@@ -69,6 +70,8 @@ module Fastlane
69
70
  if params[:wait_for_completion]
70
71
  UI.message 'Waiting for the run to complete. ☕️'
71
72
  run = wait_for_run project, run, params
73
+ run = create_test_result run, params
74
+
72
75
  if params[:allow_failed_tests] == false
73
76
  if params[:allow_device_errors] == true
74
77
  raise "#{run.message} Failed 🙈" unless %w[PASSED WARNED ERRORED].include? run.result
@@ -291,6 +294,22 @@ module Fastlane
291
294
  is_string: false,
292
295
  optional: true,
293
296
  default_value: true
297
+ ),
298
+ FastlaneCore::ConfigItem.new(
299
+ key: :junit_xml_output_path,
300
+ env_name: 'FL_JUNIT_XML_OUTPUT_PATH',
301
+ description: 'JUnit xml output path',
302
+ is_string: true,
303
+ optional: true,
304
+ default_value: "junit.xml"
305
+ ),
306
+ FastlaneCore::ConfigItem.new(
307
+ key: :junit_xml,
308
+ env_name: 'FL_ALLOW_JUNIT_XML',
309
+ description: 'Do you create JUnit.xml?',
310
+ is_string: false,
311
+ optional: true,
312
+ default_value: false
294
313
  )
295
314
  ]
296
315
  end
@@ -417,11 +436,16 @@ module Fastlane
417
436
  UI.verbose "PROJECT ARN: #{project.arn}."
418
437
  ENV["AWS_DEVICE_FARM_PROJECT_ARN"] = project.arn
419
438
 
439
+ run
440
+ end
441
+
442
+ def self.create_test_result(run, params)
420
443
  job = @client.list_jobs({
421
- arn: run.arn
422
- })
444
+ arn: run.arn
445
+ })
423
446
 
424
447
  rows = []
448
+ test_results = {}
425
449
  job.jobs.each do |j|
426
450
  if j.result == "PASSED"
427
451
  status = "💚 (#{j.result})"
@@ -431,7 +455,48 @@ module Fastlane
431
455
  status = "💥 (#{j.result})"
432
456
  end
433
457
  rows << [status, j.name, j.device.form_factor, j.device.platform, j.device.os]
458
+
459
+ suite = @client.list_suites({
460
+ arn: j.arn
461
+ })
462
+
463
+ test_suites = []
464
+ suite.suites.each do |suite|
465
+ test = @client.list_tests({
466
+ arn: suite.arn
467
+ })
468
+
469
+ test_lists = []
470
+ test.tests.each do |test|
471
+ test_lists << {
472
+ "class_name" => suite.name,
473
+ "name" => test.name,
474
+ "time" => test.device_minutes.metered
475
+ }
476
+ end
477
+
478
+ test_suites << {
479
+ "name" => suite.name,
480
+ "tests" => suite.counters.total,
481
+ "failures" => suite.counters.failed,
482
+ "errors" => suite.counters.errored,
483
+ "time" => suite.device_minutes.metered,
484
+ "test_lists" => test_lists
485
+ }
486
+
487
+ # test results
488
+ test_results = {
489
+ "name" => j.name,
490
+ "tests" => j.counters.total,
491
+ "failures" => j.counters.failed,
492
+ "errors" => j.counters.errored,
493
+ "time" => j.device_minutes.metered,
494
+ "test_suites" => test_suites
495
+ }
496
+ Helper::AwsDeviceFarmHelper.create_junit_xml(test_results: test_results, file_path: params[:junit_xml_output_path]) if params[:junit_xml]
497
+ end
434
498
  end
499
+
435
500
  puts ""
436
501
  puts Terminal::Table.new(
437
502
  title: "Device Farm Summary".green,
@@ -442,6 +507,7 @@ module Fastlane
442
507
 
443
508
  run
444
509
  end
510
+
445
511
  def self.get_run_url_from_arn(arn)
446
512
  project_id = get_project_id_from_arn arn
447
513
  run_id = get_run_id_from_arn arn
@@ -1,12 +1,48 @@
1
+ require 'rexml/document'
2
+ require 'fileutils'
3
+
1
4
  module Fastlane
2
5
  module Helper
3
6
  class AwsDeviceFarmHelper
4
- # class methods that you define here become available in your action
5
- # as `Helper::AwsDeviceFarmHelper.your_method`
6
- #
7
- def self.show_message
8
- UI.message("Hello from the aws_device_farm plugin helper!")
7
+
8
+ # create Junit.xml
9
+ def self.create_junit_xml(test_results:, file_path:)
10
+ doc = REXML::Document.new
11
+ doc << REXML::XMLDecl.new('1.0', 'UTF-8')
12
+
13
+ # test_suites
14
+ root = REXML::Element.new('testsuites')
15
+ root.add_attribute('name', "#{test_results['name']}")
16
+ root.add_attribute('tests', "#{test_results['tests']}")
17
+ root.add_attribute('failures', "#{test_results['failures']}")
18
+ root.add_attribute('time', "#{test_results['time']}")
19
+ doc.add_element(root)
20
+
21
+ test_results['test_suites'].each do |suite|
22
+ testsuite = REXML::Element.new('testsuite')
23
+ testsuite.add_attribute('name', "#{suite['name']}")
24
+ testsuite.add_attribute('tests', "#{suite['tests']}")
25
+ testsuite.add_attribute('errors', "#{suite['errors']}")
26
+ testsuite.add_attribute('failures', "#{suite['failures']}")
27
+ testsuite.add_attribute('time', "#{suite['time']}")
28
+ root.add_element(testsuite)
29
+
30
+ suite['test_lists'].each do |test|
31
+ testcase = REXML::Element.new('testcase')
32
+ testcase.add_attribute('classname', "#{test['class_name']}")
33
+ testcase.add_attribute('name', "#{test['name']}")
34
+ testcase.add_attribute('time', "#{test['time']}")
35
+ testsuite.add_element(testcase)
36
+ end
37
+ end
38
+
39
+ # output
40
+ FileUtils.mkdir_p(File.dirname(file_path))
41
+ File.open(file_path, 'w') do |file|
42
+ doc.write(file, indent=2)
43
+ end
9
44
  end
45
+
10
46
  end
11
47
  end
12
48
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AwsDeviceFarm
3
- VERSION = "0.3.15"
3
+ VERSION = "0.3.16"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-aws_device_farm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.15
4
+ version: 0.3.16.pre.alpha.pre.122
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helmut Januschka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-13 00:00:00.000000000 Z
11
+ date: 2020-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -136,12 +136,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - ">="
139
+ - - ">"
140
140
  - !ruby/object:Gem::Version
141
- version: '0'
141
+ version: 1.3.1
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.7.2
144
+ rubygems_version: 2.7.7
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Run UI Tests on AWS Devicefarm