@@ -806,8 +806,57 @@ def open_value(
806806
807807
808808class robot : # noqa: N801
809- """
810- A class containing static methods for registry operations.
809+ """Robot Framework library for Windows Registry operations.
810+
811+ == Table of Contents ==
812+
813+ %TOC%
814+
815+ = Usage =
816+
817+ The library provides a set of keywords for working with the Windows Registry in Robot Framework format.
818+ All methods are static and can be called directly from Robot Framework tests.
819+
820+ | *** Settings ***
821+ | Library winregistry
822+
823+ | *** Test Cases ***
824+ | Check Key Existence
825+ | Registry Key Should Exist HKEY_CURRENT_USER\\ Software\\ MyApp
826+
827+ | Check Registry Value
828+ | ${value}= Read Registry Value HKEY_CURRENT_USER\\ Software\\ MyApp Version
829+ | Should Be Equal ${value.data} 1.0.0
830+
831+ | Create Key And Value
832+ | Create Registry Key HKEY_CURRENT_USER\\ Software\\ MyApp
833+ | Create Registry Value HKEY_CURRENT_USER\\ Software\\ MyApp Version SZ 1.0.0
834+
835+ = Keywords =
836+
837+ == Existence Checks ==
838+
839+ | = Keyword = | = Description = |
840+ | Registry Key Should Exist | Verifies that the specified registry key exists |
841+ | Registry Key Should Not Exist | Verifies that the specified registry key does not exist |
842+ | Registry Value Should Exist | Verifies that the specified registry value exists |
843+ | Registry Value Should Not Exist | Verifies that the specified registry value does not exist |
844+
845+ == Key Management ==
846+
847+ | = Keyword = | = Description = |
848+ | Create Registry Key | Creates a new registry key |
849+ | Delete Registry Key | Deletes the specified registry key |
850+ | Get Registry Key Sub Keys | Returns a list of subkeys for the specified key |
851+ | Get Registry Key Values Names | Returns a list of value names for the specified key |
852+
853+ == Value Management ==
854+
855+ | = Keyword = | = Description = |
856+ | Read Registry Value | Reads a registry value |
857+ | Create Registry Value | Creates a new registry value |
858+ | Set Registry Value | Sets a registry value |
859+ | Delete Registry Value | Deletes a registry value |
811860 """
812861
813862 @staticmethod
@@ -821,7 +870,10 @@ def registry_key_should_exist(
821870 key_name: Name of the key to verify.
822871
823872 Example:
824- | Registry Key Should Exist | HKEY_CURRENT_USER\\ Software\\ MyKey |
873+ | *** Test Cases ***
874+ | Verify Key Exists
875+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
876+ | Registry Key Should Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
825877 """
826878 with open_key (
827879 key_name ,
@@ -842,7 +894,11 @@ def registry_key_should_not_exist(
842894 key_name: Name of the key to verify.
843895
844896 Example:
845- | Registry Key Should Not Exist | HKEY_CURRENT_USER\\ Software\\ MyKey |
897+ | *** Test Cases ***
898+ | Verify Key Does Not Exist
899+ | Registry Key Should Not Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
900+ | ${items}= Get Registry Key Sub Keys HKEY_LOCAL_MACHINE\\ SOFTWARE
901+ | List Should Not Contain Value ${items} _ROBOT_TESTS_
846902 """
847903 try :
848904 cls .registry_key_should_exist (key_name )
@@ -863,7 +919,11 @@ def registry_value_should_exist(
863919 value_name: Name of the value to verify.
864920
865921 Example:
866- | Registry Value Should Exist | HKEY_CURRENT_USER\\ Software | MyValue |
922+ | *** Test Cases ***
923+ | Verify Value Exists
924+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
925+ | Create Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value SZ
926+ | Registry Value Should Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value
867927 """
868928 with open_value (
869929 key_name ,
@@ -886,7 +946,12 @@ def registry_value_should_not_exist(
886946 value_name: Name of the value to verify.
887947
888948 Example:
889- | Registry Value Should Not Exist | HKEY_CURRENT_USER\\ Software | MyValue |
949+ | *** Test Cases ***
950+ | Verify Value Does Not Exist
951+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
952+ | ${items}= Get Registry Key Values Names HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
953+ | List Should Not Contain Value ${items} some_testing_value
954+ | Registry Value Should Not Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value
890955 """
891956 try :
892957 cls .registry_value_should_exist (key_name , value_name )
@@ -905,7 +970,13 @@ def create_registry_key(
905970 key_name: Name of the key to create.
906971
907972 Example:
908- | Create Registry Key | HKEY_CURRENT_USER\\ Software\\ MyNewKey |
973+ | *** Test Cases ***
974+ | Create Key
975+ | Registry Key Should Not Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
976+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
977+ | Registry Key Should Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
978+ | ${items}= Get Registry Key Sub Keys HKEY_LOCAL_MACHINE\\ SOFTWARE
979+ | List Should Contain Value ${items} _ROBOT_TESTS_
909980 """
910981 sub_key_name = None
911982 if "\\ " in key_name :
@@ -934,7 +1005,12 @@ def delete_registry_key(
9341005 recursive: Whether to delete sub keys recursively.
9351006
9361007 Example:
937- | Delete Registry Key | HKEY_CURRENT_USER\\ Software\\ MyKey | recursive=True |
1008+ | *** Test Cases ***
1009+ | Delete Nested Keys
1010+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_\\ FOO\\ BAR\\ BAZ
1011+ | Registry Key Should Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_\\ FOO\\ BAR\\ BAZ
1012+ | Delete Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_\\ FOO\\ BAR\\ BAZ recursive=True
1013+ | Registry Key Should Not Exist HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_\\ FOO\\ BAR\\ BAZ
9381014 """
9391015 key_name , sub_key_name = key_name .rsplit ("\\ " , maxsplit = 1 )
9401016 with open_key (
@@ -958,8 +1034,11 @@ def get_registry_key_sub_keys(
9581034 List of sub key names.
9591035
9601036 Example:
961- | ${sub_keys}= | Get Registry Key Sub Keys | HKEY_CURRENT_USER\\ Software |
962- | Log | ${sub_keys} |
1037+ | *** Test Cases ***
1038+ | Get Sub Keys
1039+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1040+ | ${items}= Get Registry Key Sub Keys HKEY_LOCAL_MACHINE\\ SOFTWARE
1041+ | List Should Contain Value ${items} _ROBOT_TESTS_
9631042 """
9641043 with open_key (
9651044 key_name ,
@@ -982,8 +1061,12 @@ def get_registry_key_values_names(
9821061 List of value names.
9831062
9841063 Example:
985- | ${value_names}= | Get Registry Key Values Names | HKEY_CURRENT_USER\\ Software |
986- | Log | ${value_names} |
1064+ | *** Test Cases ***
1065+ | Get Value Names
1066+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1067+ | Create Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value SZ
1068+ | ${items}= Get Registry Key Values Names HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1069+ | List Should Contain Value ${items} some_testing_value
9871070 """
9881071 with open_key (
9891072 key_name ,
@@ -1007,8 +1090,13 @@ def read_registry_value(
10071090 The registry value.
10081091
10091092 Example:
1010- | ${value}= | Read Registry Value | HKEY_CURRENT_USER\\ Software | MyValue |
1011- | Log | ${value.data} |
1093+ | *** Test Cases ***
1094+ | Read Value
1095+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1096+ | Create Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value SZ
1097+ | Set Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value Remove me!
1098+ | ${value}= Read Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value
1099+ | Should Be Equal ${value.data} Remove me!
10121100 """
10131101 with open_key (
10141102 key_name ,
@@ -1034,7 +1122,12 @@ def create_registry_value(
10341122 data: Data to set.
10351123
10361124 Example:
1037- | Create Registry Value | HKEY_CURRENT_USER\\ Software | MyValue | SZ | MyData |
1125+ | *** Test Cases ***
1126+ | Create Empty Value
1127+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1128+ | Create Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value SZ
1129+ | ${value}= Read Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value
1130+ | Should Be Equal ${value.data} ${EMPTY}
10381131 """
10391132 with open_key (
10401133 key_name ,
@@ -1058,7 +1151,13 @@ def set_registry_value(
10581151 data: Data to set.
10591152
10601153 Example:
1061- | Set Registry Value | HKEY_CURRENT_USER\\ Software | MyValue | NewData |
1154+ | *** Test Cases ***
1155+ | Set Value
1156+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1157+ | Create Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value SZ
1158+ | Set Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value Remove me!
1159+ | ${value}= Read Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value
1160+ | Should Be Equal ${value.data} Remove me!
10621161 """
10631162 with open_value (
10641163 key_name ,
@@ -1081,7 +1180,14 @@ def delete_registry_value(
10811180 value_name: Name of the value to delete.
10821181
10831182 Example:
1084- | Delete Registry Value | HKEY_CURRENT_USER\\ Software | MyValue |
1183+ | *** Test Cases ***
1184+ | Delete Value
1185+ | Create Registry Key HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1186+ | Create Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value SZ
1187+ | Set Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value Remove me!
1188+ | Delete Registry Value HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_ some_testing_value
1189+ | ${items}= Get Registry Key Values Names HKEY_LOCAL_MACHINE\\ SOFTWARE\\ _ROBOT_TESTS_
1190+ | List Should Not Contain Value ${items} some_testing_value
10851191 """
10861192 with open_key (
10871193 key_name ,
0 commit comments