Commit 6df08cceed3c45483a9452e3cc08e6d04919671c

Authored by Diego Camarinha
Committed by Paulo Meireles
1 parent ab1b733d

[Mezuro] Run acceptance tests using Kalibro testing approach.

features/support/hooks.rb
@@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
1 -Before('@mezuro') do |scenario|  
2 - command = "#{RAILS_ROOT}/plugins/mezuro/features/monkey-server/call_monkey_server.sh \"#{scenario.name}\""  
3 - system command  
4 -end  
plugins/mezuro/features/adding_metric_configuration.feature
1 -@mezuro  
2 Feature: Add metric configuration to a configuration 1 Feature: Add metric configuration to a configuration
3 As a mezuro user 2 As a mezuro user
4 I want to add metric configurations to a Kalibro configuration 3 I want to add metric configurations to a Kalibro configuration
plugins/mezuro/features/adding_ranges.feature
1 -@mezuro  
2 Feature: Add range to a metric configuration 1 Feature: Add range to a metric configuration
3 As a mezuro user 2 As a mezuro user
4 I want to add ranges to a Kalibro metric configuration 3 I want to add ranges to a Kalibro metric configuration
plugins/mezuro/features/creating_configuration.feature
1 -@mezuro  
2 Feature: Create configuration 1 Feature: Create configuration
3 As a mezuro user 2 As a mezuro user
4 I want to create a Mezuro configuration 3 I want to create a Mezuro configuration
plugins/mezuro/features/editing_configuration.feature
1 -@mezuro  
2 Feature: editing a configuration 1 Feature: editing a configuration
3 As a mezuro user 2 As a mezuro user
4 I want to edit a Mezuro configuration 3 I want to edit a Mezuro configuration
plugins/mezuro/features/monkey-server/call_monkey_server.sh
@@ -1,11 +0,0 @@ @@ -1,11 +0,0 @@
1 -#!/bin/bash  
2 -  
3 -MONKEY_SERVER_ADDRESS="localhost"  
4 -MONKEY_SERVER_PORT=50688  
5 -  
6 -# Ignore errors from all commands  
7 -trap "" ERR  
8 -  
9 -exec 5<>/dev/tcp/$MONKEY_SERVER_ADDRESS/$MONKEY_SERVER_PORT  
10 -echo "SCENARIO $1" >&5  
11 -echo "SCENARIO $1"  
plugins/mezuro/features/monkey-server/initialize_monkey_server.sh
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -#!/bin/bash  
2 -cd $(dirname $0)  
3 -cp ../../service.yml ../../regular-service.yml  
4 -mv ../../acceptance-test.yml.example ../../service.yml  
5 -  
plugins/mezuro/features/monkey-server/terminate_monkey_server.sh
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -#!/bin/bash  
2 -cd $(dirname $0)  
3 -mv ../../regular-service.yml ../../service.yml  
plugins/mezuro/features/project.feature
1 -@mezuro  
2 Feature: Project 1 Feature: Project
3 As a mezuro user 2 As a mezuro user
4 I want to create, edit and remove a Mezuro project 3 I want to create, edit and remove a Mezuro project
@@ -43,27 +42,27 @@ Feature: Project @@ -43,27 +42,27 @@ Feature: Project
43 When I follow "Edit" 42 When I follow "Edit"
44 # Not complete 43 # Not complete
45 44
46 - @selenium  
47 - Scenario: I delete a Mezuro project that belongs to me  
48 - Given the following Mezuro project  
49 - | name | description | owner |  
50 - | Sample Project | Sample Description | joaosilva |  
51 - And I am on article "Sample Project"  
52 - And I should be on /joaosilva/sample-project  
53 - When I follow "Delete"  
54 - And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog  
55 - Then I go to /joaosilva/sample-project  
56 - And I should see "There is no such page: /joaosilva/sample-project"  
57 -  
58 - @selenium  
59 - Scenario: I cannot delete a Mezuro project that doesn't belong to me  
60 - Given the following Mezuro project  
61 - | name | description | owner |  
62 - | Sample Project | Sample Description | joaosilva |  
63 - And I am on article "Sample Project"  
64 - And I should be on /joaosilva/sample-project  
65 - When I follow "Delete"  
66 - And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog  
67 - Then I go to /joaosilva/sample-project  
68 - And I should see "There is no such page: /joaosilva/sample-project" 45 +# @selenium
  46 +# Scenario: I delete a Mezuro project that belongs to me
  47 +# Given the following Mezuro project
  48 +# | name | description | owner |
  49 +# | Sample Project | Sample Description | joaosilva |
  50 +# And I am on article "Sample Project"
  51 +# And I should be on /joaosilva/sample-project
  52 +# When I follow "Delete"
  53 +# And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog
  54 +# Then I go to /joaosilva/sample-project
  55 +# And I should see "There is no such page: /joaosilva/sample-project"
  56 +#
  57 +# @selenium
  58 +# Scenario: I cannot delete a Mezuro project that doesn't belong to me
  59 +# Given the following Mezuro project
  60 +# | name | description | owner |
  61 +# | Sample Project | Sample Description | joaosilva |
  62 +# And I am on article "Sample Project"
  63 +# And I should be on /joaosilva/sample-project
  64 +# When I follow "Delete"
  65 +# And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog
  66 +# Then I go to /joaosilva/sample-project
  67 +# And I should see "There is no such page: /joaosilva/sample-project"
69 68
plugins/mezuro/features/removing_metric_configuration.feature
1 -@mezuro  
2 Feature: Remove a metric configuration from a configuration 1 Feature: Remove a metric configuration from a configuration
3 As a mezuro user 2 As a mezuro user
4 I want to remove metric configurations from a configuration 3 I want to remove metric configurations from a configuration
plugins/mezuro/test/run_acceptance_tests.sh 100644 → 100755
1 #!/bin/bash 1 #!/bin/bash
2 2
3 -COMMAND_TEST = $1 3 +TEST_FILE=$1
  4 +PROFILE=$2
  5 +
  6 +if [ -z "$PROFILE" ]; then
  7 + PROFILE='default'
  8 +fi
4 9
5 # where are your .kalibro dir? 10 # where are your .kalibro dir?
6 -KALIBRO_HOME= ~/.kalibro 11 +KALIBRO_HOME='/usr/share/tomcat6/.kalibro'
7 12
8 # create a kalibro test dir 13 # create a kalibro test dir
9 -mkdir $KALIBRO_HOME/tests  
10 -cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings 14 +echo "--> Creating tests directory"
  15 +sudo mkdir $KALIBRO_HOME/tests
  16 +echo "--> Copying test settings"
  17 +sudo cp $KALIBRO_HOME/kalibro_tests.settings $KALIBRO_HOME/tests/kalibro.settings
  18 +echo "--> Changing owner of tests directory to tomcat6"
  19 +sudo chown -R tomcat6:tomcat6 $KALIBRO_HOME/tests
11 20
12 # you must restart tomcat6 21 # you must restart tomcat6
13 #if you are using a tomcat installed from apt-get, for example: 22 #if you are using a tomcat installed from apt-get, for example:
14 -#sudo service tomcat6 restart 23 +sudo service tomcat6 restart
15 24
16 -#if you are using a tomcat installed a specific dir, form exemplo: 25 +#if you are using a tomcat installed a specific dir, for exemple:
17 #~/tomcat6/bin/shoutdown.sh 26 #~/tomcat6/bin/shoutdown.sh
18 #~/tomcat6/bin/startup.sh 27 #~/tomcat6/bin/startup.sh
19 28
20 # run test 29 # run test
21 -COMMAND_TEST 30 +cucumber $TEST_FILE -p $PROFILE
22 31
23 #back to normal mode 32 #back to normal mode
24 -rm -rf $KALIBRO_HOME/tests 33 +echo "--> Removing tests directory"
  34 +sudo rm -rf $KALIBRO_HOME/tests
25 35
26 # you must restart tomcat6 again 36 # you must restart tomcat6 again
27 -#sudo service tomcat6 restart 37 +sudo service tomcat6 restart
  38 +
  39 +#or some thing like that...
  40 +#~/tomcat6/bin/shoutdown.sh
  41 +#~/tomcat6/bin/startup.sh
  42 +
plugins/mezuro/views/content_viewer/show_project.rhtml
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 </table> 44 </table>
45 45
46 <br> 46 <br>
47 - <%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Repository", :controller => "mezuro_plugin_repository", 47 + <%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Repository", :controller => "mezuro_plugin_repository",
48 :profile => @page.profile.identifier, 48 :profile => @page.profile.identifier,
49 :action => "new", 49 :action => "new",
50 :id => @page.id %><br/> 50 :id => @page.id %><br/>
plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml
1 <%= render :partial => "source_tree", :locals => {:module_result => @module_result} %> 1 <%= render :partial => "source_tree", :locals => {:module_result => @module_result} %>
2 -<h5><%= _"Metric results for: #{@module_result.module.name} (#{@module_result.module.granularity})" %> </h5> 2 +<h5><%= _"Metric results for: #{MezuroPlugin::Helpers::ModuleResultHelper.module_name(@module_result.module.name)} (#{@module_result.module.granularity})" %> </h5>
3 3
4 <hr/> 4 <hr/>
5 <div class="zoomable-image"> 5 <div class="zoomable-image">