Commit 1aff374cd5ddbc052f5d44604aad4324dbecfe41
Committed by
Paulo Meireles
1 parent
0b2f641e
Exists in
master
and in
28 other branches
[Mezuro] Trying to fix acceptance tests.
Showing
4 changed files
with
5 additions
and
95 deletions
Show diff stats
plugins/mezuro/features/adding_metric_configuration.feature
| @@ -8,13 +8,13 @@ Feature: Add metric configuration to a configuration | @@ -8,13 +8,13 @@ Feature: Add metric configuration to a configuration | ||
| 8 | | joaosilva | Joao Silva | | 8 | | joaosilva | Joao Silva | |
| 9 | And I am logged in as "joaosilva" | 9 | And I am logged in as "joaosilva" |
| 10 | And "Mezuro" plugin is enabled | 10 | And "Mezuro" plugin is enabled |
| 11 | - And I go to the Control panel | 11 | + And I go to the Control panel |
| 12 | And I create a Mezuro configuration with the following data | 12 | And I create a Mezuro configuration with the following data |
| 13 | | Title | My Configuration | | 13 | | Title | My Configuration | |
| 14 | | Description | A sample description | | 14 | | Description | A sample description | |
| 15 | 15 | ||
| 16 | Scenario: adding a native metric configuration | 16 | Scenario: adding a native metric configuration |
| 17 | - When I follow "Add metric" | 17 | + When I follow "Add Metric" |
| 18 | And I follow "Analizo" | 18 | And I follow "Analizo" |
| 19 | And I follow "Lines of Code" | 19 | And I follow "Lines of Code" |
| 20 | And I fill in the following: | 20 | And I fill in the following: |
plugins/mezuro/features/echo_port_test.rb
| @@ -1,90 +0,0 @@ | @@ -1,90 +0,0 @@ | ||
| 1 | -require "test_helper" | ||
| 2 | - | ||
| 3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
| 4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" | ||
| 5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | ||
| 6 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" | ||
| 7 | - | ||
| 8 | -class EchoPortTest < ActiveSupport::TestCase | ||
| 9 | - | ||
| 10 | - def setup | ||
| 11 | - @port = Kalibro::Client::Port.new('Echo') | ||
| 12 | - address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yml") | ||
| 13 | - address['KalibroService'] = 'KalibroFake' | ||
| 14 | - @port.service_address=(address); | ||
| 15 | - end | ||
| 16 | - | ||
| 17 | - should 'echo base tool' do | ||
| 18 | - test BaseToolFixtures.analizo, 'BaseTool' do |base_tool| | ||
| 19 | - base_tool.name = "echo " + base_tool.name | ||
| 20 | - end | ||
| 21 | - end | ||
| 22 | - | ||
| 23 | - should 'echo configuration' do | ||
| 24 | - test ConfigurationFixtures.kalibro_configuration, 'Configuration' do |configuration| | ||
| 25 | - configuration.name = "echo " + configuration.name | ||
| 26 | - end | ||
| 27 | - end | ||
| 28 | - | ||
| 29 | - should 'echo metric configuration' do | ||
| 30 | - test_metric_configuration(MetricConfigurationFixtures.amloc_configuration) | ||
| 31 | - test_metric_configuration(MetricConfigurationFixtures.sc_configuration) | ||
| 32 | - end | ||
| 33 | - | ||
| 34 | - should 'echo module result' do | ||
| 35 | - test ModuleResultFixtures.create, 'ModuleResult' do |module_result| | ||
| 36 | - module_result.module.name = "echo." + module_result.module.name | ||
| 37 | - end | ||
| 38 | - end | ||
| 39 | - | ||
| 40 | - should 'echo project' do | ||
| 41 | - test(ProjectFixtures.qt_calculator, 'Project') do |project| | ||
| 42 | - project.name = "echo " + project.name | ||
| 43 | - end | ||
| 44 | - end | ||
| 45 | - | ||
| 46 | - should 'echo project result' do | ||
| 47 | - test(ProjectResultFixtures.qt_calculator, 'ProjectResult') do |project_result| | ||
| 48 | - project_result.project.name = "echo " + project_result.project.name | ||
| 49 | - end | ||
| 50 | - end | ||
| 51 | - | ||
| 52 | - should 'echo raw project' do | ||
| 53 | - project = ProjectFixtures.qt_calculator | ||
| 54 | - echoed = @port.request(:echo_raw_project, {:project => project.to_hash})[:project] | ||
| 55 | - project.name = "echo " + project.name | ||
| 56 | - project.state = nil | ||
| 57 | - project.error = nil | ||
| 58 | - assert_equal project, Kalibro::Entities::Project.from_hash(echoed) | ||
| 59 | - end | ||
| 60 | - | ||
| 61 | - should 'work with enums' do | ||
| 62 | - test_granularity("METHOD", "CLASS") | ||
| 63 | - test_granularity("CLASS", "PACKAGE") | ||
| 64 | - test_granularity("PACKAGE", "PACKAGE") | ||
| 65 | - test_granularity("APPLICATION", "APPLICATION") | ||
| 66 | - end | ||
| 67 | - | ||
| 68 | - private | ||
| 69 | - | ||
| 70 | - def test_metric_configuration(fixture) | ||
| 71 | - test fixture, 'MetricConfiguration' do |metric_configuration| | ||
| 72 | - metric_configuration.code = "echo_" + metric_configuration.code | ||
| 73 | - end | ||
| 74 | - end | ||
| 75 | - | ||
| 76 | - def test(fixture, entity_name) | ||
| 77 | - entity_symbol = entity_name.underscore.to_sym | ||
| 78 | - request_body = {entity_symbol => fixture.to_hash} | ||
| 79 | - echoed = @port.request("echo_#{entity_symbol}".to_sym, request_body)[entity_symbol] | ||
| 80 | - yield fixture | ||
| 81 | - entity_class = "Kalibro::Entities::#{entity_name}".constantize | ||
| 82 | - assert_equal fixture, entity_class.from_hash(echoed) | ||
| 83 | - end | ||
| 84 | - | ||
| 85 | - def test_granularity(granularity, parent) | ||
| 86 | - body = {:granularity => granularity} | ||
| 87 | - assert_equal parent, @port.request(:infer_parent_granularity, body)[:parent_granularity] | ||
| 88 | - end | ||
| 89 | - | ||
| 90 | -end |
plugins/mezuro/features/editing_configuration.feature
| 1 | Feature: editing a configuration | 1 | Feature: editing a configuration |
| 2 | As a mezuro user | 2 | As a mezuro user |
| 3 | - I want to edit a Kalibro configuration | 3 | + I want to edit a Mezuro configuration |
| 4 | 4 | ||
| 5 | Background: | 5 | Background: |
| 6 | Given the following users | 6 | Given the following users |
| @@ -13,7 +13,7 @@ Feature: editing a configuration | @@ -13,7 +13,7 @@ Feature: editing a configuration | ||
| 13 | | mycommunity | My Community | | 13 | | mycommunity | My Community | |
| 14 | And "Joao Silva" is admin of "My Community" | 14 | And "Joao Silva" is admin of "My Community" |
| 15 | And I am on My Community's cms | 15 | And I am on My Community's cms |
| 16 | - And I create a content of type "Kalibro configuration" with the following data | 16 | + And I create a content of type "Mezuro configuration" with the following data |
| 17 | | Title | My Configuration | | 17 | | Title | My Configuration | |
| 18 | | Description | A sample description | | 18 | | Description | A sample description | |
| 19 | And I follow "Add metric" | 19 | And I follow "Add metric" |
plugins/mezuro/features/removing_metric_configuration.feature
| @@ -13,7 +13,7 @@ Feature: Remove a metric configuration from a configuration | @@ -13,7 +13,7 @@ Feature: Remove a metric configuration from a configuration | ||
| 13 | | mycommunity | My Community | | 13 | | mycommunity | My Community | |
| 14 | And "Joao Silva" is admin of "My Community" | 14 | And "Joao Silva" is admin of "My Community" |
| 15 | And I am on My Community's cms | 15 | And I am on My Community's cms |
| 16 | - And I create a content of type "Kalibro configuration" with the following data | 16 | + And I create a content of type "Mezuro configuration" with the following data |
| 17 | | Title | My Configuration | | 17 | | Title | My Configuration | |
| 18 | | Description | A sample description | | 18 | | Description | A sample description | |
| 19 | When I follow "Add metric" | 19 | When I follow "Add metric" |