From 0b2f641ead14f1d2b39b840b21c1575c1dde548b Mon Sep 17 00:00:00 2001 From: Paulo Meirelles Date: Wed, 10 Oct 2012 16:54:40 -0300 Subject: [PATCH] [Mezuro] Moving acceptance tests to plugin root dir --- plugins/mezuro/features/adding_metric_configuration.feature | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/features/adding_ranges.feature | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/features/creating_configuration.feature | 40 ++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/features/creating_project.feature | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/features/echo_port_test.rb | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/features/editing_configuration.feature | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ plugins/mezuro/features/removing_metric_configuration.feature | 32 ++++++++++++++++++++++++++++++++ plugins/mezuro/test/features/adding_metric_configuration.feature | 63 --------------------------------------------------------------- plugins/mezuro/test/features/adding_ranges.feature | 64 ---------------------------------------------------------------- plugins/mezuro/test/features/creating_configuration.feature | 40 ---------------------------------------- plugins/mezuro/test/features/creating_project.feature | 54 ------------------------------------------------------ plugins/mezuro/test/features/echo_port_test.rb | 90 ------------------------------------------------------------------------------------------ plugins/mezuro/test/features/editing_configuration.feature | 49 ------------------------------------------------- plugins/mezuro/test/features/removing_metric_configuration.feature | 32 -------------------------------- 14 files changed, 392 insertions(+), 392 deletions(-) create mode 100644 plugins/mezuro/features/adding_metric_configuration.feature create mode 100644 plugins/mezuro/features/adding_ranges.feature create mode 100644 plugins/mezuro/features/creating_configuration.feature create mode 100644 plugins/mezuro/features/creating_project.feature create mode 100644 plugins/mezuro/features/echo_port_test.rb create mode 100644 plugins/mezuro/features/editing_configuration.feature create mode 100644 plugins/mezuro/features/removing_metric_configuration.feature delete mode 100644 plugins/mezuro/test/features/adding_metric_configuration.feature delete mode 100644 plugins/mezuro/test/features/adding_ranges.feature delete mode 100644 plugins/mezuro/test/features/creating_configuration.feature delete mode 100644 plugins/mezuro/test/features/creating_project.feature delete mode 100644 plugins/mezuro/test/features/echo_port_test.rb delete mode 100644 plugins/mezuro/test/features/editing_configuration.feature delete mode 100644 plugins/mezuro/test/features/removing_metric_configuration.feature diff --git a/plugins/mezuro/features/adding_metric_configuration.feature b/plugins/mezuro/features/adding_metric_configuration.feature new file mode 100644 index 0000000..6995fd1 --- /dev/null +++ b/plugins/mezuro/features/adding_metric_configuration.feature @@ -0,0 +1,63 @@ +Feature: Add metric configuration to a configuration + As a mezuro user + I want to add metric configurations to a Kalibro configuration + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And "Mezuro" plugin is enabled + And I go to the Control panel + And I create a Mezuro configuration with the following data + | Title | My Configuration | + | Description | A sample description | + + Scenario: adding a native metric configuration + When I follow "Add metric" + And I follow "Analizo" + And I follow "Lines of Code" + And I fill in the following: + | Code: | Sample Code | + | Weight: | 10.0 | + And I select "Average" from "Aggregation Form:" + And I press "Add" + Then I should see "Lines of Code" + And I should see "Analizo" + And I should see "Sample Code" + + Scenario: adding a native metric configuration without code + When I follow "Add metric" + And I follow "Analizo" + And I follow "Number of Children" + And I don't fill anything + And I press "Add" + Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration" + + Scenario: adding a compound metric configuration + When I follow "Add Metric" + And I follow "New Compound Metric" + And I fill in the following: + | Name: | Compound sample | + | Description: | 10.0 | + | Script: | return 42; | + | Code: | anyCode | + | Weight: | 10.0 | + And I select "Class" from "Scope:" + And I select "Average" from "Aggregation Form:" + And I press "Add" + Then I should see "Compound sample" + + Scenario: adding a compound metric configuration with invalid script + When I follow "Add metric" + And I follow "New Compound Metric" + And I fill in the following: + | Name: | Compound sample | + | Description: | 10.0 | + | Script: | invalid script | + | Code: | anyCode | + | Weight: | 10.0 | + And I select "Class" from "Scope:" + And I select "Average" from "Aggregation Form:" + And I press "Add" + Then I should see "Metric with invalid code or script: invalid script" diff --git a/plugins/mezuro/features/adding_ranges.feature b/plugins/mezuro/features/adding_ranges.feature new file mode 100644 index 0000000..71e55ca --- /dev/null +++ b/plugins/mezuro/features/adding_ranges.feature @@ -0,0 +1,64 @@ +Feature: Add range to a metric configuration + As a mezuro user + I want to add ranges to a Kalibro metric configuration + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And "Mezuro" plugin is enabled + And I go to the Control Panel + And I create a Mezuro configuration with the following data + | Title | My Configuration | + | Description | A sample description | + And I follow "Add Metric" + And I follow "Analizo" + And I follow "Lines of Code" + And I fill in the following: + | Code: | Sample Code | + | Weight: | 10.0 | + And I select "Average" from "Aggregation Form:" + And I press "Add" + + Scenario: adding a range to a metric configuration + When I follow "New Range" and wait + And I fill in the following: + | (*) Label: | label | + | (*) Beginning: | 1 | + | (*) End: | 10 | + | (*) Grade: | 100 | + | (*) Color: | FF00FF | + | Comments: | Comentário | + And I press "Save Range" and wait + Then I should see "label" within "#ranges" + + Scenario: adding a range with invalid beginning field + When I follow "New Range" and wait + And I fill in the following: + | (*) Label: | label | + | (*) Beginning: | teste | + | (*) End: | 10 | + | (*) Grade: | 100 | + | (*) Color: | FF00FF | + | Comments: | Comentário | + And I press "Save Range" and wait + Then I should see "Beginning, End and Grade must be numeric values." inside an alert + + Scenario: adding a range with beginning greater than end + When I follow "New Range" and wait + And I fill in the following: + | (*) Label: | label | + | (*) Beginning: | 100 | + | (*) End: | 10 | + | (*) Grade: | 100 | + | (*) Color: | FF00FF | + | Comments: | Comentário | + And I press "Save Range" and wait + Then I should see "End must be greater than Beginning." inside an alert + + Scenario: adding a range with no parameters + When I follow "New Range" and wait + And I dont't fill anything + And I press "Save Range" and wait + Then I should see "Please fill all fields marked with (*)." inside an alert diff --git a/plugins/mezuro/features/creating_configuration.feature b/plugins/mezuro/features/creating_configuration.feature new file mode 100644 index 0000000..3909cf9 --- /dev/null +++ b/plugins/mezuro/features/creating_configuration.feature @@ -0,0 +1,40 @@ +Feature: Create configuration + As a mezuro user + I want to create a Mezuro configuration + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And "Mezuro" plugin is enabled + + Scenario: I see Mezuro Configuration on my control panel + When I go to the Control panel + Then I should see "Mezuro configuration" + + Scenario: creating with valid attributes + When I go to the Control panel + And I create a Mezuro configuration with the following data + | Title | Qt_Calculator | + | Description | A sample description | + Then I should see "Name" + And I should see "Qt_Calculator" + And I should see "Description" + And I should see "A sample description" + + Scenario: creating with duplicated name + When I go to the Control panel + And I create a Mezuro configuration with the following data + | Title | Original Title | + And I go to the Control panel + And I create a Mezuro configuration with the following data + | Title | Original Title | + Then I should see "1 error prohibited this article from being saved" + + Scenario: creating without title + When I go to the Control panel + And I create a Mezuro configuration with the following data + | Title | | + Then I should see "1 error prohibited this article from being saved" + diff --git a/plugins/mezuro/features/creating_project.feature b/plugins/mezuro/features/creating_project.feature new file mode 100644 index 0000000..22fe9ff --- /dev/null +++ b/plugins/mezuro/features/creating_project.feature @@ -0,0 +1,54 @@ +Feature: Create project + As a mezuro user + I want to create a Mezuro project + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And "Mezuro" plugin is enabled + And the following community + | identifier | name | + | mycommunity | My Community | + And "Joao Silva" is admin of "My Community" + + Scenario: I see Mezuro project's input form + Given I am on My Community's control panel + When I follow "Mezuro Project" + Then I should see "Title" + And I should see "License" + And I should see "Repository type" + And I should see "GIT" + And I should see "REMOTE_ZIP" + And I should see "REMOTE_TARBALL" + And I should see "SUBVERSION" + And I should see "Repository url" + And I should see "Configuration" + And I should see "Kalibro for Java" + + Scenario: I create a Mezuro project with valid attributes + Given I am on My Community's control panel + When I create a Mezuro project with the following data + | Title | Sample Project | + | License | GPL | + | Repository type | SUBVERSION | + | Repository url | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator | + | Configuration | Kalibro for Java | + Then I should see "Sample Project" + And I should see "GPL" + And I should see "SUBVERSION" + And I should see "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator" + And I should see "Kalibro for Java" + And I directly delete content with name "Sample Project" for testing purposes + + Scenario: I can't create a Mezuro project with invalid attributes + Given I am on My Community's control panel + When I create a Mezuro project with the following data + | Title | | + | License | GPL | + | Repository type | SUBVERSION | + | Repository url | | + | Configuration | Kalibro for Java | + Then I should see "Title can't be blank" + And I should see "Missing repository url" diff --git a/plugins/mezuro/features/echo_port_test.rb b/plugins/mezuro/features/echo_port_test.rb new file mode 100644 index 0000000..af7e73d --- /dev/null +++ b/plugins/mezuro/features/echo_port_test.rb @@ -0,0 +1,90 @@ +require "test_helper" + +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" + +class EchoPortTest < ActiveSupport::TestCase + + def setup + @port = Kalibro::Client::Port.new('Echo') + address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yml") + address['KalibroService'] = 'KalibroFake' + @port.service_address=(address); + end + + should 'echo base tool' do + test BaseToolFixtures.analizo, 'BaseTool' do |base_tool| + base_tool.name = "echo " + base_tool.name + end + end + + should 'echo configuration' do + test ConfigurationFixtures.kalibro_configuration, 'Configuration' do |configuration| + configuration.name = "echo " + configuration.name + end + end + + should 'echo metric configuration' do + test_metric_configuration(MetricConfigurationFixtures.amloc_configuration) + test_metric_configuration(MetricConfigurationFixtures.sc_configuration) + end + + should 'echo module result' do + test ModuleResultFixtures.create, 'ModuleResult' do |module_result| + module_result.module.name = "echo." + module_result.module.name + end + end + + should 'echo project' do + test(ProjectFixtures.qt_calculator, 'Project') do |project| + project.name = "echo " + project.name + end + end + + should 'echo project result' do + test(ProjectResultFixtures.qt_calculator, 'ProjectResult') do |project_result| + project_result.project.name = "echo " + project_result.project.name + end + end + + should 'echo raw project' do + project = ProjectFixtures.qt_calculator + echoed = @port.request(:echo_raw_project, {:project => project.to_hash})[:project] + project.name = "echo " + project.name + project.state = nil + project.error = nil + assert_equal project, Kalibro::Entities::Project.from_hash(echoed) + end + + should 'work with enums' do + test_granularity("METHOD", "CLASS") + test_granularity("CLASS", "PACKAGE") + test_granularity("PACKAGE", "PACKAGE") + test_granularity("APPLICATION", "APPLICATION") + end + + private + + def test_metric_configuration(fixture) + test fixture, 'MetricConfiguration' do |metric_configuration| + metric_configuration.code = "echo_" + metric_configuration.code + end + end + + def test(fixture, entity_name) + entity_symbol = entity_name.underscore.to_sym + request_body = {entity_symbol => fixture.to_hash} + echoed = @port.request("echo_#{entity_symbol}".to_sym, request_body)[entity_symbol] + yield fixture + entity_class = "Kalibro::Entities::#{entity_name}".constantize + assert_equal fixture, entity_class.from_hash(echoed) + end + + def test_granularity(granularity, parent) + body = {:granularity => granularity} + assert_equal parent, @port.request(:infer_parent_granularity, body)[:parent_granularity] + end + +end diff --git a/plugins/mezuro/features/editing_configuration.feature b/plugins/mezuro/features/editing_configuration.feature new file mode 100644 index 0000000..07c79d1 --- /dev/null +++ b/plugins/mezuro/features/editing_configuration.feature @@ -0,0 +1,49 @@ +Feature: editing a configuration + As a mezuro user + I want to edit a Kalibro configuration + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And "Mezuro" plugin is enabled + And the following community + | identifier | name | + | mycommunity | My Community | + And "Joao Silva" is admin of "My Community" + And I am on My Community's cms + And I create a content of type "Kalibro configuration" with the following data + | Title | My Configuration | + | Description | A sample description | + And I follow "Add metric" + And I follow "Analizo" + And I follow "Lines of Code" + And I fill in the following: + | Code: | SampleCode | + | Weight: | 10.0 | + And I select "Average" from "Aggregation Form:" + And I press "Add" + And I press "Save" and wait + + Scenario: Keep metrics after editing configuration + When I follow "Edit" within "article-actions" and wait + And I press "Save" + Then I should see "Lines of Code" + + #FIXME: Create new step for this scenario + Scenario: Check if title is edit-disabled + When I follow "Edit" within "article-actions" and wait + And I fill in the following: + | Title | Some Title | + And I press "Save" and wait + Then I should not see "Some Title" + + + Scenario: Check if description is edit-enabled + When I follow "Edit" within "article-actions" and wait + And I fill in the following: + | Description | Some Description | + And I press "Save" and wait + Then I should see "Some Description" + And I should see "Lines of Code" diff --git a/plugins/mezuro/features/removing_metric_configuration.feature b/plugins/mezuro/features/removing_metric_configuration.feature new file mode 100644 index 0000000..88f635c --- /dev/null +++ b/plugins/mezuro/features/removing_metric_configuration.feature @@ -0,0 +1,32 @@ +Feature: Remove a metric configuration from a configuration + As a mezuro user + I want to remove metric configurations from a configuration + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + And I am logged in as "joaosilva" + And "Mezuro" plugin is enabled + And the following community + | identifier | name | + | mycommunity | My Community | + And "Joao Silva" is admin of "My Community" + And I am on My Community's cms + And I create a content of type "Kalibro configuration" with the following data + | Title | My Configuration | + | Description | A sample description | + When I follow "Add metric" + And I follow "Analizo" + And I follow "Lines of Code" + And I fill in the following: + | Code: | Sample Code | + | Weight: | 10.0 | + And I select "Average" from "Aggregation Form:" + And I press "Add" + And I press "Save" + And I should see "Lines of Code" + + Scenario: I remove a metric configuration + When I follow "Remove" + Then I should not see "Lines of Code" diff --git a/plugins/mezuro/test/features/adding_metric_configuration.feature b/plugins/mezuro/test/features/adding_metric_configuration.feature deleted file mode 100644 index 6995fd1..0000000 --- a/plugins/mezuro/test/features/adding_metric_configuration.feature +++ /dev/null @@ -1,63 +0,0 @@ -Feature: Add metric configuration to a configuration - As a mezuro user - I want to add metric configurations to a Kalibro configuration - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And I go to the Control panel - And I create a Mezuro configuration with the following data - | Title | My Configuration | - | Description | A sample description | - - Scenario: adding a native metric configuration - When I follow "Add metric" - And I follow "Analizo" - And I follow "Lines of Code" - And I fill in the following: - | Code: | Sample Code | - | Weight: | 10.0 | - And I select "Average" from "Aggregation Form:" - And I press "Add" - Then I should see "Lines of Code" - And I should see "Analizo" - And I should see "Sample Code" - - Scenario: adding a native metric configuration without code - When I follow "Add metric" - And I follow "Analizo" - And I follow "Number of Children" - And I don't fill anything - And I press "Add" - Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration" - - Scenario: adding a compound metric configuration - When I follow "Add Metric" - And I follow "New Compound Metric" - And I fill in the following: - | Name: | Compound sample | - | Description: | 10.0 | - | Script: | return 42; | - | Code: | anyCode | - | Weight: | 10.0 | - And I select "Class" from "Scope:" - And I select "Average" from "Aggregation Form:" - And I press "Add" - Then I should see "Compound sample" - - Scenario: adding a compound metric configuration with invalid script - When I follow "Add metric" - And I follow "New Compound Metric" - And I fill in the following: - | Name: | Compound sample | - | Description: | 10.0 | - | Script: | invalid script | - | Code: | anyCode | - | Weight: | 10.0 | - And I select "Class" from "Scope:" - And I select "Average" from "Aggregation Form:" - And I press "Add" - Then I should see "Metric with invalid code or script: invalid script" diff --git a/plugins/mezuro/test/features/adding_ranges.feature b/plugins/mezuro/test/features/adding_ranges.feature deleted file mode 100644 index 71e55ca..0000000 --- a/plugins/mezuro/test/features/adding_ranges.feature +++ /dev/null @@ -1,64 +0,0 @@ -Feature: Add range to a metric configuration - As a mezuro user - I want to add ranges to a Kalibro metric configuration - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And I go to the Control Panel - And I create a Mezuro configuration with the following data - | Title | My Configuration | - | Description | A sample description | - And I follow "Add Metric" - And I follow "Analizo" - And I follow "Lines of Code" - And I fill in the following: - | Code: | Sample Code | - | Weight: | 10.0 | - And I select "Average" from "Aggregation Form:" - And I press "Add" - - Scenario: adding a range to a metric configuration - When I follow "New Range" and wait - And I fill in the following: - | (*) Label: | label | - | (*) Beginning: | 1 | - | (*) End: | 10 | - | (*) Grade: | 100 | - | (*) Color: | FF00FF | - | Comments: | Comentário | - And I press "Save Range" and wait - Then I should see "label" within "#ranges" - - Scenario: adding a range with invalid beginning field - When I follow "New Range" and wait - And I fill in the following: - | (*) Label: | label | - | (*) Beginning: | teste | - | (*) End: | 10 | - | (*) Grade: | 100 | - | (*) Color: | FF00FF | - | Comments: | Comentário | - And I press "Save Range" and wait - Then I should see "Beginning, End and Grade must be numeric values." inside an alert - - Scenario: adding a range with beginning greater than end - When I follow "New Range" and wait - And I fill in the following: - | (*) Label: | label | - | (*) Beginning: | 100 | - | (*) End: | 10 | - | (*) Grade: | 100 | - | (*) Color: | FF00FF | - | Comments: | Comentário | - And I press "Save Range" and wait - Then I should see "End must be greater than Beginning." inside an alert - - Scenario: adding a range with no parameters - When I follow "New Range" and wait - And I dont't fill anything - And I press "Save Range" and wait - Then I should see "Please fill all fields marked with (*)." inside an alert diff --git a/plugins/mezuro/test/features/creating_configuration.feature b/plugins/mezuro/test/features/creating_configuration.feature deleted file mode 100644 index 3909cf9..0000000 --- a/plugins/mezuro/test/features/creating_configuration.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: Create configuration - As a mezuro user - I want to create a Mezuro configuration - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - - Scenario: I see Mezuro Configuration on my control panel - When I go to the Control panel - Then I should see "Mezuro configuration" - - Scenario: creating with valid attributes - When I go to the Control panel - And I create a Mezuro configuration with the following data - | Title | Qt_Calculator | - | Description | A sample description | - Then I should see "Name" - And I should see "Qt_Calculator" - And I should see "Description" - And I should see "A sample description" - - Scenario: creating with duplicated name - When I go to the Control panel - And I create a Mezuro configuration with the following data - | Title | Original Title | - And I go to the Control panel - And I create a Mezuro configuration with the following data - | Title | Original Title | - Then I should see "1 error prohibited this article from being saved" - - Scenario: creating without title - When I go to the Control panel - And I create a Mezuro configuration with the following data - | Title | | - Then I should see "1 error prohibited this article from being saved" - diff --git a/plugins/mezuro/test/features/creating_project.feature b/plugins/mezuro/test/features/creating_project.feature deleted file mode 100644 index 22fe9ff..0000000 --- a/plugins/mezuro/test/features/creating_project.feature +++ /dev/null @@ -1,54 +0,0 @@ -Feature: Create project - As a mezuro user - I want to create a Mezuro project - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - - Scenario: I see Mezuro project's input form - Given I am on My Community's control panel - When I follow "Mezuro Project" - Then I should see "Title" - And I should see "License" - And I should see "Repository type" - And I should see "GIT" - And I should see "REMOTE_ZIP" - And I should see "REMOTE_TARBALL" - And I should see "SUBVERSION" - And I should see "Repository url" - And I should see "Configuration" - And I should see "Kalibro for Java" - - Scenario: I create a Mezuro project with valid attributes - Given I am on My Community's control panel - When I create a Mezuro project with the following data - | Title | Sample Project | - | License | GPL | - | Repository type | SUBVERSION | - | Repository url | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator | - | Configuration | Kalibro for Java | - Then I should see "Sample Project" - And I should see "GPL" - And I should see "SUBVERSION" - And I should see "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator" - And I should see "Kalibro for Java" - And I directly delete content with name "Sample Project" for testing purposes - - Scenario: I can't create a Mezuro project with invalid attributes - Given I am on My Community's control panel - When I create a Mezuro project with the following data - | Title | | - | License | GPL | - | Repository type | SUBVERSION | - | Repository url | | - | Configuration | Kalibro for Java | - Then I should see "Title can't be blank" - And I should see "Missing repository url" diff --git a/plugins/mezuro/test/features/echo_port_test.rb b/plugins/mezuro/test/features/echo_port_test.rb deleted file mode 100644 index af7e73d..0000000 --- a/plugins/mezuro/test/features/echo_port_test.rb +++ /dev/null @@ -1,90 +0,0 @@ -require "test_helper" - -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/configuration_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_result_fixtures" - -class EchoPortTest < ActiveSupport::TestCase - - def setup - @port = Kalibro::Client::Port.new('Echo') - address = YAML.load_file("#{RAILS_ROOT}/plugins/mezuro/service.yml") - address['KalibroService'] = 'KalibroFake' - @port.service_address=(address); - end - - should 'echo base tool' do - test BaseToolFixtures.analizo, 'BaseTool' do |base_tool| - base_tool.name = "echo " + base_tool.name - end - end - - should 'echo configuration' do - test ConfigurationFixtures.kalibro_configuration, 'Configuration' do |configuration| - configuration.name = "echo " + configuration.name - end - end - - should 'echo metric configuration' do - test_metric_configuration(MetricConfigurationFixtures.amloc_configuration) - test_metric_configuration(MetricConfigurationFixtures.sc_configuration) - end - - should 'echo module result' do - test ModuleResultFixtures.create, 'ModuleResult' do |module_result| - module_result.module.name = "echo." + module_result.module.name - end - end - - should 'echo project' do - test(ProjectFixtures.qt_calculator, 'Project') do |project| - project.name = "echo " + project.name - end - end - - should 'echo project result' do - test(ProjectResultFixtures.qt_calculator, 'ProjectResult') do |project_result| - project_result.project.name = "echo " + project_result.project.name - end - end - - should 'echo raw project' do - project = ProjectFixtures.qt_calculator - echoed = @port.request(:echo_raw_project, {:project => project.to_hash})[:project] - project.name = "echo " + project.name - project.state = nil - project.error = nil - assert_equal project, Kalibro::Entities::Project.from_hash(echoed) - end - - should 'work with enums' do - test_granularity("METHOD", "CLASS") - test_granularity("CLASS", "PACKAGE") - test_granularity("PACKAGE", "PACKAGE") - test_granularity("APPLICATION", "APPLICATION") - end - - private - - def test_metric_configuration(fixture) - test fixture, 'MetricConfiguration' do |metric_configuration| - metric_configuration.code = "echo_" + metric_configuration.code - end - end - - def test(fixture, entity_name) - entity_symbol = entity_name.underscore.to_sym - request_body = {entity_symbol => fixture.to_hash} - echoed = @port.request("echo_#{entity_symbol}".to_sym, request_body)[entity_symbol] - yield fixture - entity_class = "Kalibro::Entities::#{entity_name}".constantize - assert_equal fixture, entity_class.from_hash(echoed) - end - - def test_granularity(granularity, parent) - body = {:granularity => granularity} - assert_equal parent, @port.request(:infer_parent_granularity, body)[:parent_granularity] - end - -end diff --git a/plugins/mezuro/test/features/editing_configuration.feature b/plugins/mezuro/test/features/editing_configuration.feature deleted file mode 100644 index 07c79d1..0000000 --- a/plugins/mezuro/test/features/editing_configuration.feature +++ /dev/null @@ -1,49 +0,0 @@ -Feature: editing a configuration - As a mezuro user - I want to edit a Kalibro configuration - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - And I am on My Community's cms - And I create a content of type "Kalibro configuration" with the following data - | Title | My Configuration | - | Description | A sample description | - And I follow "Add metric" - And I follow "Analizo" - And I follow "Lines of Code" - And I fill in the following: - | Code: | SampleCode | - | Weight: | 10.0 | - And I select "Average" from "Aggregation Form:" - And I press "Add" - And I press "Save" and wait - - Scenario: Keep metrics after editing configuration - When I follow "Edit" within "article-actions" and wait - And I press "Save" - Then I should see "Lines of Code" - - #FIXME: Create new step for this scenario - Scenario: Check if title is edit-disabled - When I follow "Edit" within "article-actions" and wait - And I fill in the following: - | Title | Some Title | - And I press "Save" and wait - Then I should not see "Some Title" - - - Scenario: Check if description is edit-enabled - When I follow "Edit" within "article-actions" and wait - And I fill in the following: - | Description | Some Description | - And I press "Save" and wait - Then I should see "Some Description" - And I should see "Lines of Code" diff --git a/plugins/mezuro/test/features/removing_metric_configuration.feature b/plugins/mezuro/test/features/removing_metric_configuration.feature deleted file mode 100644 index 88f635c..0000000 --- a/plugins/mezuro/test/features/removing_metric_configuration.feature +++ /dev/null @@ -1,32 +0,0 @@ -Feature: Remove a metric configuration from a configuration - As a mezuro user - I want to remove metric configurations from a configuration - - Background: - Given the following users - | login | name | - | joaosilva | Joao Silva | - And I am logged in as "joaosilva" - And "Mezuro" plugin is enabled - And the following community - | identifier | name | - | mycommunity | My Community | - And "Joao Silva" is admin of "My Community" - And I am on My Community's cms - And I create a content of type "Kalibro configuration" with the following data - | Title | My Configuration | - | Description | A sample description | - When I follow "Add metric" - And I follow "Analizo" - And I follow "Lines of Code" - And I fill in the following: - | Code: | Sample Code | - | Weight: | 10.0 | - And I select "Average" from "Aggregation Form:" - And I press "Add" - And I press "Save" - And I should see "Lines of Code" - - Scenario: I remove a metric configuration - When I follow "Remove" - Then I should not see "Lines of Code" -- libgit2 0.21.2