testability-driver 1.2.1 → 1.3.0

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 (125) hide show
  1. data/bin/tdriver-devtools +0 -0
  2. data/ext/native_extensions.c +165 -6
  3. data/lib/tdriver-devtools/behaviour/old/xml/update +0 -0
  4. data/lib/tdriver-devtools/behaviour/xml/generate.rb +0 -0
  5. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +15 -1
  6. data/lib/tdriver-devtools/doc/update +0 -0
  7. data/lib/tdriver-devtools/doc/xslt/template.xsl +24 -14
  8. data/lib/tdriver-devtools/doc/xslt/update +0 -0
  9. data/lib/tdriver-devtools/tdriver-devtools.rb +0 -0
  10. data/lib/tdriver-devtools/tests/feature_tests/update +0 -0
  11. data/lib/tdriver/base/behaviour/{behaviour.rb → abstract.rb} +3 -6
  12. data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
  13. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +2 -2
  14. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +47 -37
  15. data/lib/tdriver/base/behaviour/factory.rb +260 -382
  16. data/lib/tdriver/base/behaviour/loader.rb +22 -4
  17. data/lib/tdriver/base/controller/abstraction.rb +56 -0
  18. data/lib/tdriver/base/controller/loader.rb +21 -0
  19. data/lib/tdriver/base/loader.rb +3 -1
  20. data/lib/tdriver/base/sut/controller.rb +91 -74
  21. data/lib/tdriver/base/sut/factory.rb +8 -8
  22. data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
  23. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +116 -96
  24. data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
  25. data/lib/tdriver/base/sut/sut.rb +10 -8
  26. data/lib/tdriver/base/test_object/abstract.rb +25 -24
  27. data/lib/tdriver/base/test_object/adapter.rb +67 -44
  28. data/lib/tdriver/base/test_object/behaviours/test_object.rb +79 -20
  29. data/lib/tdriver/base/test_object/factory.rb +45 -15
  30. data/lib/tdriver/base/test_object/xml/adapter.rb +80 -57
  31. data/lib/tdriver/env.rb +0 -0
  32. data/lib/tdriver/loader.rb +0 -0
  33. data/lib/tdriver/matti.rb +0 -0
  34. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +1 -0
  35. data/lib/tdriver/report/report.rb +2 -1
  36. data/lib/tdriver/report/report_crash_file_capture.rb +12 -0
  37. data/lib/tdriver/report/report_creator.rb +6 -2
  38. data/lib/tdriver/report/report_execution_statistics.rb +27 -11
  39. data/lib/tdriver/report/report_graph_generator.rb +59 -0
  40. data/lib/tdriver/report/report_test_case_run.rb +34 -2
  41. data/lib/tdriver/report/report_writer.rb +12 -0
  42. data/lib/tdriver/tdriver.rb +12 -1
  43. data/lib/tdriver/util/agent/loader.rb +22 -0
  44. data/lib/tdriver/util/agent/service.rb +107 -0
  45. data/lib/tdriver/util/common/crc16.rb +17 -10
  46. data/lib/tdriver/util/common/hash.rb +4 -1
  47. data/lib/tdriver/util/common/kernel.rb +11 -0
  48. data/lib/tdriver/util/common/numeric.rb +48 -0
  49. data/lib/tdriver/util/common/object.rb +5 -2
  50. data/lib/tdriver/util/common/string.rb +8 -1
  51. data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
  52. data/lib/tdriver/util/filters/loader.rb +29 -0
  53. data/lib/tdriver/util/fixture/loader.rb +22 -0
  54. data/lib/tdriver/util/fixture/service.rb +157 -0
  55. data/lib/tdriver/util/loader.rb +8 -2
  56. data/lib/tdriver/util/logger/logger.rb +12 -6
  57. data/lib/tdriver/util/other/config.rb +0 -0
  58. data/lib/tdriver/util/parameter/parameter.rb +221 -152
  59. data/lib/tdriver/util/plugin/error.rb +0 -0
  60. data/lib/tdriver/util/video/camera_linux.rb +36 -22
  61. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +3 -13
  62. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +13 -8
  63. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +51 -9
  64. data/lib/tdriver/util/xml/xml.rb +4 -2
  65. data/lib/tdriver/verify/verify.rb +280 -621
  66. data/lib/tdriver/version.rb +1 -1
  67. data/xml/behaviours/generic.xml +34 -0
  68. data/xml/templates/generic.xml +20 -3
  69. metadata +168 -240
  70. data/lib/tdriver-devtools/tests/feature_tests/output/application_closable_0x3f.feature +0 -10
  71. data/lib/tdriver-devtools/tests/feature_tests/output/application_close.feature +0 -15
  72. data/lib/tdriver-devtools/tests/feature_tests/output/application_environment.feature +0 -10
  73. data/lib/tdriver-devtools/tests/feature_tests/output/application_executable_name.feature +0 -10
  74. data/lib/tdriver-devtools/tests/feature_tests/output/application_uid.feature +0 -10
  75. data/lib/tdriver-devtools/tests/feature_tests/output/created.rid +0 -1
  76. data/lib/tdriver-devtools/tests/feature_tests/output/find_find.feature +0 -15
  77. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash.feature +0 -10
  78. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash_images.feature +0 -15
  79. data/lib/tdriver-devtools/tests/feature_tests/output/sut_application.feature +0 -15
  80. data/lib/tdriver-devtools/tests/feature_tests/output/sut_capture_screen.feature +0 -10
  81. data/lib/tdriver-devtools/tests/feature_tests/output/sut_child.feature +0 -10
  82. data/lib/tdriver-devtools/tests/feature_tests/output/sut_clear_verify_blocks.feature +0 -10
  83. data/lib/tdriver-devtools/tests/feature_tests/output/sut_connect.feature +0 -10
  84. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order.feature +0 -10
  85. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order_0x3d.feature +0 -10
  86. data/lib/tdriver-devtools/tests/feature_tests/output/sut_current_application_id.feature +0 -15
  87. data/lib/tdriver-devtools/tests/feature_tests/output/sut_disconnect.feature +0 -10
  88. data/lib/tdriver-devtools/tests/feature_tests/output/sut_dump_count.feature +0 -15
  89. data/lib/tdriver-devtools/tests/feature_tests/output/sut_freeze.feature +0 -10
  90. data/lib/tdriver-devtools/tests/feature_tests/output/sut_frozen.feature +0 -10
  91. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_application_id.feature +0 -10
  92. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_object.feature +0 -10
  93. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_operator_data.feature +0 -10
  94. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_ui_dump.feature +0 -15
  95. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_user_information.feature +0 -10
  96. data/lib/tdriver-devtools/tests/feature_tests/output/sut_input.feature +0 -15
  97. data/lib/tdriver-devtools/tests/feature_tests/output/sut_parameter.feature +0 -15
  98. data/lib/tdriver-devtools/tests/feature_tests/output/sut_press_key.feature +0 -10
  99. data/lib/tdriver-devtools/tests/feature_tests/output/sut_received_data.feature +0 -10
  100. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh.feature +0 -20
  101. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_timeout.feature +0 -15
  102. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_tries.feature +0 -15
  103. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_ui_dump.feature +0 -20
  104. data/lib/tdriver-devtools/tests/feature_tests/output/sut_run.feature +0 -10
  105. data/lib/tdriver-devtools/tests/feature_tests/output/sut_sent_data.feature +0 -10
  106. data/lib/tdriver-devtools/tests/feature_tests/output/sut_state.feature +0 -10
  107. data/lib/tdriver-devtools/tests/feature_tests/output/sut_translate.feature +0 -30
  108. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_type.feature +0 -10
  109. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_version.feature +0 -10
  110. data/lib/tdriver-devtools/tests/feature_tests/output/sut_unfreeze.feature +0 -10
  111. data/lib/tdriver-devtools/tests/feature_tests/output/sut_update.feature +0 -10
  112. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_always.feature +0 -20
  113. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_blocks.feature +0 -10
  114. data/lib/tdriver-devtools/tests/feature_tests/output/sut_x_path.feature +0 -10
  115. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data.feature +0 -10
  116. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_0x3d.feature +0 -10
  117. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_crc.feature +0 -10
  118. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_down.feature +0 -10
  119. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_status.feature +0 -10
  120. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_up.feature +0 -10
  121. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_reset.feature +0 -10
  122. data/lib/tdriver-devtools/tests/feature_tests/output/verification_test_object_exists_0x3f.feature +0 -15
  123. data/lib/tdriver/base/behaviour/factory_new.rb +0 -409
  124. data/lib/tdriver/base/test_object/identificator.rb +0 -518
  125. data/lib/tdriver/util/filters/dynamic_attributes.rb +0 -189
@@ -1,20 +0,0 @@
1
- Feature: MobyBehaviour::SUT#refresh_ui_dump
2
- As a test scripter writer
3
- I want to use refresh_ui_dump method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing refresh_ui_dump method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].refresh_ui_dump()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
11
- Scenario: Testing refresh_ui_dump method with optional argument 'refresh_args' (Rename this to be more descriptive)
12
- Given I launch application [APPLICATION_NAME] as @app
13
- When I execute "@app.[SOME_OBJECT].refresh_ui_dump(refresh_args)"
14
- Then [ADD_YOUR_VERIFICATION_HERE]
15
-
16
- Scenario: Testing refresh_ui_dump method with optional argument 'creation_attributes' (Rename this to be more descriptive)
17
- Given I launch application [APPLICATION_NAME] as @app
18
- When I execute "@app.[SOME_OBJECT].refresh_ui_dump(refresh_args, creation_attributes)"
19
- Then [ADD_YOUR_VERIFICATION_HERE]
20
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#run
2
- As a test scripter writer
3
- I want to use run method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing run method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].run(target)"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#sent_data
2
- As a test scripter writer
3
- I want to use sent_data method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing sent_data method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].sent_data()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#state
2
- As a test scripter writer
3
- I want to use state method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing state method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].state()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,30 +0,0 @@
1
- Feature: MobyBehaviour::SUT#translate
2
- As a test scripter writer
3
- I want to use translate method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing translate method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].translate(logical_name)"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
11
- Scenario: Testing translate method with optional argument 'file_name' (Rename this to be more descriptive)
12
- Given I launch application [APPLICATION_NAME] as @app
13
- When I execute "@app.[SOME_OBJECT].translate(logical_name, file_name)"
14
- Then [ADD_YOUR_VERIFICATION_HERE]
15
-
16
- Scenario: Testing translate method with optional argument 'plurality' (Rename this to be more descriptive)
17
- Given I launch application [APPLICATION_NAME] as @app
18
- When I execute "@app.[SOME_OBJECT].translate(logical_name, file_name, plurality)"
19
- Then [ADD_YOUR_VERIFICATION_HERE]
20
-
21
- Scenario: Testing translate method with optional argument 'numerus' (Rename this to be more descriptive)
22
- Given I launch application [APPLICATION_NAME] as @app
23
- When I execute "@app.[SOME_OBJECT].translate(logical_name, file_name, plurality, numerus)"
24
- Then [ADD_YOUR_VERIFICATION_HERE]
25
-
26
- Scenario: Testing translate method with optional argument 'lengthvariant' (Rename this to be more descriptive)
27
- Given I launch application [APPLICATION_NAME] as @app
28
- When I execute "@app.[SOME_OBJECT].translate(logical_name, file_name, plurality, numerus, lengthvariant)"
29
- Then [ADD_YOUR_VERIFICATION_HERE]
30
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#ui_type
2
- As a test scripter writer
3
- I want to use ui_type attribute to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing ui_type attribute (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].ui_type"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#ui_version
2
- As a test scripter writer
3
- I want to use ui_version attribute to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing ui_version attribute (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].ui_version"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#unfreeze
2
- As a test scripter writer
3
- I want to use unfreeze method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing unfreeze method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].unfreeze()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#update
2
- As a test scripter writer
3
- I want to use update method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing update method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].update()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,20 +0,0 @@
1
- Feature: MobyBehaviour::SUT#verify_always
2
- As a test scripter writer
3
- I want to use verify_always method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing verify_always method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].verify_always(expected)"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
11
- Scenario: Testing verify_always method with optional argument 'message' (Rename this to be more descriptive)
12
- Given I launch application [APPLICATION_NAME] as @app
13
- When I execute "@app.[SOME_OBJECT].verify_always(expected, message)"
14
- Then [ADD_YOUR_VERIFICATION_HERE]
15
-
16
- Scenario: Testing verify_always method with optional argument 'block' (Rename this to be more descriptive)
17
- Given I launch application [APPLICATION_NAME] as @app
18
- When I execute "@app.[SOME_OBJECT].verify_always(expected, message, block)"
19
- Then [ADD_YOUR_VERIFICATION_HERE]
20
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#verify_blocks
2
- As a test scripter writer
3
- I want to use verify_blocks attribute to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing verify_blocks attribute (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].verify_blocks"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#x_path
2
- As a test scripter writer
3
- I want to use x_path attribute to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing x_path attribute (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].x_path"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#xml_data
2
- As a test scripter writer
3
- I want to use xml_data attribute to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing xml_data attribute (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].xml_data"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#xml_data=
2
- As a test scripter writer
3
- I want to use xml_data= method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing xml_data= method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].xml_data=(xml)"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SUT#xml_data_crc
2
- As a test scripter writer
3
- I want to use xml_data_crc attribute to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SUT behaviour
5
-
6
- Scenario: Testing xml_data_crc attribute (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].xml_data_crc"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SwitchboxBehaviour#power_down
2
- As a test scripter writer
3
- I want to use power_down method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SwitchboxBehaviour behaviour
5
-
6
- Scenario: Testing power_down method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].power_down()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SwitchboxBehaviour#power_status
2
- As a test scripter writer
3
- I want to use power_status method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SwitchboxBehaviour behaviour
5
-
6
- Scenario: Testing power_status method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].power_status()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SwitchboxBehaviour#power_up
2
- As a test scripter writer
3
- I want to use power_up method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SwitchboxBehaviour behaviour
5
-
6
- Scenario: Testing power_up method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].power_up()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,10 +0,0 @@
1
- Feature: MobyBehaviour::SwitchboxBehaviour#reset
2
- As a test scripter writer
3
- I want to use reset method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::SwitchboxBehaviour behaviour
5
-
6
- Scenario: Testing reset method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].reset()"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
@@ -1,15 +0,0 @@
1
- Feature: MobyBehaviour::Verification#test_object_exists?
2
- As a test scripter writer
3
- I want to use test_object_exists? method to [DO_SOMETHING] in [TARGET_APPLICATION]
4
- so that I can test the MobyBehaviour::Verification behaviour
5
-
6
- Scenario: Testing test_object_exists? method with required argument(s) (Rename this to be more descriptive)
7
- Given I launch application [APPLICATION_NAME] as @app
8
- When I execute "@app.[SOME_OBJECT].test_object_exists?(type)"
9
- Then [ADD_YOUR_VERIFICATION_HERE]
10
-
11
- Scenario: Testing test_object_exists? method with optional argument 'attributes' (Rename this to be more descriptive)
12
- Given I launch application [APPLICATION_NAME] as @app
13
- When I execute "@app.[SOME_OBJECT].test_object_exists?(type, attributes)"
14
- Then [ADD_YOUR_VERIFICATION_HERE]
15
-
@@ -1,409 +0,0 @@
1
- ############################################################################
2
- ##
3
- ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
- ## All rights reserved.
5
- ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
- ##
7
- ## This file is part of Testability Driver.
8
- ##
9
- ## If you have questions regarding the use of this file, please contact
10
- ## Nokia at testabilitydriver@nokia.com .
11
- ##
12
- ## This library is free software; you can redistribute it and/or
13
- ## modify it under the terms of the GNU Lesser General Public
14
- ## License version 2.1 as published by the Free Software Foundation
15
- ## and appearing in the file LICENSE.LGPL included in the packaging
16
- ## of this file.
17
- ##
18
- ############################################################################
19
-
20
- #require 'lib/tdriver'
21
-
22
- module TDriver
23
-
24
- class Behaviour
25
-
26
- def initialize( values )
27
-
28
- # add each hash pair as class instance attribute
29
- values.each_pair do | key, value |
30
-
31
- # cast to string; might need additional verification for invalid characters
32
- key = key.to_s
33
-
34
- # add attribute reader for hash key
35
- eval <<-CODE
36
-
37
- # add attribute reader
38
- class << self; attr_reader :#{ key }; end
39
-
40
- # set value
41
- @#{ key } = #{ value.inspect };
42
-
43
- CODE
44
-
45
- end
46
-
47
- end
48
-
49
- def method_missing( name, *args )
50
-
51
- nil
52
-
53
- end
54
-
55
- def applies_to?( rule )
56
-
57
- rule.default = [ '*' ]
58
-
59
- case rule[ :name ]
60
-
61
- when @name
62
-
63
- true
64
-
65
- when ['*']
66
-
67
- !( rule[ :object_type ] & @object_type ).empty? &&
68
- !( rule[ :input_type ] & @input_type ).empty? &&
69
- !( rule[ :env ] & @env ).empty? &&
70
- !( rule[ :version ] & @version ).empty?
71
-
72
- else
73
-
74
- false
75
-
76
- end
77
-
78
- =begin
79
- # calculate hash for behaviour rule / hash value will be used to identify similar objects
80
- @@behaviours_cache.fetch( rule.delete_keys( :object ).hash ){ | behaviour_hash |
81
-
82
- rule.default = [ '*' ]
83
-
84
- @@behaviours_cache[ behaviour_hash ] = @@behaviours.each_with_index.collect{ | behaviour, index |
85
-
86
- case rule[ :name ]
87
-
88
- when behaviour[ :name ]
89
-
90
- index
91
-
92
- when [ '*' ]
93
-
94
- index if (
95
- !( rule[ :object_type ] & behaviour[ :object_type ] ).empty? &&
96
- !( rule[ :input_type ] & behaviour[ :input_type ] ).empty? &&
97
- !( rule[ :env ] & behaviour[ :env ] ).empty? &&
98
- !( rule[ :version ] & behaviour[ :version ] ).empty?
99
- )
100
-
101
- else
102
-
103
- nil
104
-
105
- end
106
-
107
- }.compact
108
-
109
- }
110
- =end
111
-
112
- end
113
-
114
- end
115
-
116
- class BehaviourFactory
117
-
118
- class << self
119
-
120
- public
121
-
122
- # initialize behaviours factory
123
- def init( options )
124
-
125
- load_behaviours(
126
-
127
- options[ :path ]
128
-
129
- )
130
-
131
- end
132
-
133
- # reset class configuration
134
- def reset
135
-
136
- # reset default values
137
- initialize_class
138
-
139
- end
140
-
141
- def collect_behaviours( rule )
142
-
143
- cache_key = rule.reject{ | key, value | key == :object }
144
-
145
- if @behaviours_cache.has_key?( cache_key )
146
-
147
- @behaviours_cache[ cache_key ]
148
-
149
- else
150
-
151
- # retrieve enabled plugins from PluginService
152
- enabled_plugins = TDriver::PluginService.enabled_plugins
153
-
154
- @behaviours_cache[ cache_key ] = @behaviours.select do | behaviour |
155
-
156
- # skip if required plugin is not registered or enabled; compare requires array and enabled_plugins array
157
- next unless ( behaviour[ 'requires' ] - enabled_plugins ).empty?
158
-
159
- rule.default = [ '*' ]
160
-
161
- case rule[ :name ]
162
-
163
- when @name
164
-
165
- # exact match with name
166
- true
167
-
168
- when ['*']
169
-
170
- # compare rules and behaviour attributes
171
- !( rule[ :object_type ] & behaviour[ 'object_type' ] ).empty? &&
172
- !( rule[ :input_type ] & behaviour[ 'input_type' ] ).empty? &&
173
- !( rule[ :env ] & behaviour[ 'env' ] ).empty? &&
174
- !( rule[ :version ] & behaviour[ 'version' ] ).empty?
175
-
176
- else
177
-
178
- false
179
-
180
- end
181
-
182
- end
183
-
184
- end
185
-
186
- end
187
-
188
- def apply_behaviour( rule )
189
-
190
- collected_indexes = []
191
-
192
- rule[ :object ].instance_variable_get( :@object_behaviours )
193
-
194
- collect_behaviours( rule ).each do | behaviour |
195
-
196
- begin
197
-
198
- # retrieve behaviour module
199
- behaviour[ 'module' ] = MobyUtil::KernelHelper.get_constant( behaviour[ 'module' ].to_s ) unless behaviour[ 'module' ].kind_of?( Module )
200
-
201
- # extend target object with behaviour module
202
- rule[ :object ].extend( behaviour[ 'module' ] )
203
-
204
- # store behaviour indexes
205
- collected_indexes << behaviour[ 'index' ]
206
-
207
- rescue NameError
208
-
209
- raise NameError, "Implementation for #{ behaviour[ 'name' ] } behaviour does not exist. (#{ behaviour[ 'module' ] })"
210
-
211
- rescue
212
-
213
- raise RuntimeError, "Error while applying #{ behaviour[ 'name' ] } (#{ behaviour[ 'module' ] }) behaviour to target object due to #{ $!.message } (#{ $!.class })"
214
-
215
- end
216
-
217
-
218
- end
219
-
220
- rule[ :object ].instance_variable_get( :@object_behaviours ).tap{ | indexes | indexes = indexes | collected_indexes }
221
-
222
- =begin
223
- # retrieve enabled plugins from PluginService
224
- enabled_plugins = TDriver::PluginService.enabled_plugins
225
-
226
- @behaviours.each_with_index{ | behaviour, index |
227
-
228
- # skip if required plugin is not registered or enabled; compare requires array and enabled_plugins array
229
- next unless ( behaviour.requires - enabled_plugins ).empty?
230
-
231
- if behaviour.applies_to?( rule )
232
-
233
- begin
234
-
235
- behaviour_module = behaviour.module
236
-
237
- # retrieve behaviour module
238
- if behaviour_module.kind_of?( String )
239
- behaviour_module = behaviour.instance_variable_set(:@module, MobyUtil::KernelHelper.get_constant( behaviour.module ))
240
- end
241
-
242
- # extend target object with behaviour module
243
- rule[ :object ].extend( behaviour_module )
244
-
245
- rescue NameError
246
-
247
- raise NameError, "Implementation for #{ behaviour.name } behaviour does not exist. (#{ behaviour.module })"
248
-
249
- rescue
250
-
251
- raise RuntimeError, "Error while applying #{ behaviour.name } (#{ behaviour.module }) behaviour to target object due to #{ $!.message } (#{ $!.class })"
252
-
253
- end
254
-
255
- # new
256
- #MobyBase::BehaviourFactory::apply_behaviour! 631 2.25980600 2.21837500 3.178% 0.00358131
257
-
258
- # old
259
- #MobyBase::BehaviourFactory::apply_behaviour! 631 2.27668800 2.23749700 3.178% 0.00360806
260
- #MobyBase::BehaviourFactory::apply_behaviour! 631 0.87363100 0.77245300 1.131% 0.00138452
261
- #MobyBase::BehaviourFactory::apply_behaviour! 631 0.51659900 0.48817000 0.720% 0.00081870
262
- #MobyBase::BehaviourFactory::apply_behaviour! 631 0.73310700 0.70426600 1.030% 0.00116182
263
- #MobyBase::BehaviourFactory::apply_behaviour! 631 0.58667000 0.55826300 0.824% 0.00092975
264
-
265
- #=begin
266
- # add behaviour information to test object
267
- rule[ :object ].instance_variable_get( :@object_behaviours ).tap{ | indexes |
268
-
269
- indexes.push( index ) unless indexes.include?( index )
270
-
271
- }
272
- #=end
273
-
274
- # add behaviour information to test object
275
- indexes = rule[ :object ].instance_variable_get( :@object_behaviours )
276
-
277
- indexes.push( index ) unless indexes.include?( index )
278
-
279
- end # if applies.to?
280
-
281
- }
282
- =end
283
-
284
- end
285
-
286
- private
287
-
288
- # private methods and variables
289
- def initialize_class
290
-
291
- # behaviours container
292
- @behaviours = []
293
-
294
- @behaviours_cache = {}
295
-
296
- end
297
-
298
- # load and parse behaviours files
299
- def load_behaviours( path )
300
-
301
- # behaviour xml files path
302
- Dir.glob( File.join( path, '*.xml' ) ){ | filename |
303
-
304
- begin
305
-
306
- # read file contents
307
- content = MobyUtil::FileHelper.get_file( filename )
308
-
309
- # skip when empty file
310
- next if content.empty?
311
-
312
- # parse behaviour xml and process each behaviours element
313
- MobyUtil::XML.parse_string( content ).root.xpath( '/behaviours' ).each do | behaviours |
314
-
315
- # retrieve root attributes
316
- root_attributes = behaviours.attributes
317
-
318
- # process each behaviour element
319
- behaviours.xpath( 'behaviour' ).each do | behaviour |
320
-
321
- # retrieve behaviour attributes - set default values if not found from element
322
- attributes = behaviour.attributes.default_values(
323
- "name" => '',
324
- "object_type" => '',
325
- "input_type" => '',
326
- "sut_type" => '',
327
- "version" => '',
328
- "env" => '*'
329
- )
330
-
331
- # verify that behaviour attributes are not empty
332
- attributes.each_pair do | key, value |
333
-
334
- value.not_empty "behaviour element attribute #{ key.inspect } is not defined or empty", RuntimeError
335
-
336
- end
337
-
338
- # retrieve implementation/module name
339
- module_name = behaviour.at_xpath( 'module/@name' ).to_s
340
-
341
- # verify that module name is defined
342
- module_name.not_empty "behaviour #{ attributes[ "name" ].inspect } does not have module name defined or is empty", RuntimeError
343
-
344
- # store behaviour
345
- #@behaviours << Behaviour.new(
346
-
347
- # store behaviour
348
- @behaviours << { #Behaviour.new(
349
-
350
- "index" => @behaviours.count,
351
-
352
- "name" => attributes[ 'name' ],
353
- "object_type" => attributes[ 'object_type' ].split(';'),
354
- "input_type" => attributes[ 'input_type' ].split(';'),
355
- "version" => attributes[ 'version' ].split(';'),
356
- "env" => attributes[ 'env' ].split(';'),
357
-
358
- "requires" => root_attributes[ 'plugin' ].to_s.split(';'),
359
-
360
- "module" => module_name,
361
- "file" => behaviour.at_xpath( 'module/text()' ).to_s, # optional
362
-
363
- "methods" => Hash[
364
- # collect method details from behaviour
365
- behaviour.xpath( 'methods/method' ).collect{ | method |
366
- [
367
- method.attribute('name'),
368
- {
369
- "description" => method.at_xpath( 'description/text()' ).to_s,
370
- "example" => method.at_xpath( 'example/text()' ).to_s
371
- }
372
- ]
373
- }
374
- ]
375
-
376
- }
377
-
378
- # )
379
-
380
- end # behaviour.each
381
-
382
- end # behaviours.each
383
-
384
- rescue MobyUtil::FileNotFoundError
385
-
386
- raise
387
-
388
- rescue MobyUtil::XML::ParseError
389
-
390
- raise MobyUtil::XML::ParseError, "Error while parsing behaviours file #{ behaviours[ :filename ] } due to #{ $!.message }"
391
-
392
- rescue
393
-
394
- raise RuntimeError, "Error while processing behaviours file #{ filename } due to #{ $!.message }"
395
-
396
- end
397
-
398
- } # Dir.glob
399
-
400
- end # behaviours
401
-
402
- end # self
403
-
404
- # initialize behaviour factory
405
- initialize_class
406
-
407
- end
408
-
409
- end