1+ require 'rake'
2+ require 'rubygems'
3+ require 'cucumber'
4+ require 'cucumber/rake/task'
5+ require 'assertthat-bdd'
6+
7+ Cucumber ::Rake ::Task . new do |t |
8+ t . cucumber_opts = %w[ --format json -o reports/cucumber.json ]
9+ end
10+
11+ task :download_features do
12+ AssertThatBDD ::Features . download (
13+ #Optional can be supplied as environment variable ASSERTTHAT_ACCESS_KEY
14+ accessKey :'ASSERTTHAT_ACCESS_KEY' ,
15+ #Optional can be supplied as environment variable ASSERTTHAT_SECRET_KEY
16+ secretKey :'ASSERTTHAT_SECRET_KEY' ,
17+ #Required Jira project id e.g. 10001
18+ projectId : 'PROJECT_ID' ,
19+ #Optional - default ./features
20+ outputFolder : './features/' ,
21+ #Optional proxy url to connect to Jira
22+ proxy : 'PROXY_URL' ,
23+ #Optional - default automated (can be one of: manual/automated/both)
24+ mode : 'automated' ,
25+ #Optional - all features downloaded by default - should be a valid JQL
26+ jql : 'project = XX AND key in (\'XXX-1\')'
27+ )
28+ end
29+
30+ task :upload_report do
31+ AssertThatBDD ::Report . upload (
32+ #Optional can be supplied as environment variable ASSERTTHAT_ACCESS_KEY
33+ accessKey :'ASSERTTHAT_ACCESS_KEY' ,
34+ #Optional can be supplied as environment variable ASSERTTHAT_SECRET_KEY
35+ secretKey :'ASSERTTHAT_SECRET_KEY' ,
36+ #Jira project id e.g. 10001
37+ projectId : 'PROJECT_ID' ,
38+ #The name of the run - default 'Test run dd MMM yyyy HH:mm:ss'
39+ runName : "Dry Tests Run" ,
40+ #Json report folder - default ./reports
41+ jsonReportFolder : "reports" ,
42+ #Regex to search for cucumber reports - default .*.json
43+ jsonReportIncludePattern : ".*/cucumber.json"
44+ )
45+ end
46+
47+ task :cucumber => :download_features
48+
49+ task :default => :cucumber
50+
51+ Rake ::Task [ "cucumber" ] . enhance do
52+ Rake ::Task [ :upload_report ] . invoke
53+ end
0 commit comments