~c2c-oerpscenario/oerpscenario/stable-6.0

« back to all changes in this revision

Viewing changes to features/base_module_quality/step_definitions/base_module_quality.rb

  • Committer: Joel Grand-Guillaume
  • Date: 2010-01-22 10:26:44 UTC
  • mfrom: (30.1.32 OERPScenario)
  • Revision ID: joel.grandguillaume@camptocamp.com-20100122102644-79ck3f4kbbi3c6yk
[MRG] Merge from trunk, Adding:
- Demo data handling
- Rakefile handling
- Better helpers
- More test case for bank statement and rounding
- Memorizer system to better handle tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###############################################################################
 
2
#
 
3
#    OERPScenario, OpenERP Functional Tests
 
4
#    Author Joel Grand-Guillaume 2009 
 
5
#    Copyright Camptocamp SA
 
6
#
 
7
#    This program is free software: you can redistribute it and/or modify
 
8
#    it under the terms of the GNU General Public License as published by
 
9
#    the Free Software Foundation, either version 3 Afero of the License, or
 
10
#    (at your option) any later version.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
##############################################################################
 
21
 
 
22
@modules = false
 
23
@test_result = false
 
24
# Before do
 
25
#     # Initiate vars used to stored object used trought the tests
 
26
# end
 
27
 
 
28
 
 
29
##############################################################################
 
30
#           Scenario: install_and_run_base_module_quality
 
31
##############################################################################
 
32
 
 
33
##############################################################################
 
34
Given /^I want to run the quality tests provided by base_module_quality on installed module$/ do
 
35
  @modules=IrModuleModule.find(:all,:domain=>[['name','=','base_module_quality']])
 
36
  @modules.should be_true
 
37
end
 
38
##############################################################################
 
39
When /^I insall the base_module_quality$/ do
 
40
  res = IrModuleModule.install_modules(@modules)
 
41
  res.should be_true
 
42
end
 
43
##############################################################################
 
44
And /^run the quality check on every installed module$/ do
 
45
  @modules=IrModuleModule.find(:all,:domain=>[['state','=','installed']])
 
46
  @modules.should be_true
 
47
  @test_result=IrModuleModule.run_base_quality_test(@modules)
 
48
  @test_result.should be_true
 
49
end
 
50
##############################################################################
 
51
Then /^I should have a report on every module$/ do
 
52
  @modules.count.should == @test_result.count
 
53
end
 
54
##############################################################################
 
55
Then /^all module, except (\w+), should have a final score greater than (.*) percent$/ do |except_module,percent|
 
56
  @test_result.each do |test_case|
 
57
    if not test_case.name == except_module:
 
58
      test_case.final_score.to_f.should > percent.to_f/100
 
59
    end
 
60
  end
 
61
end
 
62
##############################################################################
 
63
And /^here is a summary \(Not implemented yet\.\.\)$/ do
 
64
  @test_result.each do |test_case|
 
65
    output= ModuleQualityCheck.get_formatted_results(test_case)
 
66
    # TODO Improve the output to appear into the test result...
 
67
    # Don't find how to do it
 
68
    # print output
 
69
  end
 
70
end
 
71