forked from publiclab/mapknitter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure rake test task runner (publiclab#380)
* add a mysql setup file * Squash commits
- Loading branch information
1 parent
45a4f7e
commit 8573505
Showing
4 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,5 @@ $ mysql -u <username> -p | |
``` | ||
|
||
|
||
|
||
## Pending: please add instructions for your respective system | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# ==================== # | ||
|
||
# HOW TO RUN # | ||
|
||
# You can find all rake tasks, both those that come built-in with rake / rails and custom created ones, | ||
# by running `rake --tasks`. Note you might need to set up repo configurations before you are able to run this. | ||
|
||
# `rake --tasks`, shows two columns: the name of the rake task (functions as the CLI command to run the task) and the | ||
# description (what the task does). All the tasks created in this file start with "Autotask" in the description | ||
# for easy reference. You can also find the commands (or command patterns for collections) commented above their respective tasks below. | ||
|
||
# TEST STRUCTURE # | ||
|
||
# Currently, you can | ||
# 1) run all unit, functional, and integration tests together. | ||
# 2) run only unit, functional, or integration tests (files within the corresponding folder can be run concurrently or one a time). | ||
# 3) Last, you can run separate test files within the unit, functional, and integration test folders. | ||
|
||
# If proper naming convention is followed, tasks are autogenerated for individual testing files added to the unit, functional, and | ||
# integration folders (see creation of 'COMPUTE' arrays below). | ||
|
||
# ==================== # | ||
|
||
namespace :test do | ||
|
||
# command: rake test:all | ||
# run unit, functional, and integration test folders (one folder at a time, in the order indicated in the pattern below) | ||
Rake::TestTask.new do |t| | ||
t.name = "all" | ||
t.description = "Autotask - run unit, functional, and integration tests" | ||
t.libs << "test" | ||
t.pattern = FileList["test/unit/*_test.rb", "test/functional/*_test.rb", "test/integration/*_test.rb"] | ||
t.warning = false | ||
t.verbose = true | ||
end | ||
|
||
# command pattern: rake test:unit_test_file.rb | ||
# autogenerates a rake task for every test file added to test/unit | ||
COMPUTE_UNIT_TASKS = [] | ||
Dir.glob("test/unit/*_test.rb").each do |task| | ||
collection = task.gsub(/test\/unit\//, "") | ||
Rake::TestTask.new(:"#{collection}") do |t| | ||
t.libs << "test" | ||
t.description = "Autotask - run unit tests - #{collection}" | ||
t.pattern = FileList["test/unit/#{collection}"] | ||
t.warning = false | ||
t.verbose = true | ||
end | ||
COMPUTE_UNIT_TASKS << "#{collection}" | ||
end | ||
|
||
# command: rake test:unit | ||
# run all unit test files (one file at a time in alphabetical order) | ||
desc "Autotask - run unit tests" | ||
task :unit => COMPUTE_UNIT_TASKS | ||
|
||
# command: rake test:unit_parallel | ||
# run all unit test files concurrently (one file at a time, order is not guaranteed) | ||
desc "Autotask - run unit tests in parallel" | ||
multitask :unit_parallel => COMPUTE_UNIT_TASKS | ||
|
||
# command pattern: rake test:functional_test_file.rb | ||
# autogenerates a rake task for every test file added to test/functional | ||
COMPUTE_FUNCTIONAL_TASKS = [] | ||
Dir.glob("test/functional/*_test.rb").each do |task| | ||
collection = task.gsub(/test\/functional\//, "") | ||
Rake::TestTask.new(:"#{collection}") do |t| | ||
t.libs << "test" | ||
t.description = "Autotask - run functional tests - #{collection}" | ||
t.pattern = FileList["test/functional/#{collection}"] | ||
t.warning = false | ||
t.verbose = true | ||
end | ||
COMPUTE_FUNCTIONAL_TASKS << "#{collection}" | ||
end | ||
|
||
# command: rake test:functional | ||
# run all functional test files | ||
desc "Autotask - run functional tests" | ||
task :functional => COMPUTE_FUNCTIONAL_TASKS | ||
|
||
# command: rake test:functional_parallel | ||
# run all functional test files concurrently | ||
desc "Autotask - run functional tests in parallel" | ||
multitask :functional_parallel => COMPUTE_FUNCTIONAL_TASKS | ||
|
||
# command pattern: rake test:integration_test_file.rb | ||
# autogenerates a rake task for every test file added to test/integration | ||
COMPUTE_INTEGRATION_TASKS = [] | ||
Dir.glob("test/integration/*_test.rb").each do |task| | ||
collection = task.gsub(/test\/integration\//, "") | ||
Rake::TestTask.new(:"#{collection}") do |t| | ||
t.libs << "test" | ||
t.description = "Autotask - run integration tests - #{collection}" | ||
t.pattern = FileList["test/integration/#{collection}"] | ||
t.warning = false | ||
t.verbose = true | ||
end | ||
COMPUTE_INTEGRATION_TASKS << "#{collection}" | ||
end | ||
|
||
# command: rake test:integration | ||
# run all integration test files | ||
desc "Autotask - run integration tests" | ||
task :integration => COMPUTE_INTEGRATION_TASKS | ||
|
||
# command: rake test:integration_parallel | ||
# run all integration test files concurrently | ||
desc "Autotask - run integration tests in parallel" | ||
multitask :integration_parallel => COMPUTE_INTEGRATION_TASKS | ||
|
||
end |