Sha256: 97df05a1efc728a02d7bdf40d98d620431f7f49687aebb0381658d01cc5b32b4

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 KB

Contents

require File.dirname(__FILE__) + "/test_helper"

unit_tests do
  test "puts result on blackboard" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    blackboard.write_test TestFactory.passing_test

    DeepTest::Worker.new(blackboard).run

    assert_kind_of Test::Unit::TestResult, blackboard.take_result
  end

  test "puts passing and failing tests on blackboard for each test" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    blackboard.write_test TestFactory.passing_test
    blackboard.write_test TestFactory.failing_test

    DeepTest::Worker.new(blackboard).run

    result_1 = blackboard.take_result
    result_2 = blackboard.take_result

    assert_equal true, (result_1.passed? || result_2.passed?)
    assert_equal false, (result_1.passed? && result_2.passed?)
  end
  
  test "capturing stdout" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    blackboard.write_test TestFactory.passing_test_with_stdout
    DeepTest::Worker.new(blackboard).run
    result = blackboard.take_result
    assert_equal "message printed to stdout", result.output
  end
  
  test "retry on deadlock" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    blackboard.write_test TestFactory.deadlock_once_test
    DeepTest::Worker.new(blackboard).run
    result = blackboard.take_result
    assert_equal 0, result.error_count
    assert_equal 0, result.failure_count
    assert_equal 1, result.assertion_count
  end
  
  test "skip on deadlock twice" do
    blackboard = DeepTest::SimpleTestBlackboard.new
    blackboard.write_test TestFactory.deadlock_always_test
    DeepTest::Worker.new(blackboard).run
    result = blackboard.take_result
    assert_equal 0, result.error_count
    assert_equal 0, result.failure_count
    assert_equal 0, result.assertion_count
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
deep_test-1.0.0 test/worker_test.rb
deep_test-1.0.1 test/worker_test.rb
deep_test-1.0.2 test/worker_test.rb
deep_test-1.0.3 test/worker_test.rb
deep_test-1.0.4 test/worker_test.rb
deep_test-1.1.0 test/worker_test.rb