summaryrefslogtreecommitdiff
path: root/Rakefile
blob: 830104e6cf539afd1a3fabc5c66a399871b262a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'rspec/core/rake_task'
require 'cucumber'
require 'cucumber/rake/task'

namespace :test do
  desc "Run all tests (unit and integration/specs)"
  task :all do
    puts "Running unit tests"
    Rake::Task["test:unit"].execute
    puts "Running integration (spec) tests"
    Rake::Task[:spec].execute
    puts "Running cucumber features"
    Rake::Task[:features].execute
  end

  desc "Run unit tests"
  task :unit do
    if ENV["COVERAGE"]
      puts "Running unit tests with coverage (view output at ./htmlcov/index.html)"
      cmd = "coverage run -m unittest discover && coverage report -m --include='python3/vdebug/*'"
    else
      cmd = "python -m unittest discover"
    end
    puts cmd
    system cmd
  end

  desc "Run integration tests (alias for `spec`)"
  task :integration do
    Rake::Task[:spec]
  end
end

RSpec::Core::RakeTask.new(:spec)
Cucumber::Rake::Task.new(:features) do |t|
  t.cucumber_opts = "features --format pretty"
end

task :default => "test:all"