Commit 0b2f641ead14f1d2b39b840b21c1575c1dde548b
1 parent
37d94bf1
Exists in
master
and in
29 other branches
[Mezuro] Moving acceptance tests to plugin root dir
Showing
14 changed files
with
392 additions
and
392 deletions
Show diff stats
plugins/mezuro/features/adding_metric_configuration.feature
0 → 100644
... | ... | @@ -0,0 +1,63 @@ |
1 | +Feature: Add metric configuration to a configuration | |
2 | + As a mezuro user | |
3 | + I want to add metric configurations to a Kalibro configuration | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And "Mezuro" plugin is enabled | |
11 | + And I go to the Control panel | |
12 | + And I create a Mezuro configuration with the following data | |
13 | + | Title | My Configuration | | |
14 | + | Description | A sample description | | |
15 | + | |
16 | + Scenario: adding a native metric configuration | |
17 | + When I follow "Add metric" | |
18 | + And I follow "Analizo" | |
19 | + And I follow "Lines of Code" | |
20 | + And I fill in the following: | |
21 | + | Code: | Sample Code | | |
22 | + | Weight: | 10.0 | | |
23 | + And I select "Average" from "Aggregation Form:" | |
24 | + And I press "Add" | |
25 | + Then I should see "Lines of Code" | |
26 | + And I should see "Analizo" | |
27 | + And I should see "Sample Code" | |
28 | + | |
29 | + Scenario: adding a native metric configuration without code | |
30 | + When I follow "Add metric" | |
31 | + And I follow "Analizo" | |
32 | + And I follow "Number of Children" | |
33 | + And I don't fill anything | |
34 | + And I press "Add" | |
35 | + Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration" | |
36 | + | |
37 | + Scenario: adding a compound metric configuration | |
38 | + When I follow "Add Metric" | |
39 | + And I follow "New Compound Metric" | |
40 | + And I fill in the following: | |
41 | + | Name: | Compound sample | | |
42 | + | Description: | 10.0 | | |
43 | + | Script: | return 42; | | |
44 | + | Code: | anyCode | | |
45 | + | Weight: | 10.0 | | |
46 | + And I select "Class" from "Scope:" | |
47 | + And I select "Average" from "Aggregation Form:" | |
48 | + And I press "Add" | |
49 | + Then I should see "Compound sample" | |
50 | + | |
51 | + Scenario: adding a compound metric configuration with invalid script | |
52 | + When I follow "Add metric" | |
53 | + And I follow "New Compound Metric" | |
54 | + And I fill in the following: | |
55 | + | Name: | Compound sample | | |
56 | + | Description: | 10.0 | | |
57 | + | Script: | invalid script | | |
58 | + | Code: | anyCode | | |
59 | + | Weight: | 10.0 | | |
60 | + And I select "Class" from "Scope:" | |
61 | + And I select "Average" from "Aggregation Form:" | |
62 | + And I press "Add" | |
63 | + Then I should see "Metric with invalid code or script: invalid script" | ... | ... |
... | ... | @@ -0,0 +1,64 @@ |
1 | +Feature: Add range to a metric configuration | |
2 | + As a mezuro user | |
3 | + I want to add ranges to a Kalibro metric configuration | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And "Mezuro" plugin is enabled | |
11 | + And I go to the Control Panel | |
12 | + And I create a Mezuro configuration with the following data | |
13 | + | Title | My Configuration | | |
14 | + | Description | A sample description | | |
15 | + And I follow "Add Metric" | |
16 | + And I follow "Analizo" | |
17 | + And I follow "Lines of Code" | |
18 | + And I fill in the following: | |
19 | + | Code: | Sample Code | | |
20 | + | Weight: | 10.0 | | |
21 | + And I select "Average" from "Aggregation Form:" | |
22 | + And I press "Add" | |
23 | + | |
24 | + Scenario: adding a range to a metric configuration | |
25 | + When I follow "New Range" and wait | |
26 | + And I fill in the following: | |
27 | + | (*) Label: | label | | |
28 | + | (*) Beginning: | 1 | | |
29 | + | (*) End: | 10 | | |
30 | + | (*) Grade: | 100 | | |
31 | + | (*) Color: | FF00FF | | |
32 | + | Comments: | Comentário | | |
33 | + And I press "Save Range" and wait | |
34 | + Then I should see "label" within "#ranges" | |
35 | + | |
36 | + Scenario: adding a range with invalid beginning field | |
37 | + When I follow "New Range" and wait | |
38 | + And I fill in the following: | |
39 | + | (*) Label: | label | | |
40 | + | (*) Beginning: | teste | | |
41 | + | (*) End: | 10 | | |
42 | + | (*) Grade: | 100 | | |
43 | + | (*) Color: | FF00FF | | |
44 | + | Comments: | Comentário | | |
45 | + And I press "Save Range" and wait | |
46 | + Then I should see "Beginning, End and Grade must be numeric values." inside an alert | |
47 | + | |
48 | + Scenario: adding a range with beginning greater than end | |
49 | + When I follow "New Range" and wait | |
50 | + And I fill in the following: | |
51 | + | (*) Label: | label | | |
52 | + | (*) Beginning: | 100 | | |
53 | + | (*) End: | 10 | | |
54 | + | (*) Grade: | 100 | | |
55 | + | (*) Color: | FF00FF | | |
56 | + | Comments: | Comentário | | |
57 | + And I press "Save Range" and wait | |
58 | + Then I should see "End must be greater than Beginning." inside an alert | |
59 | + | |
60 | + Scenario: adding a range with no parameters | |
61 | + When I follow "New Range" and wait | |
62 | + And I dont't fill anything | |
63 | + And I press "Save Range" and wait | |
64 | + Then I should see "Please fill all fields marked with (*)." inside an alert | ... | ... |
... | ... | @@ -0,0 +1,40 @@ |
1 | +Feature: Create configuration | |
2 | + As a mezuro user | |
3 | + I want to create a Mezuro configuration | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And "Mezuro" plugin is enabled | |
11 | + | |
12 | + Scenario: I see Mezuro Configuration on my control panel | |
13 | + When I go to the Control panel | |
14 | + Then I should see "Mezuro configuration" | |
15 | + | |
16 | + Scenario: creating with valid attributes | |
17 | + When I go to the Control panel | |
18 | + And I create a Mezuro configuration with the following data | |
19 | + | Title | Qt_Calculator | | |
20 | + | Description | A sample description | | |
21 | + Then I should see "Name" | |
22 | + And I should see "Qt_Calculator" | |
23 | + And I should see "Description" | |
24 | + And I should see "A sample description" | |
25 | + | |
26 | + Scenario: creating with duplicated name | |
27 | + When I go to the Control panel | |
28 | + And I create a Mezuro configuration with the following data | |
29 | + | Title | Original Title | | |
30 | + And I go to the Control panel | |
31 | + And I create a Mezuro configuration with the following data | |
32 | + | Title | Original Title | | |
33 | + Then I should see "1 error prohibited this article from being saved" | |
34 | + | |
35 | + Scenario: creating without title | |
36 | + When I go to the Control panel | |
37 | + And I create a Mezuro configuration with the following data | |
38 | + | Title | | | |
39 | + Then I should see "1 error prohibited this article from being saved" | |
40 | + | ... | ... |
... | ... | @@ -0,0 +1,54 @@ |
1 | +Feature: Create project | |
2 | + As a mezuro user | |
3 | + I want to create a Mezuro project | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And "Mezuro" plugin is enabled | |
11 | + And the following community | |
12 | + | identifier | name | | |
13 | + | mycommunity | My Community | | |
14 | + And "Joao Silva" is admin of "My Community" | |
15 | + | |
16 | + Scenario: I see Mezuro project's input form | |
17 | + Given I am on My Community's control panel | |
18 | + When I follow "Mezuro Project" | |
19 | + Then I should see "Title" | |
20 | + And I should see "License" | |
21 | + And I should see "Repository type" | |
22 | + And I should see "GIT" | |
23 | + And I should see "REMOTE_ZIP" | |
24 | + And I should see "REMOTE_TARBALL" | |
25 | + And I should see "SUBVERSION" | |
26 | + And I should see "Repository url" | |
27 | + And I should see "Configuration" | |
28 | + And I should see "Kalibro for Java" | |
29 | + | |
30 | + Scenario: I create a Mezuro project with valid attributes | |
31 | + Given I am on My Community's control panel | |
32 | + When I create a Mezuro project with the following data | |
33 | + | Title | Sample Project | | |
34 | + | License | GPL | | |
35 | + | Repository type | SUBVERSION | | |
36 | + | Repository url | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator | | |
37 | + | Configuration | Kalibro for Java | | |
38 | + Then I should see "Sample Project" | |
39 | + And I should see "GPL" | |
40 | + And I should see "SUBVERSION" | |
41 | + And I should see "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator" | |
42 | + And I should see "Kalibro for Java" | |
43 | + And I directly delete content with name "Sample Project" for testing purposes | |
44 | + | |
45 | + Scenario: I can't create a Mezuro project with invalid attributes | |
46 | + Given I am on My Community's control panel | |
47 | + When I create a Mezuro project with the following data | |
48 | + | Title | | | |
49 | + | License | GPL | | |
50 | + | Repository type | SUBVERSION | | |
51 | + | Repository url | | | |
52 | + | Configuration | Kalibro for Java | | |
53 | + Then I should see "Title can't be blank" | |
54 | + And I should see "Missing repository url" | ... | ... |
... | ... | @@ -0,0 +1,90 @@ |
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 | ... | ... |
... | ... | @@ -0,0 +1,49 @@ |
1 | +Feature: editing a configuration | |
2 | + As a mezuro user | |
3 | + I want to edit a Kalibro configuration | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And "Mezuro" plugin is enabled | |
11 | + And the following community | |
12 | + | identifier | name | | |
13 | + | mycommunity | My Community | | |
14 | + And "Joao Silva" is admin of "My Community" | |
15 | + And I am on My Community's cms | |
16 | + And I create a content of type "Kalibro configuration" with the following data | |
17 | + | Title | My Configuration | | |
18 | + | Description | A sample description | | |
19 | + And I follow "Add metric" | |
20 | + And I follow "Analizo" | |
21 | + And I follow "Lines of Code" | |
22 | + And I fill in the following: | |
23 | + | Code: | SampleCode | | |
24 | + | Weight: | 10.0 | | |
25 | + And I select "Average" from "Aggregation Form:" | |
26 | + And I press "Add" | |
27 | + And I press "Save" and wait | |
28 | + | |
29 | + Scenario: Keep metrics after editing configuration | |
30 | + When I follow "Edit" within "article-actions" and wait | |
31 | + And I press "Save" | |
32 | + Then I should see "Lines of Code" | |
33 | + | |
34 | + #FIXME: Create new step for this scenario | |
35 | + Scenario: Check if title is edit-disabled | |
36 | + When I follow "Edit" within "article-actions" and wait | |
37 | + And I fill in the following: | |
38 | + | Title | Some Title | | |
39 | + And I press "Save" and wait | |
40 | + Then I should not see "Some Title" | |
41 | + | |
42 | + | |
43 | + Scenario: Check if description is edit-enabled | |
44 | + When I follow "Edit" within "article-actions" and wait | |
45 | + And I fill in the following: | |
46 | + | Description | Some Description | | |
47 | + And I press "Save" and wait | |
48 | + Then I should see "Some Description" | |
49 | + And I should see "Lines of Code" | ... | ... |
plugins/mezuro/features/removing_metric_configuration.feature
0 → 100644
... | ... | @@ -0,0 +1,32 @@ |
1 | +Feature: Remove a metric configuration from a configuration | |
2 | + As a mezuro user | |
3 | + I want to remove metric configurations from a configuration | |
4 | + | |
5 | + Background: | |
6 | + Given the following users | |
7 | + | login | name | | |
8 | + | joaosilva | Joao Silva | | |
9 | + And I am logged in as "joaosilva" | |
10 | + And "Mezuro" plugin is enabled | |
11 | + And the following community | |
12 | + | identifier | name | | |
13 | + | mycommunity | My Community | | |
14 | + And "Joao Silva" is admin of "My Community" | |
15 | + And I am on My Community's cms | |
16 | + And I create a content of type "Kalibro configuration" with the following data | |
17 | + | Title | My Configuration | | |
18 | + | Description | A sample description | | |
19 | + When I follow "Add metric" | |
20 | + And I follow "Analizo" | |
21 | + And I follow "Lines of Code" | |
22 | + And I fill in the following: | |
23 | + | Code: | Sample Code | | |
24 | + | Weight: | 10.0 | | |
25 | + And I select "Average" from "Aggregation Form:" | |
26 | + And I press "Add" | |
27 | + And I press "Save" | |
28 | + And I should see "Lines of Code" | |
29 | + | |
30 | + Scenario: I remove a metric configuration | |
31 | + When I follow "Remove" | |
32 | + Then I should not see "Lines of Code" | ... | ... |
plugins/mezuro/test/features/adding_metric_configuration.feature
... | ... | @@ -1,63 +0,0 @@ |
1 | -Feature: Add metric configuration to a configuration | |
2 | - As a mezuro user | |
3 | - I want to add metric configurations to a Kalibro configuration | |
4 | - | |
5 | - Background: | |
6 | - Given the following users | |
7 | - | login | name | | |
8 | - | joaosilva | Joao Silva | | |
9 | - And I am logged in as "joaosilva" | |
10 | - And "Mezuro" plugin is enabled | |
11 | - And I go to the Control panel | |
12 | - And I create a Mezuro configuration with the following data | |
13 | - | Title | My Configuration | | |
14 | - | Description | A sample description | | |
15 | - | |
16 | - Scenario: adding a native metric configuration | |
17 | - When I follow "Add metric" | |
18 | - And I follow "Analizo" | |
19 | - And I follow "Lines of Code" | |
20 | - And I fill in the following: | |
21 | - | Code: | Sample Code | | |
22 | - | Weight: | 10.0 | | |
23 | - And I select "Average" from "Aggregation Form:" | |
24 | - And I press "Add" | |
25 | - Then I should see "Lines of Code" | |
26 | - And I should see "Analizo" | |
27 | - And I should see "Sample Code" | |
28 | - | |
29 | - Scenario: adding a native metric configuration without code | |
30 | - When I follow "Add metric" | |
31 | - And I follow "Analizo" | |
32 | - And I follow "Number of Children" | |
33 | - And I don't fill anything | |
34 | - And I press "Add" | |
35 | - Then I should be at the url "/myprofile/my-community/plugin/mezuro/new_metric_configuration" | |
36 | - | |
37 | - Scenario: adding a compound metric configuration | |
38 | - When I follow "Add Metric" | |
39 | - And I follow "New Compound Metric" | |
40 | - And I fill in the following: | |
41 | - | Name: | Compound sample | | |
42 | - | Description: | 10.0 | | |
43 | - | Script: | return 42; | | |
44 | - | Code: | anyCode | | |
45 | - | Weight: | 10.0 | | |
46 | - And I select "Class" from "Scope:" | |
47 | - And I select "Average" from "Aggregation Form:" | |
48 | - And I press "Add" | |
49 | - Then I should see "Compound sample" | |
50 | - | |
51 | - Scenario: adding a compound metric configuration with invalid script | |
52 | - When I follow "Add metric" | |
53 | - And I follow "New Compound Metric" | |
54 | - And I fill in the following: | |
55 | - | Name: | Compound sample | | |
56 | - | Description: | 10.0 | | |
57 | - | Script: | invalid script | | |
58 | - | Code: | anyCode | | |
59 | - | Weight: | 10.0 | | |
60 | - And I select "Class" from "Scope:" | |
61 | - And I select "Average" from "Aggregation Form:" | |
62 | - And I press "Add" | |
63 | - Then I should see "Metric with invalid code or script: invalid script" |
plugins/mezuro/test/features/adding_ranges.feature
... | ... | @@ -1,64 +0,0 @@ |
1 | -Feature: Add range to a metric configuration | |
2 | - As a mezuro user | |
3 | - I want to add ranges to a Kalibro metric configuration | |
4 | - | |
5 | - Background: | |
6 | - Given the following users | |
7 | - | login | name | | |
8 | - | joaosilva | Joao Silva | | |
9 | - And I am logged in as "joaosilva" | |
10 | - And "Mezuro" plugin is enabled | |
11 | - And I go to the Control Panel | |
12 | - And I create a Mezuro configuration with the following data | |
13 | - | Title | My Configuration | | |
14 | - | Description | A sample description | | |
15 | - And I follow "Add Metric" | |
16 | - And I follow "Analizo" | |
17 | - And I follow "Lines of Code" | |
18 | - And I fill in the following: | |
19 | - | Code: | Sample Code | | |
20 | - | Weight: | 10.0 | | |
21 | - And I select "Average" from "Aggregation Form:" | |
22 | - And I press "Add" | |
23 | - | |
24 | - Scenario: adding a range to a metric configuration | |
25 | - When I follow "New Range" and wait | |
26 | - And I fill in the following: | |
27 | - | (*) Label: | label | | |
28 | - | (*) Beginning: | 1 | | |
29 | - | (*) End: | 10 | | |
30 | - | (*) Grade: | 100 | | |
31 | - | (*) Color: | FF00FF | | |
32 | - | Comments: | Comentário | | |
33 | - And I press "Save Range" and wait | |
34 | - Then I should see "label" within "#ranges" | |
35 | - | |
36 | - Scenario: adding a range with invalid beginning field | |
37 | - When I follow "New Range" and wait | |
38 | - And I fill in the following: | |
39 | - | (*) Label: | label | | |
40 | - | (*) Beginning: | teste | | |
41 | - | (*) End: | 10 | | |
42 | - | (*) Grade: | 100 | | |
43 | - | (*) Color: | FF00FF | | |
44 | - | Comments: | Comentário | | |
45 | - And I press "Save Range" and wait | |
46 | - Then I should see "Beginning, End and Grade must be numeric values." inside an alert | |
47 | - | |
48 | - Scenario: adding a range with beginning greater than end | |
49 | - When I follow "New Range" and wait | |
50 | - And I fill in the following: | |
51 | - | (*) Label: | label | | |
52 | - | (*) Beginning: | 100 | | |
53 | - | (*) End: | 10 | | |
54 | - | (*) Grade: | 100 | | |
55 | - | (*) Color: | FF00FF | | |
56 | - | Comments: | Comentário | | |
57 | - And I press "Save Range" and wait | |
58 | - Then I should see "End must be greater than Beginning." inside an alert | |
59 | - | |
60 | - Scenario: adding a range with no parameters | |
61 | - When I follow "New Range" and wait | |
62 | - And I dont't fill anything | |
63 | - And I press "Save Range" and wait | |
64 | - Then I should see "Please fill all fields marked with (*)." inside an alert |
plugins/mezuro/test/features/creating_configuration.feature
... | ... | @@ -1,40 +0,0 @@ |
1 | -Feature: Create configuration | |
2 | - As a mezuro user | |
3 | - I want to create a Mezuro configuration | |
4 | - | |
5 | - Background: | |
6 | - Given the following users | |
7 | - | login | name | | |
8 | - | joaosilva | Joao Silva | | |
9 | - And I am logged in as "joaosilva" | |
10 | - And "Mezuro" plugin is enabled | |
11 | - | |
12 | - Scenario: I see Mezuro Configuration on my control panel | |
13 | - When I go to the Control panel | |
14 | - Then I should see "Mezuro configuration" | |
15 | - | |
16 | - Scenario: creating with valid attributes | |
17 | - When I go to the Control panel | |
18 | - And I create a Mezuro configuration with the following data | |
19 | - | Title | Qt_Calculator | | |
20 | - | Description | A sample description | | |
21 | - Then I should see "Name" | |
22 | - And I should see "Qt_Calculator" | |
23 | - And I should see "Description" | |
24 | - And I should see "A sample description" | |
25 | - | |
26 | - Scenario: creating with duplicated name | |
27 | - When I go to the Control panel | |
28 | - And I create a Mezuro configuration with the following data | |
29 | - | Title | Original Title | | |
30 | - And I go to the Control panel | |
31 | - And I create a Mezuro configuration with the following data | |
32 | - | Title | Original Title | | |
33 | - Then I should see "1 error prohibited this article from being saved" | |
34 | - | |
35 | - Scenario: creating without title | |
36 | - When I go to the Control panel | |
37 | - And I create a Mezuro configuration with the following data | |
38 | - | Title | | | |
39 | - Then I should see "1 error prohibited this article from being saved" | |
40 | - |
plugins/mezuro/test/features/creating_project.feature
... | ... | @@ -1,54 +0,0 @@ |
1 | -Feature: Create project | |
2 | - As a mezuro user | |
3 | - I want to create a Mezuro project | |
4 | - | |
5 | - Background: | |
6 | - Given the following users | |
7 | - | login | name | | |
8 | - | joaosilva | Joao Silva | | |
9 | - And I am logged in as "joaosilva" | |
10 | - And "Mezuro" plugin is enabled | |
11 | - And the following community | |
12 | - | identifier | name | | |
13 | - | mycommunity | My Community | | |
14 | - And "Joao Silva" is admin of "My Community" | |
15 | - | |
16 | - Scenario: I see Mezuro project's input form | |
17 | - Given I am on My Community's control panel | |
18 | - When I follow "Mezuro Project" | |
19 | - Then I should see "Title" | |
20 | - And I should see "License" | |
21 | - And I should see "Repository type" | |
22 | - And I should see "GIT" | |
23 | - And I should see "REMOTE_ZIP" | |
24 | - And I should see "REMOTE_TARBALL" | |
25 | - And I should see "SUBVERSION" | |
26 | - And I should see "Repository url" | |
27 | - And I should see "Configuration" | |
28 | - And I should see "Kalibro for Java" | |
29 | - | |
30 | - Scenario: I create a Mezuro project with valid attributes | |
31 | - Given I am on My Community's control panel | |
32 | - When I create a Mezuro project with the following data | |
33 | - | Title | Sample Project | | |
34 | - | License | GPL | | |
35 | - | Repository type | SUBVERSION | | |
36 | - | Repository url | https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator | | |
37 | - | Configuration | Kalibro for Java | | |
38 | - Then I should see "Sample Project" | |
39 | - And I should see "GPL" | |
40 | - And I should see "SUBVERSION" | |
41 | - And I should see "https://qt-calculator.svn.sourceforge.net/svnroot/qt-calculator" | |
42 | - And I should see "Kalibro for Java" | |
43 | - And I directly delete content with name "Sample Project" for testing purposes | |
44 | - | |
45 | - Scenario: I can't create a Mezuro project with invalid attributes | |
46 | - Given I am on My Community's control panel | |
47 | - When I create a Mezuro project with the following data | |
48 | - | Title | | | |
49 | - | License | GPL | | |
50 | - | Repository type | SUBVERSION | | |
51 | - | Repository url | | | |
52 | - | Configuration | Kalibro for Java | | |
53 | - Then I should see "Title can't be blank" | |
54 | - And I should see "Missing repository url" |
plugins/mezuro/test/features/echo_port_test.rb
... | ... | @@ -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/test/features/editing_configuration.feature
... | ... | @@ -1,49 +0,0 @@ |
1 | -Feature: editing a configuration | |
2 | - As a mezuro user | |
3 | - I want to edit a Kalibro configuration | |
4 | - | |
5 | - Background: | |
6 | - Given the following users | |
7 | - | login | name | | |
8 | - | joaosilva | Joao Silva | | |
9 | - And I am logged in as "joaosilva" | |
10 | - And "Mezuro" plugin is enabled | |
11 | - And the following community | |
12 | - | identifier | name | | |
13 | - | mycommunity | My Community | | |
14 | - And "Joao Silva" is admin of "My Community" | |
15 | - And I am on My Community's cms | |
16 | - And I create a content of type "Kalibro configuration" with the following data | |
17 | - | Title | My Configuration | | |
18 | - | Description | A sample description | | |
19 | - And I follow "Add metric" | |
20 | - And I follow "Analizo" | |
21 | - And I follow "Lines of Code" | |
22 | - And I fill in the following: | |
23 | - | Code: | SampleCode | | |
24 | - | Weight: | 10.0 | | |
25 | - And I select "Average" from "Aggregation Form:" | |
26 | - And I press "Add" | |
27 | - And I press "Save" and wait | |
28 | - | |
29 | - Scenario: Keep metrics after editing configuration | |
30 | - When I follow "Edit" within "article-actions" and wait | |
31 | - And I press "Save" | |
32 | - Then I should see "Lines of Code" | |
33 | - | |
34 | - #FIXME: Create new step for this scenario | |
35 | - Scenario: Check if title is edit-disabled | |
36 | - When I follow "Edit" within "article-actions" and wait | |
37 | - And I fill in the following: | |
38 | - | Title | Some Title | | |
39 | - And I press "Save" and wait | |
40 | - Then I should not see "Some Title" | |
41 | - | |
42 | - | |
43 | - Scenario: Check if description is edit-enabled | |
44 | - When I follow "Edit" within "article-actions" and wait | |
45 | - And I fill in the following: | |
46 | - | Description | Some Description | | |
47 | - And I press "Save" and wait | |
48 | - Then I should see "Some Description" | |
49 | - And I should see "Lines of Code" |
plugins/mezuro/test/features/removing_metric_configuration.feature
... | ... | @@ -1,32 +0,0 @@ |
1 | -Feature: Remove a metric configuration from a configuration | |
2 | - As a mezuro user | |
3 | - I want to remove metric configurations from a configuration | |
4 | - | |
5 | - Background: | |
6 | - Given the following users | |
7 | - | login | name | | |
8 | - | joaosilva | Joao Silva | | |
9 | - And I am logged in as "joaosilva" | |
10 | - And "Mezuro" plugin is enabled | |
11 | - And the following community | |
12 | - | identifier | name | | |
13 | - | mycommunity | My Community | | |
14 | - And "Joao Silva" is admin of "My Community" | |
15 | - And I am on My Community's cms | |
16 | - And I create a content of type "Kalibro configuration" with the following data | |
17 | - | Title | My Configuration | | |
18 | - | Description | A sample description | | |
19 | - When I follow "Add metric" | |
20 | - And I follow "Analizo" | |
21 | - And I follow "Lines of Code" | |
22 | - And I fill in the following: | |
23 | - | Code: | Sample Code | | |
24 | - | Weight: | 10.0 | | |
25 | - And I select "Average" from "Aggregation Form:" | |
26 | - And I press "Add" | |
27 | - And I press "Save" | |
28 | - And I should see "Lines of Code" | |
29 | - | |
30 | - Scenario: I remove a metric configuration | |
31 | - When I follow "Remove" | |
32 | - Then I should not see "Lines of Code" |