From 06f51cd6a10a9494795404ae1dea7137c5e22840 Mon Sep 17 00:00:00 2001 From: qth2hi Date: Wed, 4 Oct 2023 17:43:16 +0200 Subject: [PATCH] Added self test cases JPP_0507 , JPP_0508, JPP_0509 based on latest issues Caution: Self test does not run until the issues are not solved! https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/223 https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/224 https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/225 --- test/JPP_TestUsecases.csv | 3 + test/JPP_TestUsecases.html | 121 ++++++++++++++++-- test/JPP_TestUsecases.rst | 32 ++++- test/JPP_TestUsecases.txt | 14 +- test/component_test.py | 4 +- .../test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py | 26 +++- test/testconfig/TestConfig.py | 57 ++++++++- test/testfiles/jpp-test_config_0507.jsonp | 22 ++++ test/testfiles/jpp-test_config_0508.jsonp | 20 +++ test/testfiles/jpp-test_config_0509.jsonp | 23 ++++ 10 files changed, 302 insertions(+), 20 deletions(-) create mode 100644 test/testfiles/jpp-test_config_0507.jsonp create mode 100644 test/testfiles/jpp-test_config_0508.jsonp create mode 100644 test/testfiles/jpp-test_config_0509.jsonp diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index 0ffcf96b..1be07bd2 100644 --- a/test/JPP_TestUsecases.csv +++ b/test/JPP_TestUsecases.csv @@ -41,6 +41,9 @@ JPP_0501|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file with composite data structure JPP_0502|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file with composite data structure (nested lists and dictionaries 3 / some key names with dots inside) JPP_0505|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file with composite strings containing several times a colon and a comma (JSON syntax elements) JPP_0506|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file with composite strings containing several combinations of curly brackets and special characters before +JPP_0507|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several string concatenations in separate lines (1) +JPP_0508|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several string concatenations in separate lines (2) +JPP_0509|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several parameter assignments in separate lines (different syntax) JPP_0550|COMPOSITE_EXPRESSIONS|BADCASE|JSON file with composite data structure (nested lists and dictionaries / some key names with dots inside) JPP_0900|COMMON_SYNTAX_VIOLATIONS|GOODCASE|JSON file with syntax error, that is commented out JPP_0950|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (1) diff --git a/test/JPP_TestUsecases.html b/test/JPP_TestUsecases.html index 42e3616d..0aef25be 100644 --- a/test/JPP_TestUsecases.html +++ b/test/JPP_TestUsecases.html @@ -1407,6 +1407,105 @@ 42 + + + +JPP_0507 + + + + +COMPOSITE_EXPRESSIONS + + + + +GOODCASE + + + + +JSON file containing several string concatenations in separate lines (1)
+Expected: JsonPreprocessor returns expected value + + +
+ + + + + + + +43 + + + + + +JPP_0508 + + + + +COMPOSITE_EXPRESSIONS + + + + +GOODCASE + + + + +JSON file containing several string concatenations in separate lines (2)
+Expected: JsonPreprocessor returns expected value + + +
+ + + + + + + +44 + + + + + +JPP_0509 + + + + +COMPOSITE_EXPRESSIONS + + + + +GOODCASE + + + + +JSON file containing several parameter assignments in separate lines (different syntax)
+Expected: JsonPreprocessor returns expected value + + +
+ + + + + + + +45 + + @@ -1438,7 +1537,7 @@ -43 +46 @@ -1471,7 +1570,7 @@ -44 +47 @@ -1504,7 +1603,7 @@ -45 +48 @@ -1537,7 +1636,7 @@ -46 +49 @@ -1570,7 +1669,7 @@ -47 +50 @@ -1603,7 +1702,7 @@ -48 +51 @@ -1636,7 +1735,7 @@ -49 +52 @@ -1669,7 +1768,7 @@ -50 +53 @@ -1702,7 +1801,7 @@ -51 +54 @@ -1735,7 +1834,7 @@ -52 +55 @@ -1769,7 +1868,7 @@
 

-
Generated: 29.09.2023 - 15:06:38
+
Generated: 04.10.2023 - 17:39:40
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index 2ee51968..728307cc 100644 --- a/test/JPP_TestUsecases.rst +++ b/test/JPP_TestUsecases.rst @@ -465,6 +465,36 @@ Test Use Cases ---- +* **Test JPP_0507** + + [COMPOSITE_EXPRESSIONS / GOODCASE] + + **JSON file containing several string concatenations in separate lines (1)** + + Expected: JsonPreprocessor returns expected value + +---- + +* **Test JPP_0508** + + [COMPOSITE_EXPRESSIONS / GOODCASE] + + **JSON file containing several string concatenations in separate lines (2)** + + Expected: JsonPreprocessor returns expected value + +---- + +* **Test JPP_0509** + + [COMPOSITE_EXPRESSIONS / GOODCASE] + + **JSON file containing several parameter assignments in separate lines (different syntax)** + + Expected: JsonPreprocessor returns expected value + +---- + * **Test JPP_0550** [COMPOSITE_EXPRESSIONS / BADCASE] @@ -579,5 +609,5 @@ Test Use Cases ---- -Generated: 29.09.2023 - 15:06:38 +Generated: 04.10.2023 - 17:39:40 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 55c3f693..c75bd690 100644 --- a/test/JPP_TestUsecases.txt +++ b/test/JPP_TestUsecases.txt @@ -199,6 +199,18 @@ Test JPP_0506 / COMPOSITE_EXPRESSIONS / GOODCASE Description: JSON file with composite strings containing several combinations of curly brackets and special characters before Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ +Test JPP_0507 / COMPOSITE_EXPRESSIONS / GOODCASE +Description: JSON file containing several string concatenations in separate lines (1) +Expectation: JsonPreprocessor returns expected value +------------------------------------------------------------------------------------------------------------------------ +Test JPP_0508 / COMPOSITE_EXPRESSIONS / GOODCASE +Description: JSON file containing several string concatenations in separate lines (2) +Expectation: JsonPreprocessor returns expected value +------------------------------------------------------------------------------------------------------------------------ +Test JPP_0509 / COMPOSITE_EXPRESSIONS / GOODCASE +Description: JSON file containing several parameter assignments in separate lines (different syntax) +Expectation: JsonPreprocessor returns expected value +------------------------------------------------------------------------------------------------------------------------ Test JPP_0550 / COMPOSITE_EXPRESSIONS / BADCASE Description: JSON file with composite data structure (nested lists and dictionaries / some key names with dots inside) Expectation: No values are returned, and JsonPreprocessor throws an exception @@ -245,5 +257,5 @@ Description: Relative path to JSON file Expectation: JsonPreprocessor resolves the relative path and returns values from JSON file Hint.......: Works with raw path to JSON file (path not normalized internally) ------------------------------------------------------------------------------------------------------------------------ -Generated: 29.09.2023 - 15:06:38 +Generated: 04.10.2023 - 17:39:40 diff --git a/test/component_test.py b/test/component_test.py index fcc66d8d..9966a4e6 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,8 +22,8 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.12.0" -VERSION_DATE = "29.09.2023" +VERSION = "0.13.0" +VERSION_DATE = "04.10.2023" # # -------------------------------------------------------------------------------------------------------------- #TM*** diff --git a/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py b/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py index 10c293ce..1c77f1d2 100644 --- a/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py +++ b/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py @@ -18,7 +18,7 @@ # # XC-CT/ECA3-Queckenstedt # -# 28.09.2023 - 11:51:44 +# 04.10.2023 - 17:39:40 # # -------------------------------------------------------------------------------------------------------------- @@ -69,4 +69,28 @@ def test_JPP_0505(self, Description): def test_JPP_0506(self, Description): nReturn = CExecute.Execute("JPP_0506") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: JsonPreprocessor returns expected value + @pytest.mark.parametrize( + "Description", ["JSON file containing several string concatenations in separate lines (1)",] + ) + def test_JPP_0507(self, Description): + nReturn = CExecute.Execute("JPP_0507") + assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: JsonPreprocessor returns expected value + @pytest.mark.parametrize( + "Description", ["JSON file containing several string concatenations in separate lines (2)",] + ) + def test_JPP_0508(self, Description): + nReturn = CExecute.Execute("JPP_0508") + assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: JsonPreprocessor returns expected value + @pytest.mark.parametrize( + "Description", ["JSON file containing several parameter assignments in separate lines (different syntax)",] + ) + def test_JPP_0509(self, Description): + nReturn = CExecute.Execute("JPP_0509") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index 814d1b00..697e96d8 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -# 29.09.2023 +# 04.10.2023 # # !!! Temporarily tests are deactivated by the following line commented out: # # # listofdictUsecases.append(dictUsecase) @@ -1861,6 +1861,55 @@ listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- +dictUsecase = {} +dictUsecase['TESTID'] = "JPP_0507" +dictUsecase['DESCRIPTION'] = "JSON file containing several string concatenations in separate lines (1)" +dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" +dictUsecase['SECTION'] = "COMPOSITE_EXPRESSIONS" +dictUsecase['SUBSECTION'] = "GOODCASE" +dictUsecase['HINT'] = None +dictUsecase['COMMENT'] = None +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0507.jsonp" +dictUsecase['EXPECTEDEXCEPTION'] = None +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (1/1) > {teststring_1} [STR] : 'prefix.teststring_1.value.suffix-1.suffix-2.suffix-3' +""" +listofdictUsecases.append(dictUsecase) +del dictUsecase +# -------------------------------------------------------------------------------------------------------------- +dictUsecase = {} +dictUsecase['TESTID'] = "JPP_0508" +dictUsecase['DESCRIPTION'] = "JSON file containing several string concatenations in separate lines (2)" +dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" +dictUsecase['SECTION'] = "COMPOSITE_EXPRESSIONS" +dictUsecase['SUBSECTION'] = "GOODCASE" +dictUsecase['HINT'] = None +dictUsecase['COMMENT'] = None +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0508.jsonp" +dictUsecase['EXPECTEDEXCEPTION'] = None +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (1/1) > {teststring_1} [STR] : 'teststring_1.value.suffix_1' +""" +listofdictUsecases.append(dictUsecase) +del dictUsecase +# -------------------------------------------------------------------------------------------------------------- +dictUsecase = {} +# can be combined with previous test cases after issue is solved +dictUsecase['TESTID'] = "JPP_0509" +dictUsecase['DESCRIPTION'] = "JSON file containing several parameter assignments in separate lines (different syntax)" +dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" +dictUsecase['SECTION'] = "COMPOSITE_EXPRESSIONS" +dictUsecase['SUBSECTION'] = "GOODCASE" +dictUsecase['HINT'] = None +dictUsecase['COMMENT'] = None +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0509.jsonp" +dictUsecase['EXPECTEDEXCEPTION'] = None +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (1/1) > {teststring} [STR] : 'teststring.value.5' +""" +listofdictUsecases.append(dictUsecase) +del dictUsecase +# -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} dictUsecase['TESTID'] = "JPP_0550" @@ -2036,10 +2085,10 @@ # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} dictUsecase['TESTID'] = "JPP_1200" -# In all other use cases the path 'JSONFILE' is normalized before the JsonPreprocessor is called. +# In all other use cases the path 'JSONFILE' is normalized by the self test (component_test.py) before the JsonPreprocessor is called. # The reference for relative paths is the position of this file. -# In this use case the path 'JSONFILE' is not normalized. -# And the path is relative to the position of the executing script (component_test.py). +# In this use case the path 'JSONFILE' is not normalized by the self test. +# Therefore the path must be relative to the position of the executing script (in this case: component_test.py). dictUsecase['DESCRIPTION'] = "Relative path to JSON file" dictUsecase['EXPECTATION'] = "JsonPreprocessor resolves the relative path and returns values from JSON file" dictUsecase['SECTION'] = "PATH_FORMATS" diff --git a/test/testfiles/jpp-test_config_0507.jsonp b/test/testfiles/jpp-test_config_0507.jsonp new file mode 100644 index 00000000..97775dfb --- /dev/null +++ b/test/testfiles/jpp-test_config_0507.jsonp @@ -0,0 +1,22 @@ +// Copyright 2020-2023 Robert Bosch GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//************************************************************************** +{ + // reference: https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/223 + // + "teststring_1" : "teststring_1.value", + ${teststring_1} : "${teststring_1}.suffix_1", + ${teststring_1} : "${teststring_1}.suffix-2", + ${teststring_1} : "prefix.${teststring_1}.suffix-3" +} diff --git a/test/testfiles/jpp-test_config_0508.jsonp b/test/testfiles/jpp-test_config_0508.jsonp new file mode 100644 index 00000000..b86ccc3f --- /dev/null +++ b/test/testfiles/jpp-test_config_0508.jsonp @@ -0,0 +1,20 @@ +// Copyright 2020-2023 Robert Bosch GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//************************************************************************** +{ + // reference: https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/225 + // + "teststring_1" : "teststring_1.value", + "teststring_1" : "${teststring_1}.suffix_1" +} diff --git a/test/testfiles/jpp-test_config_0509.jsonp b/test/testfiles/jpp-test_config_0509.jsonp new file mode 100644 index 00000000..3c74878c --- /dev/null +++ b/test/testfiles/jpp-test_config_0509.jsonp @@ -0,0 +1,23 @@ +// Copyright 2020-2023 Robert Bosch GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//************************************************************************** +{ + // reference: https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/224 + // + "teststring" : "teststring.value.1", + ${teststring} : "teststring.value.2", + "teststring" : "teststring.value.3", + ${teststring} : "teststring.value.4", + "teststring" : "teststring.value.5" +}