Class: VertxUnit::TestSuite
- Inherits:
-
Object
- Object
- VertxUnit::TestSuite
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/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.
Class Method Summary (collapse)
-
+ (::VertxUnit::TestSuite) create(name = nil)
Create and return a new test suite.
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) { ... }
Add a new test case to the suite.
Class Method Details
+ (::VertxUnit::TestSuite) create(name = nil)
Create and return a new test suite.
30 31 32 33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 30 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 |
Instance Method Details
- (self) after { ... }
Set a callback executed after the tests.
59 60 61 62 63 64 65 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 59 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.
69 70 71 72 73 74 75 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 69 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.
39 40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 39 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.
49 50 51 52 53 54 55 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 49 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
VertxUnit::TestCompletion object can be used to get a completion callback.
101 102 103 104 105 106 107 108 109 110 111 112 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 101 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) { ... }
Add a new test case to the suite.
80 81 82 83 84 85 86 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/test_suite.rb', line 80 def test(name=nil) if name.class == String && block_given? @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 end raise ArgumentError, "Invalid arguments when calling test(name)" end |