taf 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/taf/report.rb +34 -26
  3. data/lib/taf/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e4461fc2745f3d0135a0005925069baf551d4b05c5e35aa8c22ae64c8f26b57
4
- data.tar.gz: 572033f4fe158cb507b034613f2816ed10ab1c8c050f094702c8cb2de9c8b09b
3
+ metadata.gz: 2367c31920261be5fd4ab3b50e3266c972f6f4eeb6f22a99e704a64904639ae3
4
+ data.tar.gz: dccbc5fc244b455a3d2173dbde7c2814571d090d7fc8447fa34759bb1f2c80f8
5
5
  SHA512:
6
- metadata.gz: 3e874a6c78dd48b81d6b9cd741a810b79a669ea5bb5ec119a700da76f8cfeaf9077f0a1d231249682d9488756543e557b3daeb24da75b87acacadd07ef1d6b0d
7
- data.tar.gz: 58460b01837bd31330c4e1d342ac73eabdf01d0fc434a21a3a16d2deec606b65fac6f4d51f9c161d6314081a6d924a2be7fc1ce100094889d4f009a785479f4d
6
+ metadata.gz: f0d440c2349b3543910236233e321a651677fcce1e96dfb300e86ae6f6cadd81865aedd0aa705ab0e3e0b4b046b74703f9cab91e4611bb3fa24bc17421f3c238
7
+ data.tar.gz: d90267152e10e951260c2181b30b38209ab22bfdada3b4afe63d52b26207f8fabe08e5347a88cd179ce2f7f6d0f24a4dacba36444570da3f240ced03ae3d4541
data/lib/taf/report.rb CHANGED
@@ -18,47 +18,55 @@ module Taf
18
18
 
19
19
  # print the test Step info to the test results file
20
20
  def self.print_test_step_header(test_step_idx, test_desc)
21
- @test_start_time = current_time
21
+ @start_time = current_time
22
22
  Taf::MyLog.log.info "Test step: #{test_step_idx} : #{test_desc}"
23
23
  end
24
24
 
25
+ def self.pass_func(test_file_name, test_step_idx, test_desc, metrics)
26
+ Taf::MyLog.log.info "Test #{test_step_idx} has Passed ".green
27
+ @current_test_fail = false
28
+ metrics.stepPasses += 1
29
+ Taf::TapReport.success(test_file_name, test_step_idx, test_desc)
30
+ end
31
+
32
+ def self.fail_func(test_file_name, test_step_idx, test_desc, metrics)
33
+ Taf::MyLog.log.warn "Test #{test_step_idx} has FAILED ".red
34
+ Taf::Screenshot.save_screenshot(test_step_idx)
35
+ @current_test_fail = true
36
+ metrics.stepFailures += 1
37
+ Taf::TapReport.failure(
38
+ test_file_name, test_step_idx, test_desc
39
+ )
40
+ end
41
+
42
+ def self.skip_func(test_file_name, test_step_idx, test_desc, metrics)
43
+ Taf::MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
44
+ @current_test_fail = false
45
+ metrics.stepSkipped += 1
46
+ Taf::TapReport.skip(
47
+ test_file_name, test_step_idx, test_desc
48
+ )
49
+ end
50
+
25
51
  # print the Pass / Fail status of a test to the test results file
26
52
  def self.test_pass_fail(
27
53
  pass_fail,
28
54
  test_file_name,
29
55
  test_step_idx,
30
- test_step_description,
56
+ test_desc,
31
57
  metrics
32
58
  )
33
59
  if pass_fail
34
- Taf::MyLog.log.info "Test #{test_step_idx} has Passed ".green
35
- @current_test_fail = false
36
- metrics.stepPasses += 1
37
- Taf::TapReport.success(
38
- test_file_name, test_step_idx, test_step_description
39
- )
60
+ pass_func(test_file_name, test_step_idx, test_desc, metrics)
40
61
  elsif pass_fail == false
41
- Taf::MyLog.log.warn "Test #{test_step_idx} has FAILED ".red
42
- Taf::Screenshot.save_screenshot(test_step_idx)
43
- @current_test_fail = true
44
- metrics.stepFailures += 1
45
- Taf::TapReport.failure(
46
- test_file_name, test_step_idx, test_step_description
47
- )
62
+ fail_func(test_file_name, test_step_idx, test_desc, metrics)
48
63
  else
49
- Taf::MyLog.log.info "Test #{test_step_idx} no checks performed ".blue
50
- @current_test_fail = false
51
- metrics.stepSkipped += 1
52
- Taf::TapReport.skip(
53
- test_file_name, test_step_idx, test_step_description
54
- )
64
+ skip_func(test_file_name, test_step_idx, test_desc, metrics)
55
65
  end
56
66
 
57
- test_end_time = current_time
58
- test_duration = TimeDifference.between(
59
- test_end_time, @test_start_time
60
- ).humanize || 0
61
- Taf::MyLog.log.info "Test step duration: #{test_duration} \n"
67
+ end_time = current_time
68
+ duration = TimeDifference.between(end_time, @start_time).humanize || 0
69
+ Taf::MyLog.log.info "Test step duration: #{duration} \n"
62
70
  end
63
71
 
64
72
  # check if the test failure threshold has been reached for total failures
data/lib/taf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Taf
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Perrett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-14 00:00:00.000000000 Z
11
+ date: 2019-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler