Loading README.md +22 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ specification of the ETSI NGSI-LD API. - [Install IDE (PyCharm)](#install-ide-pycharm) - [Install IDE (PyCharm)](#install-ide-pycharm) - [Run configurations (PyCharm)](#run-configurations-pycharm) - [Run configurations (PyCharm)](#run-configurations-pycharm) - [Pre commit](#pre-commit) - [Pre commit](#pre-commit) - [Tooling](#tooling) - [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project) - [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project) - [Useful links](#useful-links) - [Useful links](#useful-links) - [LICENSE](#license) - [LICENSE](#license) Loading Loading @@ -185,6 +186,27 @@ To manually launch the tool, the following command can be used: Further details can be found on the [pre-commit](https://pre-commit.com) site. Further details can be found on the [pre-commit](https://pre-commit.com) site. ## Tooling ### Find unused test data files The `find_unused_test_data.py` script in the `scripts` directory can be used to get a list of the test data files that are not used by any Test Case: ``` python3 scripts/find_unused_test_data.py ``` ### Find and run Test Cases using a given test data file The `find_tc_using_test_data.py` script in the `scripts` directory can be used to find the Test Cases that are using a given test data file. It can optionally run all the matching Test Cases: ``` python3 scripts/find_tc_using_test_data.py ``` When launched, the script asks for a test date file name and if the matching Test Cases should be executed. ## Frameworks and libraries used in the project ## Frameworks and libraries used in the project Loading scripts/find_tc_using_test_data.py 0 → 100644 +20 −0 Original line number Original line Diff line number Diff line import os import robot def find_test_data_in_tc(dir, filename, run_matching_tc): for file in os.listdir(dir): path = dir + "/" + file if os.path.isdir(path): find_test_data_in_tc(path, filename, run_matching_tc) else: if filename in open(path).read(): if run_matching_tc == "Y": robot.run(path) print(path) if __name__ == '__main__': test_data_file = input("Name of test data file to search for: ") run_matching_tc = input("Run matching Test Cases (Y/N)?: ") find_test_data_in_tc("TP", test_data_file, run_matching_tc) scripts/find_unused_test_data.py 0 → 100644 +23 −0 Original line number Original line Diff line number Diff line import os def list_files_in_dir(dirname): for fname in os.listdir(dirname): if os.path.isfile(dirname + "/" + fname): print("Looking at test data file: ", fname) find_test_data_in_tc("TP", fname) else: list_files_in_dir(dirname + "/" + fname) def find_test_data_in_tc(dir, filename): for file in os.listdir(dir): path = dir + "/" + file if os.path.isdir(path): find_test_data_in_tc(path, filename) else: if filename in open(path).read(): print("Found usage of", filename, "in", path) list_files_in_dir("data") Loading
README.md +22 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ specification of the ETSI NGSI-LD API. - [Install IDE (PyCharm)](#install-ide-pycharm) - [Install IDE (PyCharm)](#install-ide-pycharm) - [Run configurations (PyCharm)](#run-configurations-pycharm) - [Run configurations (PyCharm)](#run-configurations-pycharm) - [Pre commit](#pre-commit) - [Pre commit](#pre-commit) - [Tooling](#tooling) - [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project) - [Frameworks and libraries used in the project](#frameworks-and-libraries-used-in-the-project) - [Useful links](#useful-links) - [Useful links](#useful-links) - [LICENSE](#license) - [LICENSE](#license) Loading Loading @@ -185,6 +186,27 @@ To manually launch the tool, the following command can be used: Further details can be found on the [pre-commit](https://pre-commit.com) site. Further details can be found on the [pre-commit](https://pre-commit.com) site. ## Tooling ### Find unused test data files The `find_unused_test_data.py` script in the `scripts` directory can be used to get a list of the test data files that are not used by any Test Case: ``` python3 scripts/find_unused_test_data.py ``` ### Find and run Test Cases using a given test data file The `find_tc_using_test_data.py` script in the `scripts` directory can be used to find the Test Cases that are using a given test data file. It can optionally run all the matching Test Cases: ``` python3 scripts/find_tc_using_test_data.py ``` When launched, the script asks for a test date file name and if the matching Test Cases should be executed. ## Frameworks and libraries used in the project ## Frameworks and libraries used in the project Loading
scripts/find_tc_using_test_data.py 0 → 100644 +20 −0 Original line number Original line Diff line number Diff line import os import robot def find_test_data_in_tc(dir, filename, run_matching_tc): for file in os.listdir(dir): path = dir + "/" + file if os.path.isdir(path): find_test_data_in_tc(path, filename, run_matching_tc) else: if filename in open(path).read(): if run_matching_tc == "Y": robot.run(path) print(path) if __name__ == '__main__': test_data_file = input("Name of test data file to search for: ") run_matching_tc = input("Run matching Test Cases (Y/N)?: ") find_test_data_in_tc("TP", test_data_file, run_matching_tc)
scripts/find_unused_test_data.py 0 → 100644 +23 −0 Original line number Original line Diff line number Diff line import os def list_files_in_dir(dirname): for fname in os.listdir(dirname): if os.path.isfile(dirname + "/" + fname): print("Looking at test data file: ", fname) find_test_data_in_tc("TP", fname) else: list_files_in_dir(dirname + "/" + fname) def find_test_data_in_tc(dir, filename): for file in os.listdir(dir): path = dir + "/" + file if os.path.isdir(path): find_test_data_in_tc(path, filename) else: if filename in open(path).read(): print("Found usage of", filename, "in", path) list_files_in_dir("data")