Class: SuperTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- SuperTest
- Includes:
- AssertHelper, ConfigHelper, HtmlHelper, HttpHelper, JsonHelper, MtopHelper, MylogHelper, RobotHelper
- Defined in:
- lib/super_test.rb
Overview
定义基类
Constant Summary
Constants included from ConfigHelper
ConfigHelper::CONF, ConfigHelper::ENV
Instance Method Summary collapse
-
#initialize(*params) ⇒ SuperTest
constructor
将系统的和用户自定义的以 Helper|Pattern|Action 结尾的Module,全都include进来.
- #setup ⇒ Object
- #teardown ⇒ Object
Methods included from MtopHelper
Methods included from JsonHelper
Methods included from RobotHelper
Methods included from AssertHelper
#assert_attr, #assert_children, #assert_code, #assert_exist, #assert_grep, #assert_has, #assert_has_not, #assert_html, #assert_no_attr, #assert_no_exist, #assert_no_grep, #assert_no_html, #assert_no_text, #assert_ok, #assert_redirected_to, #assert_size, #assert_text
Methods included from HttpHelper
#clear_cookie, #delete, #do_encode, #dont_encode, #download, #get, #post, #print_body, #print_head, #put
Methods included from HtmlHelper
#find_attr, #find_children, #find_exist?, #find_grep, #find_has?, #find_html, #find_raw_attr, #find_scan, #find_size, #find_text, #hpricot_search
Methods included from MylogHelper
Constructor Details
#initialize(*params) ⇒ SuperTest
将系统的和用户自定义的以 Helper|Pattern|Action 结尾的Module,全都include进来
76 77 78 79 80 81 82 83 84 |
# File 'lib/super_test.rb', line 76 def initialize(*params) Object.constants.each do |k| if k.to_s =~ /^.+(Helper|Action)$/ m = Object.const_get(k) self.extend(m) if m.instance_of? Module end end super(*params) end |
Instance Method Details
#setup ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/super_test.rb', line 86 def setup super # 用户仓库 @user_house = UserHouse.get_instance # 字符仓库 @char_house = CharHouse.get_instance # 初始化cookie池 @cookies = {} # 初始化referer为空 @referer = "" # 初始化用户为空 @user = nil # 是否做压力,压力的情况下会屏蔽掉所有assert @is_press = false # 默认是要进行转码的 @dont_encode = false start_appium if CONF["appium"] end |
#teardown ⇒ Object
105 106 107 108 |
# File 'lib/super_test.rb', line 105 def teardown super stop_appium if CONF["appium"] end |