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,40 @@
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/adapters/status_adapter'
18
+
19
+ module TestLink
20
+ module Command
21
+ class CreateTestCase < Base
22
+ remote_method
23
+
24
+ argument :testcasename, :mandatory => true
25
+ argument :testsuiteid, :mandatory => true
26
+ argument :testprojectid, :mandatory => true
27
+ argument :authorlogin, :mandatory => true
28
+ argument :summary, :mandatory => true
29
+ argument :steps, :mandatory => true
30
+ argument :preconditions
31
+ argument :importance
32
+ argument :execution
33
+ argument :order
34
+ argument :checkduplicatedname
35
+ argument :actiononduplicatedname
36
+
37
+ adapt_with Adapters::StatusAdapter
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,35 @@
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/adapters/status_adapter'
18
+
19
+ module TestLink
20
+ module Command
21
+ class CreateTestSuite < Base
22
+ remote_method
23
+
24
+ argument :testprojectid, :mandatory => true
25
+ argument :testsuitename, :mandatory => true
26
+ argument :details, :mandatory => true
27
+ argument :checkduplicatedname
28
+ argument :actiononduplicatedname
29
+ argument :parentid
30
+ argument :order
31
+
32
+ adapt_with TestLink::Adapters::StatusAdapter
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,45 @@
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
+ module TestLink
19
+ module Command
20
+ class Definition
21
+ @@arguments = {}
22
+
23
+ def self.argument name, options = {}
24
+ options = {
25
+ :default => nil,
26
+ :mandatory => false
27
+ }.merge(options)
28
+ name = name.intern
29
+ attr_accessor name
30
+ self.arguments[name] = Argument.new options[:default], options[:mandatory]
31
+ end
32
+
33
+ def self.arguments
34
+ @@arguments[self.command_name] = {} if @@arguments[self.command_name].nil?
35
+ @@arguments[self.command_name]
36
+ end
37
+
38
+ def self.command_name
39
+ classname = self.name.split('::').last
40
+ classname[0] = classname[0].downcase
41
+ classname
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,29 @@
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/adapters/node_adapter'
18
+
19
+ module TestLink
20
+ module Command
21
+ class GetFirstLevelTestSuitesForTestProject < Base
22
+ remote_method
23
+
24
+ argument :testprojectid, :mandatory => true
25
+
26
+ adapt_with Adapters::NodeAdapter
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
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/adapters/project_adapter'
18
+
19
+ module TestLink
20
+ module Command
21
+ class GetProjects < Base
22
+ remote_method
23
+ adapt_with TestLink::Adapters::ProjectAdapter
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
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/adapters/node_adapter'
18
+
19
+ module TestLink
20
+ module Command
21
+ class GetTestSuiteByID < Base
22
+ remote_method
23
+
24
+ argument :testsuiteid, :mandatory => true
25
+
26
+ adapt_with Adapters::NodeAdapter
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
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/adapters/node_adapter'
18
+
19
+ module TestLink
20
+ module Command
21
+ class GetTestSuitesForTestSuite < Base
22
+ remote_method
23
+
24
+ argument :testsuiteid, :mandatory => true
25
+
26
+ adapt_with Adapters::NodeAdapter
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
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/exceptions/error_response_exception'
17
+ require 'test_link/exceptions/command_failed_exception'
18
+ require 'test_link/exceptions/empty_response_exception'
19
+
20
+ module TestLink
21
+ module Exceptions
22
+ end
23
+ end
@@ -0,0 +1,26 @@
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/exceptions/exception'
17
+
18
+ module TestLink
19
+ module Exceptions
20
+ class CommandFailedException < Exception
21
+ def initialize message
22
+ super "Command has failed: #{message}"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
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/exceptions/exception'
17
+
18
+ module TestLink
19
+ module Exceptions
20
+ class EmptyResponseException < Exception
21
+ def initialize
22
+ super 'Response is empty'
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
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/exceptions/exception'
17
+
18
+ module TestLink
19
+ module Exceptions
20
+ class ErrorResponseException < Exception
21
+ attr_accessor :code
22
+ def initialize message, code
23
+ super message
24
+ @code = code
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
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
+ module TestLink
17
+ module Exceptions
18
+ class Exception < ::Exception
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
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/objects/methods'
17
+ require 'test_link/objects/project'
18
+ require 'test_link/objects/status'
19
+ require 'test_link/objects/node'
20
+
21
+ module TestLink
22
+ module Objects
23
+ end
24
+ end
@@ -0,0 +1,29 @@
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
+
17
+ module TestLink
18
+ module Objects
19
+ module Methods
20
+ def == other
21
+ return false unless (self.instance_variables.count == other.instance_variables.count)
22
+ diff = self.instance_variables.select { |prop|
23
+ self.instance_variable_get(prop) != other.instance_variable_get(prop)
24
+ }
25
+ diff.empty?
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
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/objects/methods'
17
+
18
+ module TestLink
19
+ module Objects
20
+ class Node
21
+ include Methods
22
+ attr_accessor :id, :parent_id, :type_id, :table, :order, :name, :details
23
+ end
24
+ end
25
+ end