moto 0.0.30 → 0.0.31

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7dd8f5b2e3a238f83d7e898e6279ec2f788ce54
4
- data.tar.gz: 7ab6ef95c08fa90a159db853094efaacb06f1c01
3
+ metadata.gz: b8893539c7e555384f14655fb9cbccefbdf7084f
4
+ data.tar.gz: ce183c409b9d6800ad422cecb7997cf24df2741c
5
5
  SHA512:
6
- metadata.gz: b32033f7ea015858a23f4546b9e03ef1e8627c3e3639f0f240a253376cacab9e2950970e7c4441e956f206ffbba32279ba465c0a10b10ce212de47a168e9c61f
7
- data.tar.gz: a5a1d760afaee024f47d736065bfbcc203846c16076a9f8333d820db042718b98c48264627ffaf2d8576db4dde3c0334949e3213fbf195bc15a2cbaca6755e69
6
+ metadata.gz: 7e9e6bb3ca9fe6f4621fc88f6f7ad3a574af73317cbd62dfee3c3d362fd87dd8eff55b3f04244ea0d258a730c36518add55774f3fd2eef7f730df83fcad04405
7
+ data.tar.gz: 9bac80f78ab1e58caf6adab8e791362b18db54915efd1dd42a837e6a00f64292c01f3234f24b2228f70dbccd23c328b8a4308264fb68a01eac0a8adc96f5fad8
@@ -1,26 +1,26 @@
1
- module Moto
2
- module Listeners
3
- class Base
4
-
5
- def initialize(runner)
6
- @runner=runner
7
- end
8
-
9
- def start_run
10
- # abstract
11
- end
12
-
13
- def end_run
14
- # abstract
15
- end
16
-
17
- def start_test(test)
18
- # abstract
19
- end
20
-
21
- def end_test(test)
22
- # abstract
23
- end
24
- end
25
- end
1
+ module Moto
2
+ module Listeners
3
+ class Base
4
+
5
+ def initialize(runner)
6
+ @runner=runner
7
+ end
8
+
9
+ def start_run
10
+ # abstract
11
+ end
12
+
13
+ def end_run
14
+ # abstract
15
+ end
16
+
17
+ def start_test(test)
18
+ # abstract
19
+ end
20
+
21
+ def end_test(test)
22
+ # abstract
23
+ end
24
+ end
25
+ end
26
26
  end
@@ -1,29 +1,29 @@
1
- module Moto
2
- module Listeners
3
- class Console < Base
4
-
5
- def start_run
6
- puts "START"
7
- end
8
-
9
- def end_run
10
- puts ""
11
- puts "FINISHED: #{@runner.result.summary[:result]}, duration: #{Time.at(@runner.result.summary[:duration]).utc.strftime("%H:%M:%S")}"
12
- puts "Tests executed: #{@runner.result.summary[:cnt_all]}"
13
- puts " Passed: #{@runner.result.summary[:cnt_passed]}"
14
- puts " Failure: #{@runner.result.summary[:cnt_failure]}"
15
- puts " Error: #{@runner.result.summary[:cnt_error]}"
16
- puts " Skipped: #{@runner.result.summary[:cnt_skipped]}"
17
- end
18
-
19
- def start_test(test)
20
- print test.name
21
- end
22
-
23
- def end_test(test)
24
- puts "\t#{@runner.result[test.name][:result]}"
25
- end
26
-
27
- end
28
- end
1
+ module Moto
2
+ module Listeners
3
+ class Console < Base
4
+
5
+ def start_run
6
+ puts "START"
7
+ end
8
+
9
+ def end_run
10
+ puts ""
11
+ puts "FINISHED: #{@runner.result.summary[:result]}, duration: #{Time.at(@runner.result.summary[:duration]).utc.strftime("%H:%M:%S")}"
12
+ puts "Tests executed: #{@runner.result.summary[:cnt_all]}"
13
+ puts " Passed: #{@runner.result.summary[:cnt_passed]}"
14
+ puts " Failure: #{@runner.result.summary[:cnt_failure]}"
15
+ puts " Error: #{@runner.result.summary[:cnt_error]}"
16
+ puts " Skipped: #{@runner.result.summary[:cnt_skipped]}"
17
+ end
18
+
19
+ def start_test(test)
20
+ print test.name
21
+ end
22
+
23
+ def end_test(test)
24
+ puts "\t#{@runner.result[test.name][:result]}"
25
+ end
26
+
27
+ end
28
+ end
29
29
  end
@@ -1,37 +1,37 @@
1
- require 'nokogiri'
2
-
3
- module Moto
4
- module Listeners
5
- class JunitXml < Base
6
-
7
- def end_run
8
- path = @runner.my_config[:output_file]
9
-
10
- builder = Nokogiri::XML::Builder.new { |xml|
11
- xml.testsuite(
12
- errors: @runner.result.summary[:cnt_error],
13
- failures: @runner.result.summary[:cnt_failure],
14
- name: "Moto run",
15
- tests: @runner.result.summary[:cnt_all],
16
- time: @runner.result.summary[:duration],
17
- timestamp: Time.at(@runner.result.summary[:started_at])) do
18
- @runner.result.all.each do |test_name, data|
19
- xml.testcase(name: test_name, time: data[:duration], classname: data[:class].name, moto_result: data[:result]) do
20
- if !data[:error].nil?
21
- xml.error(message: data[:error].message)
22
- elsif data[:failures].count > 0
23
- data[:failures].each do |f|
24
- xml.failure(message: f)
25
- end
26
- end
27
- end
28
- end
29
- end
30
- }
31
-
32
- File.open(path, 'w') {|f| f.write(builder.to_xml) }
33
- end
34
-
35
- end
36
- end
1
+ require 'nokogiri'
2
+
3
+ module Moto
4
+ module Listeners
5
+ class JunitXml < Base
6
+
7
+ def end_run
8
+ path = @runner.my_config[:output_file]
9
+
10
+ builder = Nokogiri::XML::Builder.new { |xml|
11
+ xml.testsuite(
12
+ errors: @runner.result.summary[:cnt_error],
13
+ failures: @runner.result.summary[:cnt_failure],
14
+ name: "Moto run",
15
+ tests: @runner.result.summary[:cnt_all],
16
+ time: @runner.result.summary[:duration],
17
+ timestamp: Time.at(@runner.result.summary[:started_at])) do
18
+ @runner.result.all.each do |test_name, data|
19
+ xml.testcase(name: test_name, time: data[:duration], classname: data[:class].name, moto_result: data[:result]) do
20
+ if !data[:error].nil?
21
+ xml.error(message: data[:error].message)
22
+ elsif data[:failures].count > 0
23
+ data[:failures].each do |f|
24
+ xml.failure(message: f)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ }
31
+
32
+ File.open(path, 'w') {|f| f.write(builder.to_xml) }
33
+ end
34
+
35
+ end
36
+ end
37
37
  end
@@ -1,71 +1,71 @@
1
- require 'rest-client'
2
- require 'sys/uname'
3
-
4
- module Moto
5
- module Listeners
6
- class Webui < Base
7
-
8
- def start_run
9
- # POST http://sandbox.dev:3000/api/runs/create
10
- @url = @runner.my_config[:url]
11
- data = {
12
- name: @runner.name,
13
- result: Moto::Result::RUNNING,
14
- cnt_all: nil,
15
- cnt_passed: nil,
16
- cnt_failure: nil,
17
- cnt_error: nil,
18
- cnt_skipped: nil,
19
- user: Sys::Uname.sysname.downcase.include?('windows') ? ENV['USERNAME'] : ENV['LOGNAME'],
20
- host: Sys::Uname.nodename,
21
- pid: Process.pid
22
- }
23
- @run = JSON.parse( RestClient.post( "#{@url}/api/runs", data.to_json, :content_type => :json, :accept => :json ) )
24
- @tests = {}
25
- end
26
-
27
- def end_run
28
- # PUT http://sandbox.dev:3000/api/runs/1
29
- data = {
30
- result: @runner.result.summary[:result],
31
- cnt_all: @runner.result.summary[:cnt_all],
32
- cnt_passed: @runner.result.summary[:cnt_passed],
33
- cnt_failure: @runner.result.summary[:cnt_failure],
34
- cnt_error: @runner.result.summary[:cnt_error],
35
- cnt_skipped: @runner.result.summary[:cnt_skipped],
36
- duration: @runner.result.summary[:duration]
37
- }
38
- @run = JSON.parse( RestClient.put( "#{@url}/api/runs/#{@run['id']}", data.to_json, :content_type => :json, :accept => :json ) )
39
- end
40
-
41
- def start_test(test)
42
- # POST http://sandbox.dev:3000/api/tests/create
43
- data = {
44
- name: test.name,
45
- class_name: test.class.name,
46
- log: nil,
47
- run_id: @run['id'],
48
- env: test.env,
49
- parameters: test.params.to_s,
50
- result: Moto::Result::RUNNING,
51
- error: nil,
52
- failures: nil,
53
- }
54
- @tests[test.name] = JSON.parse( RestClient.post( "#{@url}/api/tests", data.to_json, :content_type => :json, :accept => :json ) )
55
- end
56
-
57
- def end_test(test)
58
- log = File.read(test.log_path)
59
- data = {
60
- log: log,
61
- result: @runner.result[test.name][:result],
62
- error: @runner.result[test.name][:error].nil? ? nil : @runner.result[test.name][:error].message,
63
- failures: @runner.result[test.name][:failures].join("\n\t"),
64
- duration: @runner.result[test.name][:duration]
65
- }
66
- @tests[test.name] = JSON.parse( RestClient.put( "#{@url}/api/tests/#{@tests[test.name]['id']}", data.to_json, :content_type => :json, :accept => :json ) )
67
- end
68
-
69
- end
70
- end
1
+ require 'rest-client'
2
+ require 'sys/uname'
3
+
4
+ module Moto
5
+ module Listeners
6
+ class Webui < Base
7
+
8
+ def start_run
9
+ # POST http://sandbox.dev:3000/api/runs/create
10
+ @url = @runner.my_config[:url]
11
+ data = {
12
+ name: @runner.name,
13
+ result: Moto::Result::RUNNING,
14
+ cnt_all: nil,
15
+ cnt_passed: nil,
16
+ cnt_failure: nil,
17
+ cnt_error: nil,
18
+ cnt_skipped: nil,
19
+ user: Sys::Uname.sysname.downcase.include?('windows') ? ENV['USERNAME'] : ENV['LOGNAME'],
20
+ host: Sys::Uname.nodename,
21
+ pid: Process.pid
22
+ }
23
+ @run = JSON.parse( RestClient.post( "#{@url}/api/runs", data.to_json, :content_type => :json, :accept => :json ) )
24
+ @tests = {}
25
+ end
26
+
27
+ def end_run
28
+ # PUT http://sandbox.dev:3000/api/runs/1
29
+ data = {
30
+ result: @runner.result.summary[:result],
31
+ cnt_all: @runner.result.summary[:cnt_all],
32
+ cnt_passed: @runner.result.summary[:cnt_passed],
33
+ cnt_failure: @runner.result.summary[:cnt_failure],
34
+ cnt_error: @runner.result.summary[:cnt_error],
35
+ cnt_skipped: @runner.result.summary[:cnt_skipped],
36
+ duration: @runner.result.summary[:duration]
37
+ }
38
+ @run = JSON.parse( RestClient.put( "#{@url}/api/runs/#{@run['id']}", data.to_json, :content_type => :json, :accept => :json ) )
39
+ end
40
+
41
+ def start_test(test)
42
+ # POST http://sandbox.dev:3000/api/tests/create
43
+ data = {
44
+ name: test.name,
45
+ class_name: test.class.name,
46
+ log: nil,
47
+ run_id: @run['id'],
48
+ env: test.env,
49
+ parameters: test.params.to_s,
50
+ result: Moto::Result::RUNNING,
51
+ error: nil,
52
+ failures: nil,
53
+ }
54
+ @tests[test.name] = JSON.parse( RestClient.post( "#{@url}/api/tests", data.to_json, :content_type => :json, :accept => :json ) )
55
+ end
56
+
57
+ def end_test(test)
58
+ log = File.read(test.log_path)
59
+ data = {
60
+ log: log,
61
+ result: @runner.result[test.name][:result],
62
+ error: @runner.result[test.name][:error].nil? ? nil : @runner.result[test.name][:error].message,
63
+ failures: @runner.result[test.name][:failures].join("\n\t"),
64
+ duration: @runner.result[test.name][:duration]
65
+ }
66
+ @tests[test.name] = JSON.parse( RestClient.put( "#{@url}/api/tests/#{@tests[test.name]['id']}", data.to_json, :content_type => :json, :accept => :json ) )
67
+ end
68
+
69
+ end
70
+ end
71
71
  end
@@ -103,7 +103,8 @@ module Moto
103
103
  (1..max_attempts).each do |attempt|
104
104
  @test.init(env, params, params_index)
105
105
  # TODO: log path might be specified (to some extent) by the configuration
106
- @test.log_path = "#{@test.dir}/#{@test.name.gsub(/\s+/, '_').gsub(':', '_').gsub('::', '_').gsub('/', '_')}.log"
106
+ #@test.log_path = "#{@test.dir}/#{@test.name.gsub(/\s+/, '_').gsub(':', '_').gsub('::', '_').gsub('/', '_')}.log"
107
+ @test.log_path = "#{@test.dir}/#{@test.name.demodulize.gsub('/', '_')}.log"
107
108
  @logger = Logger.new(File.open(@test.log_path, File::WRONLY | File::TRUNC | File::CREAT))
108
109
  @logger.level = @runner.my_config[:log_level] || Logger::DEBUG
109
110
  @current_test = @test
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '0.0.30'
2
+ VERSION = '0.0.31'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-15 00:00:00.000000000 Z
13
+ date: 2016-03-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport