testlink-api-client 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. data/LICENSE +15 -0
  2. data/README.rdoc +14 -0
  3. data/features/create_test_suite.feature +90 -0
  4. data/features/get_first_level_test_suites_for_test_project.feature +25 -0
  5. data/features/get_projects.feature +47 -0
  6. data/features/get_test_suite_by_id.feature +24 -0
  7. data/features/get_test_suites_for_test_suite.feature +33 -0
  8. data/features/step_definitions/common.rb +69 -0
  9. data/features/step_definitions/create_test_suite.rb +14 -0
  10. data/features/step_definitions/get_first_level_test_suites_for_test_project.rb +14 -0
  11. data/features/step_definitions/get_projects.rb +56 -0
  12. data/features/support/db/one_project.sql +1311 -0
  13. data/features/support/db/some_testsuites.sql +1312 -0
  14. data/features/support/env.rb +32 -0
  15. data/features/support/test_link_test_module.rb +32 -0
  16. data/lib/test_link.rb +22 -0
  17. data/lib/test_link/adapters.rb +24 -0
  18. data/lib/test_link/adapters/base.rb +35 -0
  19. data/lib/test_link/adapters/node_adapter.rb +47 -0
  20. data/lib/test_link/adapters/project_adapter.rb +32 -0
  21. data/lib/test_link/adapters/status_adapter.rb +33 -0
  22. data/lib/test_link/api_link.rb +62 -0
  23. data/lib/test_link/command.rb +29 -0
  24. data/lib/test_link/command/argument.rb +31 -0
  25. data/lib/test_link/command/base.rb +63 -0
  26. data/lib/test_link/command/create_test_case.rb +40 -0
  27. data/lib/test_link/command/create_test_suite.rb +35 -0
  28. data/lib/test_link/command/definition.rb +45 -0
  29. data/lib/test_link/command/get_first_level_test_suites_for_test_project.rb +29 -0
  30. data/lib/test_link/command/get_projects.rb +26 -0
  31. data/lib/test_link/command/get_test_suite_by_id.rb +29 -0
  32. data/lib/test_link/command/get_test_suites_for_test_suite.rb +29 -0
  33. data/lib/test_link/exceptions.rb +23 -0
  34. data/lib/test_link/exceptions/command_failed_exception.rb +26 -0
  35. data/lib/test_link/exceptions/empty_response_exception.rb +26 -0
  36. data/lib/test_link/exceptions/error_response_exception.rb +28 -0
  37. data/lib/test_link/exceptions/exception.rb +21 -0
  38. data/lib/test_link/objects.rb +24 -0
  39. data/lib/test_link/objects/methods.rb +29 -0
  40. data/lib/test_link/objects/node.rb +25 -0
  41. data/lib/test_link/objects/project.rb +25 -0
  42. data/lib/test_link/objects/status.rb +25 -0
  43. data/lib/testlink-api-client.rb +16 -0
  44. data/spec/spec_helper.rb +39 -0
  45. data/spec/test_link/adapters/base_spec.rb +56 -0
  46. data/spec/test_link/adapters/node_adapter_spec.rb +102 -0
  47. data/spec/test_link/adapters/project_adapter_spec.rb +81 -0
  48. data/spec/test_link/adapters/status_adapter_spec.rb +51 -0
  49. data/spec/test_link/api_link_spec.rb +106 -0
  50. data/spec/test_link/command/argument_spec.rb +43 -0
  51. data/spec/test_link/command/base_spec.rb +94 -0
  52. data/spec/test_link/command/create_test_case_spec.rb +88 -0
  53. data/spec/test_link/command/create_test_suite_spec.rb +67 -0
  54. data/spec/test_link/command/get_first_level_test_suites_for_test_project_spec.rb +43 -0
  55. data/spec/test_link/command/get_projets_spec.rb +33 -0
  56. data/spec/test_link/command/get_test_suite_by_id_spec.rb +43 -0
  57. data/spec/test_link/command/get_test_suites_for_test_suite_spec.rb +43 -0
  58. data/spec/test_link/exceptions/command_failed_exception_spec.rb +28 -0
  59. data/spec/test_link/exceptions/empty_response_exception_spec.rb +28 -0
  60. data/spec/test_link/exceptions/error_response_exception_spec.rb +30 -0
  61. data/spec/test_link/objects/node_spec.rb +49 -0
  62. data/spec/test_link/objects/project_spec.rb +39 -0
  63. data/spec/test_link/objects/status_spec.rb +43 -0
  64. metadata +194 -0
@@ -0,0 +1,43 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'test_link/command/argument'
17
+
18
+ describe TestLink::Command::Argument do
19
+
20
+ before :each do
21
+ @argument = TestLink::Command::Argument.new
22
+ end
23
+
24
+ it 'has a default value' do
25
+ @argument.should respond_to :default
26
+ end
27
+
28
+ it 'may be mandatory' do
29
+ @argument.should respond_to :mandatory?
30
+ end
31
+
32
+ describe 'default state' do
33
+ describe 'default value' do
34
+ it 'is nil' do
35
+ @argument.default.should be_nil
36
+ end
37
+ end
38
+
39
+ it 'is not mandatory' do
40
+ @argument.mandatory?.should be_false
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,94 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "test_link/command/base"
17
+ require "test_link/api_link"
18
+
19
+ describe TestLink::Command::Base do
20
+ before :each do
21
+ @command = TestLink::Command::Base.new
22
+ end
23
+
24
+ describe 'Arguments' do
25
+ it 'can be defined' do
26
+ TestLink::Command::Base.should respond_to :argument
27
+ end
28
+
29
+ it 'has an argument list' do
30
+ TestLink::Command::Base.should respond_to :arguments
31
+ end
32
+
33
+ it 'has dev_key mandatory argument' do
34
+ TestLink::Command::Base.arguments[:devKey].mandatory?.should be_true
35
+ @command.should provide :devKey
36
+ end
37
+ end
38
+
39
+ describe 'Classname' do
40
+ it 'helps to retrieve remote command name the first letter becomes lower case' do
41
+ TestLink::Command::Base.command_name.should == 'base'
42
+ end
43
+ end
44
+
45
+ describe 'Execution' do
46
+ before :each do
47
+ @key = '___dev-key___'
48
+ @link = TestLink::ApiLink.new 'http://qa.example.com/', @key
49
+ @link.client.stub!(:call)
50
+ end
51
+
52
+ it 'calls a remote method' do
53
+ @link.client.should_receive(:call).with('tl.base', :devKey => @key)
54
+ @command.execute @link
55
+ end
56
+
57
+ it 'sets a default developer key given by the link' do
58
+ @command.execute @link
59
+ @command.devKey.should == @key
60
+ @command.arguments_hash[:devKey].should == @key
61
+ end
62
+
63
+ it 'overrides the link\'s key if it is defined' do
64
+ key = '___other-dev-key___'
65
+ @command.devKey = key
66
+ @command.execute @link
67
+ @command.devKey.should == key
68
+ @command.arguments_hash[:devKey].should == key
69
+ end
70
+
71
+ it 'raise an ArgumentError when a mandatory is not set' do
72
+ @link.key = nil
73
+ expect { @command.execute @link }.to raise_exception ArgumentError, 'Missing mandatory argument(s) [:devKey]'
74
+ end
75
+ end
76
+
77
+ it 'allows to reset arguments to defined values' do
78
+ @command.reset_arguments_hash :devKey => (key = 'my_dev_key')
79
+ @command.devKey.should == key
80
+ @command.arguments_hash[:devKey].should == key
81
+ end
82
+
83
+ it 'checks whether command can be executed' do
84
+ TestLink::Command::Base.new.check_arguments.should == [:devKey]
85
+ end
86
+
87
+ it 'can add itself to TestLink::ApiLink' do
88
+ TestLink::Command::Base.should respond_to :remote_method
89
+ end
90
+
91
+ it 'defines it\'s adapter' do
92
+ TestLink::Command::Base.should respond_to :adapt_with
93
+ end
94
+ end
@@ -0,0 +1,88 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "test_link/command/create_test_case"
17
+ require "test_link/adapters/status_adapter"
18
+
19
+ describe TestLink::Command::CreateTestCase do
20
+ it "is a command" do
21
+ TestLink::Command::CreateTestCase.should < TestLink::Command::Base
22
+ end
23
+
24
+ it "adds a createTestSuite method to TestLink::ApiLink" do
25
+ TestLink::ApiLink.new('http://qa.example.com/', '').should respond_to :createTestCase
26
+ end
27
+
28
+ describe 'adapter' do
29
+ it 'is a TestLink::Adapters::StatusAdapter' do
30
+ TestLink::ApiLink.adapter_for(TestLink::Command::CreateTestCase.command_name).should be_instance_of TestLink::Adapters::StatusAdapter
31
+ end
32
+ end
33
+
34
+ describe 'arguments' do
35
+ before :each do
36
+ @command = TestLink::Command::CreateTestCase.new
37
+ end
38
+
39
+ it 'contain mandatory testcasename' do
40
+ @command.should provide_mandatory_argument :testcasename
41
+ end
42
+
43
+ it 'contain mandatory testsuiteid' do
44
+ @command.should provide_mandatory_argument :testsuiteid
45
+ end
46
+
47
+ it 'contain mandatory testprojectid' do
48
+ @command.should provide_mandatory_argument :testprojectid
49
+ end
50
+
51
+ it 'contain mandatory authorlogin' do
52
+ @command.should provide_mandatory_argument :authorlogin
53
+ end
54
+
55
+ it 'contain mandatory summary' do
56
+ @command.should provide_mandatory_argument :summary
57
+ end
58
+
59
+ it 'contain mandatory steps' do
60
+ @command.should provide_mandatory_argument :steps
61
+ end
62
+
63
+ it 'contain preconditions' do
64
+ @command.should provide_argument :preconditions
65
+ end
66
+
67
+ it 'contain importance' do
68
+ @command.should provide_argument :importance
69
+ end
70
+
71
+ it 'contain execution' do
72
+ @command.should provide_argument :execution
73
+ end
74
+
75
+ it 'contain order' do
76
+ @command.should provide_argument :order
77
+ end
78
+
79
+ it 'contain checkduplicatedname' do
80
+ @command.should provide_argument :checkduplicatedname
81
+ end
82
+
83
+ it 'contain actiononduplicatedname' do
84
+ @command.should provide_argument :actiononduplicatedname
85
+ end
86
+
87
+ end
88
+ end
@@ -0,0 +1,67 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "test_link/command/create_test_suite"
17
+ require "test_link/adapters/status_adapter"
18
+
19
+ describe TestLink::Command::CreateTestSuite do
20
+ it "is a command" do
21
+ (TestLink::Command::CreateTestSuite < TestLink::Command::Base).should be_true
22
+ end
23
+
24
+ it "adds a createTestSuite method to TestLink::ApiLink" do
25
+ TestLink::ApiLink.new('http://qa.example.com/', '').should respond_to :createTestSuite
26
+ end
27
+
28
+ describe 'adapter' do
29
+ it 'is a TestLink::Adapters::StatusAdapter' do
30
+ TestLink::ApiLink.adapter_for(TestLink::Command::CreateTestSuite.command_name).should be_instance_of TestLink::Adapters::StatusAdapter
31
+ end
32
+ end
33
+
34
+ describe 'arguments' do
35
+ before :each do
36
+ @command = TestLink::Command::CreateTestSuite.new
37
+ end
38
+
39
+ it 'contain mandatory testprojectid' do
40
+ @command.should provide_mandatory_argument :testprojectid
41
+ end
42
+
43
+ it 'contain mandatory testsuitename' do
44
+ @command.should provide_mandatory_argument :testsuitename
45
+ end
46
+
47
+ it 'contain mandatory details' do
48
+ @command.should provide_mandatory_argument :details
49
+ end
50
+
51
+ it 'contain checkduplicatedname' do
52
+ @command.should provide_argument :checkduplicatedname
53
+ end
54
+
55
+ it 'contain actiononduplicatedname' do
56
+ @command.should provide_argument :actiononduplicatedname
57
+ end
58
+
59
+ it 'contain parentid' do
60
+ @command.should provide_argument :parentid
61
+ end
62
+
63
+ it 'contain order' do
64
+ @command.should provide_argument :order
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,43 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'test_link/command/get_first_level_test_suites_for_test_project'
17
+ require 'test_link/adapters/node_adapter'
18
+
19
+ describe TestLink::Command::GetFirstLevelTestSuitesForTestProject do
20
+ it "is a command" do
21
+ TestLink::Command::GetFirstLevelTestSuitesForTestProject.should < TestLink::Command::Base
22
+ end
23
+
24
+ it "adds a getFirstLevelTestSuitesForTestProject method to TestLink::ApiLink" do
25
+ TestLink::ApiLink.new('http://qa.example.com/', '').should respond_to :getFirstLevelTestSuitesForTestProject
26
+ end
27
+
28
+ describe 'adapter' do
29
+ it 'is a TestLink::Adapters::NodeAdapter' do
30
+ TestLink::ApiLink.adapter_for(TestLink::Command::GetFirstLevelTestSuitesForTestProject.command_name).should be_instance_of TestLink::Adapters::NodeAdapter
31
+ end
32
+ end
33
+
34
+ describe 'arguments' do
35
+ before :each do
36
+ @command = TestLink::Command::GetFirstLevelTestSuitesForTestProject.new
37
+ end
38
+
39
+ it 'contain mandatory testprojectid' do
40
+ @command.should provide_mandatory_argument :testprojectid
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,33 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require "test_link/command/get_projects"
17
+ require "test_link/adapters/project_adapter"
18
+
19
+ describe TestLink::Command::GetProjects do
20
+ it "is a command" do
21
+ TestLink::Command::GetProjects.should < TestLink::Command::Base
22
+ end
23
+
24
+ it "adds a getProjects method to TestLink::ApiLink" do
25
+ TestLink::ApiLink.new('http://qa.example.com/', '').should respond_to :getProjects
26
+ end
27
+
28
+ describe 'adapter' do
29
+ it 'is a TestLink::Adapters::ProjectAdapter' do
30
+ TestLink::ApiLink.adapter_for(TestLink::Command::GetProjects.command_name).should be_instance_of TestLink::Adapters::ProjectAdapter
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,43 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'test_link/command/get_test_suite_by_id'
17
+ require 'test_link/adapters/node_adapter'
18
+
19
+ describe TestLink::Command::GetTestSuiteByID do
20
+ it "is a command" do
21
+ TestLink::Command::GetTestSuiteByID.should < TestLink::Command::Base
22
+ end
23
+
24
+ it "adds a getTestSuiteByID method to TestLink::ApiLink" do
25
+ TestLink::ApiLink.new('http://qa.example.com/', '').should respond_to :getTestSuiteByID
26
+ end
27
+
28
+ describe 'adapter' do
29
+ it 'is a TestLink::Adapters::NodeAdapter' do
30
+ TestLink::ApiLink.adapter_for(TestLink::Command::GetTestSuiteByID.command_name).should be_instance_of TestLink::Adapters::NodeAdapter
31
+ end
32
+ end
33
+
34
+ describe 'arguments' do
35
+ before :each do
36
+ @command = TestLink::Command::GetTestSuiteByID.new
37
+ end
38
+
39
+ it 'contain mandatory testsuiteid' do
40
+ @command.should provide_mandatory_argument :testsuiteid
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ # This file is part of testlink-api-client.
2
+ #
3
+ # testlink-api-client is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # testlink-api-client is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with Foobar. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'test_link/command/get_test_suites_for_test_suite'
17
+ require 'test_link/adapters/node_adapter'
18
+
19
+ describe TestLink::Command::GetTestSuitesForTestSuite do
20
+ it "is a command" do
21
+ TestLink::Command::GetTestSuitesForTestSuite.should < TestLink::Command::Base
22
+ end
23
+
24
+ it "adds a getTestSuitesForTestSuite method to TestLink::ApiLink" do
25
+ TestLink::ApiLink.new('http://qa.example.com/', '').should respond_to :getTestSuitesForTestSuite
26
+ end
27
+
28
+ describe 'adapter' do
29
+ it 'is a TestLink::Adapters::NodeAdapter' do
30
+ TestLink::ApiLink.adapter_for(TestLink::Command::GetTestSuitesForTestSuite.command_name).should be_instance_of TestLink::Adapters::NodeAdapter
31
+ end
32
+ end
33
+
34
+ describe 'arguments' do
35
+ before :each do
36
+ @command = TestLink::Command::GetTestSuitesForTestSuite.new
37
+ end
38
+
39
+ it 'contain mandatory testsuiteid' do
40
+ @command.should provide_mandatory_argument :testsuiteid
41
+ end
42
+ end
43
+ end