super-test 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGE.txt +9 -0
  3. data/README.txt +13 -0
  4. data/bin/idb +19 -0
  5. data/bin/ii +113 -0
  6. data/bin/istart_mock +36 -0
  7. data/bin/istop_mock +16 -0
  8. data/bin/kk +181 -0
  9. data/bin/rubyatp +42 -0
  10. data/bin/start_mock +36 -0
  11. data/bin/stop_mock +16 -0
  12. data/bin/xgo +45 -0
  13. data/conf/conf.rb +11 -0
  14. data/conf/db03.yml +31 -0
  15. data/conf/db13.yml +37 -0
  16. data/conf/db19.yml +33 -0
  17. data/conf/online.yml +32 -0
  18. data/conf/super_test.yml +40 -0
  19. data/conf/system.yml +26 -0
  20. data/conf/sz00.yml +31 -0
  21. data/conf/sz06.yml +34 -0
  22. data/conf/wise00.yml +11 -0
  23. data/data/case.house +0 -0
  24. data/data/char.house +0 -0
  25. data/data/images/Bluehills.jpg +0 -0
  26. data/data/images/Sunset.jpg +0 -0
  27. data/data/images/Waterlilies.jpg +0 -0
  28. data/data/images/Winter.jpg +0 -0
  29. data/data/query.house +18595 -0
  30. data/data/user.house +8 -0
  31. data/lib/action/module/check_action.rb +58 -0
  32. data/lib/action/module/cnnt_action.rb +161 -0
  33. data/lib/action/module/datacenter_action.rb +48 -0
  34. data/lib/action/module/http_pack_helper.rb +163 -0
  35. data/lib/action/module/httpserver_action.rb +297 -0
  36. data/lib/action/module/inc.rb +21 -0
  37. data/lib/action/module/mcpack_action.rb +57 -0
  38. data/lib/action/module/sql_action.rb +84 -0
  39. data/lib/action/module/ssh_action.rb +37 -0
  40. data/lib/action/system/user_action.rb +180 -0
  41. data/lib/common/appium_helper.rb +217 -0
  42. data/lib/common/atp_helper.rb +74 -0
  43. data/lib/common/atp_report.rb +344 -0
  44. data/lib/common/data_house.rb +405 -0
  45. data/lib/common/data_model.rb +87 -0
  46. data/lib/common/http/assert_helper.rb +343 -0
  47. data/lib/common/http/fix_hpricot.rb +118 -0
  48. data/lib/common/http/html_helper.rb +362 -0
  49. data/lib/common/http/http_helper.rb +469 -0
  50. data/lib/common/http/multipart.rb +81 -0
  51. data/lib/common/isandbox_helper.rb +195 -0
  52. data/lib/common/json_helper.rb +43 -0
  53. data/lib/common/mock_helper.rb +168 -0
  54. data/lib/common/mtop_helper.rb +141 -0
  55. data/lib/common/myconf_helper.rb +49 -0
  56. data/lib/common/mylog_helper.rb +77 -0
  57. data/lib/common/pairwise.rb +121 -0
  58. data/lib/common/query_house.rb +89 -0
  59. data/lib/common/report_helper.rb +97 -0
  60. data/lib/common/robot_helper.rb +85 -0
  61. data/lib/common/socket/check.rb +325 -0
  62. data/lib/common/socket/conf_modifier.rb +149 -0
  63. data/lib/common/socket/context.rb +55 -0
  64. data/lib/common/socket/data.rb +392 -0
  65. data/lib/common/socket/data_helper.rb +41 -0
  66. data/lib/common/socket/env.rb +317 -0
  67. data/lib/common/socket/inc.rb +24 -0
  68. data/lib/common/socket/log.rb +213 -0
  69. data/lib/common/socket/log4s.rb +58 -0
  70. data/lib/common/socket/log_helper.rb +332 -0
  71. data/lib/common/socket/my_sql.rb +77 -0
  72. data/lib/common/socket/net.rb +74 -0
  73. data/lib/common/socket/network.rb +115 -0
  74. data/lib/common/socket/rlib/conf_modifier.rb +130 -0
  75. data/lib/common/socket/rlib/data_helper.rb +33 -0
  76. data/lib/common/socket/rlib/log_helper.rb +303 -0
  77. data/lib/common/socket/rlib/process_helper.rb +91 -0
  78. data/lib/common/socket/stub.rb +276 -0
  79. data/lib/common/socket/util.rb +266 -0
  80. data/lib/patterns/inc.rb +10 -0
  81. data/lib/patterns/mc_base_pattern.rb +474 -0
  82. data/lib/patterns/some_pattern.rb +145 -0
  83. data/lib/super_test.rb +114 -0
  84. data/log/super_test.log +0 -0
  85. data/log/super_test.log.wf +0 -0
  86. data/test/cover_me.rb +6 -0
  87. data/tool/jenny +0 -0
  88. data/tool/mcsend/mcsend2 +0 -0
  89. data/tool/mcsend/mcsend2_shead +0 -0
  90. data/tool/mcserver/conf/mcserver.conf +77 -0
  91. data/tool/mcserver/conf/mcserverauthip +17 -0
  92. data/tool/mcserver/mcserver +0 -0
  93. data/tool/mcserver/mcserver_trans +0 -0
  94. data/tool/mysql +0 -0
  95. data/tool/net/mcsend/mcsend +0 -0
  96. data/tool/net/mcsend/mcsend_trans +0 -0
  97. data/tool/net/mcsend/nshead.data +7 -0
  98. data/tool/net/mcsend/res_nshead.data +7 -0
  99. data/tool/net/my_client/my_client +0 -0
  100. data/tool/net/tsclient/client.tcl +205 -0
  101. data/tool/others/kk +190 -0
  102. data/tool/others/rubyatp +42 -0
  103. data/tool/others/supertest_install.sh +34 -0
  104. data/tool/trip/idb +0 -0
  105. data/tool/ts-agent/nshead.bft +12 -0
  106. data/tool/ts-agent/server.conf +10 -0
  107. data/tool/ts-agent/server.tcl +376 -0
  108. metadata +275 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 33c413f8821f544f46c7c3de7bae634d02dad54d
4
+ data.tar.gz: a27d2da669de86b5d438d3d4aa868529e4ff719c
5
+ SHA512:
6
+ metadata.gz: 68012dca01682ddbd8bc61065c74fee454ebde342261232461f0269baeac992c54b1c9109259522b4c65c2e7716e377928b73e79577d4f3d19410ec8c1942ae0
7
+ data.tar.gz: 9c855addb3b8b61040d0c28e43b2f497c92fa315123142150df885f30d5ffbbb62784b0186a553f540f6b034e1dcbf1bae7ff27257999f49167b4cd09c5bb39c
@@ -0,0 +1,9 @@
1
+ ## 1.0.8
2
+ --------
3
+ - feature
4
+ - 增加idb命令,使用方法直接命令行运行adb,根据提示使用即可
5
+
6
+ - bug fix
7
+ - 消除无用的warning日志
8
+ -
9
+
@@ -0,0 +1,13 @@
1
+ =================================
2
+ ===
3
+ === 下载后的安装步骤:
4
+ === 1. cd /path/to/super-test
5
+ === 2. gem build super-test.gemspec
6
+ === # 然后会在super-test目录下生成super-test.${version}.gem
7
+ === 3. gem install super-test.${version}.gem
8
+ === 大功告成!
9
+ === 可以使用/Library/Ruby/Gems/2.0.0/gems/super-test-0.0.3/bin/kk -c hello在自定义的目录下创建一个自动化测试用例
10
+ ===
11
+ ===
12
+ =================================
13
+
data/bin/idb ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Author:: zhengmao.yzm
5
+ # Date:: 2016-05-23
6
+ #
7
+
8
+ # trip tool的根目录
9
+ TRIP_TOOL = "#{File.dirname(File.dirname(File.expand_path(__FILE__)))}"
10
+
11
+ # 传递参数给真 idb
12
+ params = ''
13
+ ARGV.each do |item|
14
+ params += item.to_s + ' '
15
+ end
16
+
17
+ cmd = "#{TRIP_TOOL}/tool/trip/idb " + params
18
+
19
+ system cmd
data/bin/ii ADDED
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Author:: leiming.lm
5
+ # Date:: 2016-02-02
6
+ #
7
+
8
+ require 'super_test'
9
+ require 'irb'
10
+ require "wirble"
11
+
12
+ Wirble.init
13
+ Wirble.colorize
14
+
15
+
16
+ class SuperIrb
17
+
18
+ # 将系统的和用户自定义的Helper,只要是以Helper结尾的Module,全都include进来
19
+ def initialize(*params)
20
+ Object.constants.each do |k|
21
+ if k.to_s =~ /^.+(Helper|Pattern|Action)$/
22
+ m = Object.const_get(k)
23
+ self.extend(m) if m.instance_of? Module
24
+ end
25
+ end
26
+
27
+ # 用户仓库
28
+ @user_house = UserHouse.get_instance
29
+ # 字符仓库
30
+ #@char_house = CharHouse.get_instance
31
+ # 初始化cookie池
32
+ @cookies = {}
33
+ # 初始化referer为空
34
+ @referer = ""
35
+ # 初始化用户为空
36
+ @user = nil
37
+ # 是否做压力,压力的情况下会屏蔽掉所有assert
38
+ @is_press = false
39
+ # 默认是要进行转码的
40
+ @dont_encode = false
41
+ end
42
+
43
+ end
44
+
45
+ module IRB
46
+
47
+ def IRB.parse_opts
48
+ # Don't touch ARGV, which belongs to the app which called this module.
49
+ @CONF[:USE_READLINE] = false ##默认不适用readline,以避免mac上ii无法输入中文的问题
50
+
51
+ while ii_arg = $*.shift
52
+ case ii_arg
53
+ when "--readline"
54
+ @CONF[:USE_READLINE] = true ## 如果用户自己安装了readline,可以通过此方式启动
55
+ end
56
+ end
57
+ end
58
+
59
+ def IRB.start_session(*args)
60
+ unless $irb
61
+ IRB.setup nil
62
+ ## maybe set some opts here, as in parse_opts in irb/init.rb?
63
+ end
64
+ workspace = WorkSpace.new(*args)
65
+
66
+ if @CONF[:SCRIPT] ## normally, set by parse_opts
67
+ $irb = Irb.new(workspace, @CONF[:SCRIPT])
68
+ else
69
+ $irb = Irb.new(workspace)
70
+ end
71
+
72
+ @CONF[:IRB_RC].call($irb.context) if @CONF[:IRB_RC]
73
+ @CONF[:MAIN_CONTEXT] = $irb.context
74
+
75
+ trap 'INT' do
76
+ $irb.signal_handle
77
+ end
78
+
79
+ custom_configuration if defined?(IRB.custom_configuration)
80
+
81
+ begin
82
+ catch(:IRB_EXIT) do
83
+ $irb.eval_input
84
+ end
85
+ ensure
86
+ ii_at_exit
87
+ end
88
+ print "\n"
89
+ end
90
+
91
+ # Calls each event hook of IRB.conf[:AT_EXIT] when the current session quits.
92
+ def IRB.ii_at_exit
93
+ puts ">> appium driver quit."
94
+ $appium_driver.driver_quit unless $appium_driver.nil?
95
+ #@CONF[:AT_EXIT].each{ |hook| hook.call }
96
+ end
97
+
98
+ end
99
+
100
+ class Object
101
+ include IRB::ExtendCommandBundle # so that Marshal.dump works
102
+ end
103
+
104
+
105
+ # 初始化
106
+ si = SuperIrb.new
107
+ prompt = "SuperIrb>"
108
+
109
+ # 开始
110
+ puts "================================================"
111
+ puts " Welcome to SuperTest's irb ! @_@"
112
+ puts "================================================"
113
+ IRB.start_session(si)
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Author:: zhengmao.yzm
5
+ # Date:: 2016-05-23
6
+ #
7
+
8
+ require 'super_test'
9
+ include MockHelper
10
+ mock_args = $*
11
+
12
+ if mock_args.size != 1 && mock_args.size != 2
13
+ puts "args number is error! \n\nUSAGE: \nistart_mock your/mock/file [api_name]\tapi_name为可选参数"
14
+ exit(1)
15
+ end
16
+ if mock_args.size == 1
17
+ mock_arg = mock_args.shift
18
+ file_name = nil
19
+ else
20
+ mock_arg = mock_args.shift
21
+ file_name = mock_args.shift
22
+ end
23
+
24
+
25
+
26
+ begin
27
+ if file_name.nil?
28
+ istart_mock(mock_arg)
29
+ else
30
+ istart_mock(mock_arg, file_name)
31
+ end
32
+
33
+ puts "success"
34
+ rescue
35
+ raise Exception, "error:#{$!} at:#{$@}"
36
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Author:: zhengmao.yzm
5
+ # Date:: 2016-05-23
6
+ #
7
+
8
+ require 'super_test'
9
+ include MockHelper
10
+
11
+ begin
12
+ istop_mock
13
+ puts "success"
14
+ rescue
15
+ raise Exception, "error:#{$!} at:#{$@}"
16
+ end
data/bin/kk ADDED
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Author:: leiming.lm
5
+ # Date:: 2016-02-02
6
+ #
7
+
8
+ def gen_case(filename,casename)
9
+ text = %Q|#!/usr/bin/env ruby
10
+ # coding: utf-8
11
+ #
12
+ # Author:: #{ENV['USER']}
13
+ # Date:: #{Time.now}
14
+ #
15
+ # App::
16
+ # Version::
17
+ #
18
+ $CASE_PATH = __FILE__
19
+ ###########################################
20
+ require 'super_test'
21
+
22
+
23
+ # {case描述}
24
+ class #{casename} < SuperTest
25
+
26
+ # {测试点}
27
+ def test_me
28
+ #TODO
29
+ end
30
+
31
+ end
32
+ |
33
+ File.open(filename,"w") {|file| file.write(text) }
34
+ system("vim #{filename} +16")
35
+ end
36
+
37
+ # 生成helper
38
+ def gen_helper(filename,hname)
39
+ text = %Q|#!/usr/bin/env ruby
40
+ # coding: utf-8
41
+ #
42
+ # Author:: #{ENV['USER']}
43
+ # Date:: #{Time.now}
44
+ ###########################################
45
+
46
+
47
+
48
+ # {helper描述}
49
+ module #{hname}
50
+
51
+ # {具体功能描述及示例}
52
+ def my_func(param)
53
+ #TODO
54
+ end
55
+
56
+ end
57
+ |
58
+ File.open(filename,"w") {|file| file.write(text) }
59
+ system("vim #{filename} +15")
60
+ end
61
+
62
+ # 生成pattern
63
+ def gen_pattern(filename,pname)
64
+ text = %Q|#!/usr/bin/env ruby
65
+ # coding: utf-8
66
+ #
67
+ # Author:: #{ENV['USER']}
68
+ # Date:: #{Time.now}
69
+ ###########################################
70
+
71
+
72
+
73
+ # {pattern描述}
74
+ module #{pname}
75
+
76
+ # {具体模式描述及示例}
77
+ def my_pattern(param)
78
+ #TODO
79
+ end
80
+
81
+ end
82
+ |
83
+ File.open(filename,"w") {|file| file.write(text) }
84
+ system("vim #{filename} +15")
85
+ end
86
+
87
+ # 生成action
88
+ def gen_action(filename,aname)
89
+ text = %Q|#!/usr/bin/env ruby
90
+ # coding: utf-8
91
+ #
92
+ # Author:: #{ENV['USER']}
93
+ # Date:: #{Time.now}
94
+ ###########################################
95
+
96
+
97
+
98
+ # {action描述}
99
+ module #{aname}
100
+
101
+ # {具体行为描述及示例}
102
+ def just_do_it(user)
103
+ #TODO
104
+ end
105
+
106
+ end
107
+ |
108
+ File.open(filename,"w") {|file| file.write(text) }
109
+ system("vim #{filename} +15")
110
+ end
111
+
112
+ def usage
113
+ print "KK
114
+
115
+ NAME
116
+ kk - 取名kk是因为输入起来很简单 : )
117
+
118
+ SYNOPSIS
119
+ kk [FILE]
120
+
121
+ DESCRIPTION
122
+ kk a_case
123
+ 后面跟着文件名将生成自动化case模板
124
+ case名称规范: {case含义备注字段}_{文本case的kelude_id}.rb (如: alitrip_home_125698.rb)
125
+ kk an_action
126
+ 后面跟着文件名将生成action模板
127
+ action名称规范: {action名}_action.rb (如: alitrip_home_action.rb)
128
+ action名称要能准确概括该action文件下的所有关键字的共同属性,例如alitrip_home_action.rb中都应是旅客首页中用到的关键字
129
+ kk a_helper
130
+ 后面跟着文件名将生成helper模板
131
+ helper名称规范: {helper名}_helper.rb (如: appium_helper.rb, log_helper.rb)
132
+ helper名称要能准确概括该helper的物理含义,例如appium_helper.rb是appium在supertest中的一种存在形式,其中封装了appium提供的关键字
133
+ kk a_pattern
134
+ 后面跟着文件名将生产pattern模板
135
+ pattern名称规范: {pattern名}_pattern.rb (如: login_pattern.rb)
136
+ pattern名称要能准确概括该pattern文件下的pattern公共含义,例如login_pattern.rb中都应是涉及登陆相关的pattern
137
+ -h, --help
138
+ 帮助文档
139
+
140
+ AUTHOR
141
+ kk
142
+
143
+ SEE ALSO
144
+ http://work.taobao.net/projects/tripclient_automation2
145
+
146
+ kk (alitriputils) 1.0.1
147
+ "
148
+ end
149
+
150
+ # 解析参数
151
+ if ARGV.size == 0 or ARGV[0].start_with?("-")
152
+ usage
153
+ else
154
+ name = ARGV[0].downcase
155
+ name = name.end_with?(".rb") ? name[0...-3] : name
156
+ filename = name+".rb"
157
+ casename = name.split('_').reduce(""){|sum,n| sum+n.capitalize}
158
+
159
+ if File.exist? filename
160
+ print "#{filename} 已经存在了,是否替换掉? [y/n]"
161
+ ans = STDIN.gets
162
+ if ans.rstrip != "y"
163
+ puts "退出咯!!"
164
+ exit
165
+ end
166
+ end
167
+ type = name.split('_')[-1]
168
+ case type
169
+ when "pipe"
170
+ gen_pipe filename,casename
171
+ when "action"
172
+ gen_action filename,casename
173
+ when "helper"
174
+ gen_helper filename,casename
175
+ when "pattern"
176
+ gen_pattern filename,casename
177
+ else
178
+ gen_case filename,casename
179
+ end
180
+ end
181
+
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+ #
4
+ # Author:: liqiang01
5
+ # Date:: 2009-8-31 20:50:10
6
+
7
+ =begin
8
+
9
+ 使用atp调用supertest case的adapter
10
+ atp发起执行字段为:
11
+ rubyatp #{@this.id}
12
+
13
+ =end
14
+
15
+ def run_case line
16
+ casenames = Dir.glob("#{line}/**/*_#{ARGV[0]}.rb")
17
+ puts "Got case"
18
+ if ( casenames.length == 0 )
19
+ puts "Case Not found"
20
+ else
21
+ puts casenames
22
+ puts "Run case"
23
+ casenames.each{|casei|
24
+ puts "Runing: #{casei}"
25
+ system( "source ~/.bash_profile; ruby #{casei}" )
26
+ }
27
+ end
28
+ end
29
+
30
+ # get case path from env param RUBYLIB
31
+ dir = `source ~/.bash_profile; echo $RUBYLIB`.chop!
32
+ libs = dir.split(":")
33
+ libs.each{ |line|
34
+ if(! (line =~ /super-test/) )
35
+ line.gsub!(/lib/, "case")
36
+ run_case "#{line}/module"
37
+ run_case "#{line}/system"
38
+ end
39
+ }
40
+
41
+
42
+