Skip to content

Commit

Permalink
Make it possible to run tests one by one (isolated)
Browse files Browse the repository at this point in the history
  • Loading branch information
Genki-S committed Aug 3, 2015
1 parent 98a3600 commit 012d484
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/ttnt/testtask.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ def define_run_task
if tests.empty?
STDERR.puts 'No test selected.'
else
args =
"#{@rake_testtask.ruby_opts_string} #{@rake_testtask.run_code} " +
"#{tests.to_a.join(' ')} #{@rake_testtask.option_list}"
run_ruby args
if ENV['ISOLATED']
tests.each do |test|
args = "#{@rake_testtask.ruby_opts_string} #{test} #{@rake_testtask.option_list}"
run_ruby args
end
else
args =
"#{@rake_testtask.ruby_opts_string} #{@rake_testtask.run_code} " +
"#{tests.to_a.join(' ')} #{@rake_testtask.option_list}"
run_ruby args
end
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions test/integration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ def test_tests_are_selected_based_on_changes_in_current_working_tree
output = rake('ttnt:test:run')
assert_match '2 runs, 2 assertions, 2 failures', output[:stdout]
end

def test_isolated
# Make TTNT select all tests
git_rm_and_commit("#{@repo.workdir}/.ttnt", 'Remove .ttnt')
ENV['ISOLATED'] = '1'
output = rake('ttnt:test:run')
ENV.delete('ISOLATED')
assert_equal 3, output[:stdout].split('# Running:').count
end
end

class AdditionAmongComments < TTNT::TestCase::AdditionAmongComments
Expand Down

0 comments on commit 012d484

Please sign in to comment.