qacloud 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qacloud.rb +121 -50
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76883711c4ab99be17d4ca2958dfd9e45d2a8b42
|
4
|
+
data.tar.gz: 98e14cbfc52aef0914f689231b63b412b1eb7cb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d99402baef63b0507b4c4718f1b85fd9eb9f7d9dd1ec736bee4a28edc2231698791bb10d7376e44972f52114a038b9203eb7d7a1ece1d586437f5ea59a4139c
|
7
|
+
data.tar.gz: c51699393f0d85899e7f59f6705ef88f186f95a3019cc0939caf1ea315661a622c7d591adf03440ac3024bf592cf7c6597225ed083b6c353c43a1aef74def738
|
data/lib/qacloud.rb
CHANGED
@@ -1,53 +1,124 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#!/usr/bin/env ruby
|
3
2
|
require 'rubygems'
|
4
3
|
require 'httparty'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
4
|
+
require 'qacloud'
|
5
|
+
require 'watir-webdriver'
|
6
|
+
|
7
|
+
|
8
|
+
# # get playlistID or playlistID CI id from args::
|
9
|
+
|
10
|
+
# playlistID = ARGV[0]
|
11
|
+
# tokenID = "your token id"
|
12
|
+
|
13
|
+
|
14
|
+
def self.playlist(playlistID,tokenID)
|
15
|
+
|
16
|
+
taskhash = GetFirstTask(playlistID,tokenID)
|
17
|
+
|
18
|
+
if taskhash.code == 500 then
|
19
|
+
puts "Getting Task ID:"
|
20
|
+
taskhash = GetTaskid(playlistID,tokenID)
|
21
|
+
playlistID = taskhash["body"]["_id"]
|
22
|
+
taskhash = GetFirstTask(playlistID,tokenID)
|
23
|
+
end
|
24
|
+
|
25
|
+
# collecting useful variables and values from taskhash:
|
26
|
+
|
27
|
+
$workflow_name = taskhash["body"]["workflow_name"]
|
28
|
+
$workflow_id = taskhash["body"]["workflow_id"]
|
29
|
+
$task_name = taskhash["body"]["task_name"]
|
30
|
+
task_id = taskhash["body"]["task_id"]
|
31
|
+
$var = taskhash["body"]["task_variables"]
|
32
|
+
$env = taskhash["body"]["environment"]
|
33
|
+
puts "Workflow: #{$workflow_name}"
|
34
|
+
$workflow_status = taskhash["body"]["test"]
|
35
|
+
puts "Now Starting Task: #{$task_name}"
|
36
|
+
|
37
|
+
begin
|
38
|
+
|
39
|
+
if $var.has_key?("path") == true then
|
40
|
+
if $var["path"].empty? == false then
|
41
|
+
path = $var["path"]
|
42
|
+
end
|
43
|
+
else
|
44
|
+
path = $env["path"]
|
45
|
+
end
|
46
|
+
require_relative "#{path}"
|
47
|
+
dur1 = Time.now
|
48
|
+
$task_name()
|
49
|
+
dur2 = Time.now
|
50
|
+
|
51
|
+
rescue Exception => e
|
52
|
+
|
53
|
+
puts "Exception occured, Checkpoint should have more info."
|
54
|
+
@erro_line = e.backtrace[0].split(":")
|
55
|
+
@error_line = @erro_line[1]
|
56
|
+
@error_message = "#{$!}"
|
57
|
+
@error_line = Integer(@error_line) rescue "ErrorImage"
|
58
|
+
dur2 = Time.now
|
59
|
+
status = "fail"
|
60
|
+
result = "Exception occured, Checkpoint should have more info."
|
61
|
+
checkpoint = "Error Message: #{@error_message} , Script Line Number: #{@error_line}"
|
62
|
+
duration = dur2 - dur1
|
63
|
+
taskhash = GetNextTask(task_id,tokenID,status,result,checkpoint,duration)
|
64
|
+
$workflow_status = "finished"
|
65
|
+
# Take error image:
|
66
|
+
# $browser.screenshot.save "#{dirname}/#{@error_line}.png"
|
67
|
+
end
|
68
|
+
|
69
|
+
status = $status
|
70
|
+
result = $result
|
71
|
+
checkpoint = $checkpoint
|
72
|
+
duration = dur2 - dur1
|
73
|
+
|
74
|
+
while $workflow_status != "finished"
|
75
|
+
taskhash = GetNextTask(task_id,token_id,status,result,checkpoint,duration)
|
76
|
+
$workflow_name = taskhash["body"]["workflow_name"]
|
77
|
+
$workflow_id = taskhash["body"]["workflow_id"]
|
78
|
+
$task_name = taskhash["body"]["task_name"]
|
79
|
+
task_id = taskhash["body"]["task_id"]
|
80
|
+
$var = taskhash["body"]["task_variables"]
|
81
|
+
$env = taskhash["body"]["environment"]
|
82
|
+
$workflow_status = taskhash["body"]["test"]
|
83
|
+
|
84
|
+
break if $workflow_status == "finished"
|
85
|
+
if $add_variable.empty? == true then
|
86
|
+
else
|
87
|
+
$get_variable.merge!($add_variable)
|
88
|
+
end
|
89
|
+
puts "Workflow: #{$workflow_name}"
|
90
|
+
puts "Now Starting Task: #{$task_name}"
|
91
|
+
begin
|
92
|
+
if $var.has_key?("path") == true then
|
93
|
+
if $var["path"].empty? == false then
|
94
|
+
path = $var["path"]
|
95
|
+
end
|
96
|
+
else
|
97
|
+
path = $env["path"]
|
98
|
+
end
|
99
|
+
require_relative "#{path}"
|
100
|
+
dur1 = Time.now
|
101
|
+
$task_name()
|
102
|
+
dur2 = Time.now
|
103
|
+
rescue Exception => e
|
104
|
+
puts "Exception occured, Checkpoint should have more info."
|
105
|
+
@erro_line = e.backtrace[0].split(":")
|
106
|
+
@error_line = @erro_line[1]
|
107
|
+
@error_message = "#{$!}"
|
108
|
+
@error_line = Integer(@error_line) rescue "ErrorImage"
|
109
|
+
dur2 = Time.now
|
110
|
+
status = "fail"
|
111
|
+
result = "Exception occured, Checkpoint should have more info."
|
112
|
+
checkpoint = "Error Message: #{@error_message} , Script Line Number: #{@error_line}"
|
113
|
+
duration = dur2 - dur1
|
114
|
+
taskhash = GetNextTask(task_id,tokenID,status,result,checkpoint,duration)
|
115
|
+
$workflow_status = "finished"
|
116
|
+
# Take error image:
|
117
|
+
# $browser.screenshot.save "#{dirname}/#{@error_line}.png"
|
118
|
+
end
|
119
|
+
tatus = $status
|
120
|
+
result = $result
|
121
|
+
checkpoint = $checkpoint
|
122
|
+
duration = dur2 - dur1
|
123
|
+
end
|
53
124
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qacloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ravi Trivedi
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-10-30 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: apisatqacloud
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.1
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.1
|
13
27
|
description: Use this gem with playlist automation framework:.
|
14
28
|
email:
|
15
29
|
- testerravit@gmail.com
|