Class: VertxUnit::TestSuite
- Inherits:
-
Object
- Object
- VertxUnit::TestSuite
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb
Overview
A named suite of test cases that are executed altogether. The suite suite is created with
the #create and the returned suite contains initially no tests.
The suite can declare a callback before the suite with #before or after
the suite with #after.
The suite can declare a callback before each test with #before_each or after
each test with #after_each.
Each test case of the suite is declared by calling the #test method.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxUnit::TestSuite) create(name = nil)
Create and return a new test suite.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (self) after { ... }
Set a callback executed after the tests.
-
- (self) after_each { ... }
Set a callback executed after each test and before the suite after callback.
-
- (self) before { ... }
Set a callback executed before the tests.
-
- (self) before_each { ... }
Set a callback executed before each test and after the suite before callback.
-
- (::VertxUnit::TestCompletion) run(param_1 = nil, param_2 = nil)
Run the testsuite with the specified options and the specified vertx instance.
-
- (self) test(name = nil, repeat = nil) { ... }
Add a new test case to the suite.
Class Method Details
+ (Boolean) accept?(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 29 def @@j_api_type.accept?(obj) obj.class == TestSuite end |
+ (::VertxUnit::TestSuite) create(name = nil)
Create and return a new test suite.
47 48 49 50 51 52 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 47 def self.create(name=nil) if name.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtUnit::TestSuite.java_method(:create, [Java::java.lang.String.java_class]).call(name),::VertxUnit::TestSuite) end raise ArgumentError, "Invalid arguments when calling create(#{name})" end |
+ (Object) j_api_type
38 39 40 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 38 def self.j_api_type @@j_api_type end |
+ (Object) j_class
41 42 43 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 41 def self.j_class Java::IoVertxExtUnit::TestSuite.java_class end |
+ (Object) unwrap(obj)
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 35 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 32 def @@j_api_type.wrap(obj) TestSuite.new(obj) end |
Instance Method Details
- (self) after { ... }
Set a callback executed after the tests.
76 77 78 79 80 81 82 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 76 def after if block_given? @j_del.java_method(:after, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestContext)) })) return self end raise ArgumentError, "Invalid arguments when calling after()" end |
- (self) after_each { ... }
Set a callback executed after each test and before the suite
after
callback.
86 87 88 89 90 91 92 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 86 def after_each if block_given? @j_del.java_method(:afterEach, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestContext)) })) return self end raise ArgumentError, "Invalid arguments when calling after_each()" end |
- (self) before { ... }
Set a callback executed before the tests.
56 57 58 59 60 61 62 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 56 def before if block_given? @j_del.java_method(:before, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestContext)) })) return self end raise ArgumentError, "Invalid arguments when calling before()" end |
- (self) before_each { ... }
Set a callback executed before each test and after the suite
before
callback.
66 67 68 69 70 71 72 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 66 def before_each if block_given? @j_del.java_method(:beforeEach, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestContext)) })) return self end raise ArgumentError, "Invalid arguments when calling before_each()" end |
- (::VertxUnit::TestCompletion) run - (::VertxUnit::TestCompletion) run(options) - (::VertxUnit::TestCompletion) run(vertx) - (::VertxUnit::TestCompletion) run(vertx, options)
Run the testsuite with the specified
options
and the specified vertx
instance.
The test suite will be executed on the event loop provided by the vertx
argument when
Hash#set_use_event_loop is not set to false
. The returned
Completion object can be used to get a completion callback.
122 123 124 125 126 127 128 129 130 131 132 133 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 122 def run(param_1=nil,param_2=nil) if !block_given? && param_1 == nil && param_2 == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:run, []).call(),::VertxUnit::TestCompletion) elsif param_1.class == Hash && !block_given? && param_2 == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:run, [Java::IoVertxExtUnit::TestOptions.java_class]).call(Java::IoVertxExtUnit::TestOptions.new(::Vertx::Util::Utils.to_json_object(param_1))),::VertxUnit::TestCompletion) elsif param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:run, [Java::IoVertxCore::Vertx.java_class]).call(param_1.j_del),::VertxUnit::TestCompletion) elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:run, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtUnit::TestOptions.java_class]).call(param_1.j_del,Java::IoVertxExtUnit::TestOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxUnit::TestCompletion) end raise ArgumentError, "Invalid arguments when calling run(#{param_1},#{param_2})" end |
- (self) test(name = nil, repeat = nil) { ... }
Add a new test case to the suite.
98 99 100 101 102 103 104 105 106 107 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_suite.rb', line 98 def test(name=nil,repeat=nil) if name.class == String && block_given? && repeat == nil @j_del.java_method(:test, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestContext)) })) return self elsif name.class == String && repeat.class == Fixnum && block_given? @j_del.java_method(:test, [Java::java.lang.String.java_class,Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(name,repeat,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestContext)) })) return self end raise ArgumentError, "Invalid arguments when calling test(#{name},#{repeat})" end |