Module: AppTester Abstract
- Defined in:
- lib/app-tester.rb,
lib/app-tester/core.rb,
lib/app-tester/test.rb,
lib/app-tester/timer.rb,
lib/app-tester/utils.rb,
lib/app-tester/parser.rb,
lib/app-tester/checker.rb,
lib/app-tester/options.rb,
lib/app-tester/connection.rb,
lib/app-tester/exceptions.rb,
lib/app-tester/utils/colors.rb,
lib/app-tester/utils/strings.rb
Overview
This module is abstract.
AppTester main module and namespace
Defined Under Namespace
Modules: Checker, Error, Utils Classes: Connection, Core, Options, Parser, Test, Timer
Constant Summary collapse
- VERSION =
'0.1.2.1'
Class Attribute Summary collapse
-
.options ⇒ Object
readonly
Returns the value of attribute options.
-
.tests ⇒ Object
readonly
Returns the value of attribute tests.
Class Method Summary collapse
-
.define_test(name = "") { ... } ⇒ AppTester::Test, NilClass
Create a new test object.
-
.get_test(name) ⇒ AppTester::Test
Retrieve a test by name.
-
.new {|options| ... } ⇒ AppTester
Construct AppTester framework.
-
.run_all ⇒ Object
Run all tests.
-
.run_test(name, arguments = ARGV) ⇒ AppTester::Test
Run a test.
-
.set_options_for(name) {|options_parser| ... } ⇒ AppTester::Test
Defines command line options for a given test.
Class Attribute Details
.options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/app-tester.rb', line 13 def @options end |
.tests ⇒ Object (readonly)
Returns the value of attribute tests.
14 15 16 |
# File 'lib/app-tester.rb', line 14 def tests @tests end |
Class Method Details
.define_test(name = "") { ... } ⇒ AppTester::Test, NilClass
Create a new test object
55 56 57 58 59 60 61 62 63 |
# File 'lib/app-tester.rb', line 55 def define_test name="", &block if name.empty? raise AppTester::Error::NameEmptyError, "Attempted to define a test without a name" end block = Proc.new{} unless block_given? test = AppTester::Test.new(name, @options, &block) @tests.push title: name, test: test test end |
.get_test(name) ⇒ AppTester::Test
Retrieve a test by name
82 83 84 85 86 87 88 |
# File 'lib/app-tester.rb', line 82 def get_test name entry = @tests.find { |t| t[:title] == name } if entry.nil? raise AppTester::Error::TestNotFoundError, "Could not find test #{name}" end entry[:test] end |
.new {|options| ... } ⇒ AppTester
Construct AppTester framework
28 29 30 31 32 33 |
# File 'lib/app-tester.rb', line 28 def new @tests = [] @options = AppTester::Options.new yield @options if block_given? self end |
.run_all ⇒ Object
Run all tests
152 153 154 155 156 |
# File 'lib/app-tester.rb', line 152 def run_all @tests.each do |test| run_test test[:title] end end |
.run_test(name, arguments = ARGV) ⇒ AppTester::Test
Run a test
143 144 145 146 147 |
# File 'lib/app-tester.rb', line 143 def run_test name, arguments=ARGV the_test = get_test(name) the_test.run(arguments) the_test end |
.set_options_for(name) {|options_parser| ... } ⇒ AppTester::Test
Defines command line options for a given test
111 112 113 114 115 |
# File 'lib/app-tester.rb', line 111 def name test = get_test name yield test.parser test end |