Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/JPP_TestUsecases.csv
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ JPP_0952|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (3)
JPP_0953|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (4): file is completely empty
JPP_0954|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (5): file is empty (multiple pairs of brackets only)
JPP_1000|IMPLICIT_CREATION|GOODCASE|JSON file with dictionary keys to be created implicitly
JPP_1001|IMPLICIT_CREATION|GOODCASE|JSON file with dictionary keys to be created implicitly (same key names at all levels)
JPP_1150|CYCLIC_IMPORTS|BADCASE|JSON file with cyclic imports (JSON file imports itself)
JPP_1151|CYCLIC_IMPORTS|BADCASE|JSON file with cyclic imports (JSON file imports another file, that is already imported)
JPP_1200|PATH_FORMATS|GOODCASE|Relative path to JSON file
39 changes: 36 additions & 3 deletions test/JPP_TestUsecases.html
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,39 @@
53
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#595959">
<b>
<a target="_blank" href="https://github.com/test-fullautomation/python-jsonpreprocessor/blob/develop/test/testfiles/jpp-test_config_1001.jsonp">JPP_1001</a>
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#4169E1">
IMPLICIT_CREATION
</font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#008000">
GOODCASE
</font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="left">
<font size="2" face="Arial" color="#595959"><i>
<b>JSON file with dictionary keys to be created implicitly (same key names at all levels)</b><br>
Expected: JsonPreprocessor returns values


</i></font></td>


</tr>
<tr valign="middle" align="left">
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
<font size="2" face="Arial" color="#FF0000">
<b>
54
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
<font size="2" face="Arial" color="#595959">
<b>
Expand Down Expand Up @@ -1801,7 +1834,7 @@
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
<font size="2" face="Arial" color="#FF0000">
<b>
54
55
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
Expand Down Expand Up @@ -1834,7 +1867,7 @@
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
<font size="2" face="Arial" color="#FF0000">
<b>
55
56
</b></font></td>

<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
Expand Down Expand Up @@ -1868,7 +1901,7 @@
</tbody></table></div>
<div>&nbsp;</div>
<hr width="100%" color="#FF8C00" align="center">
<div align="center"><font size="2" color="#27408B">Generated: 04.10.2023 - 17:39:40</font></div>
<div align="center"><font size="2" color="#27408B">Generated: 05.10.2023 - 14:27:01</font></div>
<div>&nbsp;</div>
</body></html>

12 changes: 11 additions & 1 deletion test/JPP_TestUsecases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,16 @@ Test Use Cases

----

* **Test JPP_1001**

[IMPLICIT_CREATION / GOODCASE]

**JSON file with dictionary keys to be created implicitly (same key names at all levels)**

Expected: JsonPreprocessor returns values

----

* **Test JPP_1150**

[CYCLIC_IMPORTS / BADCASE]
Expand Down Expand Up @@ -609,5 +619,5 @@ Test Use Cases

----

Generated: 04.10.2023 - 17:39:40
Generated: 05.10.2023 - 14:27:01

6 changes: 5 additions & 1 deletion test/JPP_TestUsecases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ Test JPP_1000 / IMPLICIT_CREATION / GOODCASE
Description: JSON file with dictionary keys to be created implicitly
Expectation: JsonPreprocessor returns values
------------------------------------------------------------------------------------------------------------------------
Test JPP_1001 / IMPLICIT_CREATION / GOODCASE
Description: JSON file with dictionary keys to be created implicitly (same key names at all levels)
Expectation: JsonPreprocessor returns values
------------------------------------------------------------------------------------------------------------------------
Test JPP_1150 / CYCLIC_IMPORTS / BADCASE
Description: JSON file with cyclic imports (JSON file imports itself)
Expectation: No values are returned, and JsonPreprocessor throws an exception
Expand All @@ -257,5 +261,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: 04.10.2023 - 17:39:40
Generated: 05.10.2023 - 14:27:01

4 changes: 2 additions & 2 deletions test/component_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#
# --------------------------------------------------------------------------------------------------------------
#
VERSION = "0.13.0"
VERSION_DATE = "04.10.2023"
VERSION = "0.14.0"
VERSION_DATE = "05.10.2023"
#
# --------------------------------------------------------------------------------------------------------------
#TM***
Expand Down
10 changes: 9 additions & 1 deletion test/pytest/pytestfiles/test_11_IMPLICIT_CREATION_GOODCASE.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# XC-CT/ECA3-Queckenstedt
#
# 13.09.2023 - 10:58:36
# 05.10.2023 - 14:27:02
#
# --------------------------------------------------------------------------------------------------------------

Expand All @@ -37,4 +37,12 @@ class Test_IMPLICIT_CREATION_GOODCASE:
def test_JPP_1000(self, Description):
nReturn = CExecute.Execute("JPP_1000")
assert nReturn == 0
# --------------------------------------------------------------------------------------------------------------
# Expected: JsonPreprocessor returns values
@pytest.mark.parametrize(
"Description", ["JSON file with dictionary keys to be created implicitly (same key names at all levels)",]
)
def test_JPP_1001(self, Description):
nReturn = CExecute.Execute("JPP_1001")
assert nReturn == 0
# --------------------------------------------------------------------------------------------------------------
42 changes: 31 additions & 11 deletions test/testconfig/TestConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#
# --------------------------------------------------------------------------------------------------------------
#
# 04.10.2023
# 05.10.2023
#
# !!! Temporarily tests are deactivated by the following line commented out:
# # # listofdictUsecases.append(dictUsecase)
Expand Down Expand Up @@ -2039,16 +2039,36 @@
dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1000.jsonp"
dictUsecase['EXPECTEDEXCEPTION'] = None
dictUsecase['EXPECTEDRETURN'] = """
[DICT] (2/1) > {dTestDict} [DICT] (4/1) > {kVal_1} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (4/2) > {kVal_2} [DICT] (1/1) > {I-am-not-existing-1} [DICT] (1/1) > {I-am-not-existing-2} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (4/3) > {kVal_3} [DICT] (1/1) > {I-am-not-existing-3} [DICT] (1/1) > {I-am-not-existing-4} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (4/4) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/1) > {A} [INT] : 1
[DICT] (2/1) > {dTestDict} [DICT] (4/4) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/2) > {B} [LIST] (2/1) > [INT] : 1
[DICT] (2/1) > {dTestDict} [DICT] (4/4) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/2) > {B} [LIST] (2/2) > [INT] : 2
[DICT] (2/1) > {dTestDict} [DICT] (4/4) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/3) > {kVal_4D} [DICT] (1/1) > {kVal_4E} [DICT] (1/1) > {kVal_4F} [DICT] (1/1) > {kVal_4G} [DICT] (2/1) > {C} [INT] : 2
[DICT] (2/1) > {dTestDict} [DICT] (4/4) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/3) > {kVal_4D} [DICT] (1/1) > {kVal_4E} [DICT] (1/1) > {kVal_4F} [DICT] (1/1) > {kVal_4G} [DICT] (2/2) > {D} [LIST] (2/1) > [INT] : 3
[DICT] (2/1) > {dTestDict} [DICT] (4/4) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/3) > {kVal_4D} [DICT] (1/1) > {kVal_4E} [DICT] (1/1) > {kVal_4F} [DICT] (1/1) > {kVal_4G} [DICT] (2/2) > {D} [LIST] (2/2) > [INT] : 4
[DICT] (2/2) > {Val_1} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (5/1) > {kVal_1} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (5/2) > {kVal_2} [DICT] (1/1) > {I-am-not-existing-1} [DICT] (1/1) > {I-am-not-existing-2} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (5/3) > {kVal_3} [DICT] (1/1) > {I-am-not-existing-3} [DICT] (1/1) > {I-am-not-existing-4} [STR] : 'Val_1_extended'
[DICT] (2/1) > {dTestDict} [DICT] (5/4) > {kVal_3b} [DICT] (1/1) > {I-am-not-existing-3b} [DICT] (1/1) > {I-am-not-existing-4b} [STR] : 'Val_1'
[DICT] (2/1) > {dTestDict} [DICT] (5/5) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/1) > {A} [INT] : 1
[DICT] (2/1) > {dTestDict} [DICT] (5/5) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/2) > {B} [LIST] (2/1) > [INT] : 1
[DICT] (2/1) > {dTestDict} [DICT] (5/5) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/2) > {B} [LIST] (2/2) > [INT] : 2
[DICT] (2/1) > {dTestDict} [DICT] (5/5) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/3) > {kVal_4D} [DICT] (1/1) > {kVal_4E} [DICT] (1/1) > {kVal_4F} [DICT] (1/1) > {kVal_4G} [DICT] (2/1) > {C} [INT] : 2
[DICT] (2/1) > {dTestDict} [DICT] (5/5) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/3) > {kVal_4D} [DICT] (1/1) > {kVal_4E} [DICT] (1/1) > {kVal_4F} [DICT] (1/1) > {kVal_4G} [DICT] (2/2) > {D} [LIST] (2/1) > [INT] : 3
[DICT] (2/1) > {dTestDict} [DICT] (5/5) > {kVal_4} [DICT] (1/1) > {kVal_4B} [DICT] (1/1) > {kVal_4C} [DICT] (3/3) > {kVal_4D} [DICT] (1/1) > {kVal_4E} [DICT] (1/1) > {kVal_4F} [DICT] (1/1) > {kVal_4G} [DICT] (2/2) > {D} [LIST] (2/2) > [INT] : 4
[DICT] (2/2) > {Val_1_extended} [STR] : 'Val_1'
"""
listofdictUsecases.append(dictUsecase)
del dictUsecase
# --------------------------------------------------------------------------------------------------------------
dictUsecase = {}
dictUsecase['TESTID'] = "JPP_1001"
dictUsecase['DESCRIPTION'] = "JSON file with dictionary keys to be created implicitly (same key names at all levels)"
dictUsecase['EXPECTATION'] = "JsonPreprocessor returns values"
dictUsecase['SECTION'] = "IMPLICIT_CREATION"
dictUsecase['SUBSECTION'] = "GOODCASE"
dictUsecase['HINT'] = None
dictUsecase['COMMENT'] = None
dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1001.jsonp"
dictUsecase['EXPECTEDEXCEPTION'] = None
dictUsecase['EXPECTEDRETURN'] = """
[DICT] (3/1) > {param1} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [STR] : 'subkey value'
[DICT] (3/2) > {param2} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [STR] : 'subkey value extended'
[DICT] (3/3) > {param3} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (2/1) > {paramA} [STR] : 'subkey value extended'
[DICT] (3/3) > {param3} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (2/2) > {paramB} [STR] : 'subkey value extended'
"""
listofdictUsecases.append(dictUsecase)
del dictUsecase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

{
${dTestDict}['kVal_2']['I-am-not-existing-1']['I-am-not-existing-2'] : ${dTestDict}['kVal_1'],
// use what has been created implicitly before
${dTestDict.kVal_3.I-am-not-existing-3.I-am-not-existing-4} : ${dTestDict}['kVal_2']['I-am-not-existing-1']['I-am-not-existing-2'],
${dTestDict.kVal_3b.I-am-not-existing-3b.I-am-not-existing-4b} : ${dTestDict.kVal_2.I-am-not-existing-1.I-am-not-existing-2},
// overwrite what has been created implicitly before:
${dTestDict.kVal_3.I-am-not-existing-3.I-am-not-existing-4} : ${dTestDict}['kVal_2']['I-am-not-existing-1']['I-am-not-existing-2'],
"[import]" : "./import.1.1/jpp-test_config_implicit_creation.1.1.1.jsonp"
${dTestDict}['kVal_3']['I-am-not-existing-3']['I-am-not-existing-4'] : "${dTestDict}['kVal_1']_extended",
// further assignments
"[import]" : "./import.1.1/jpp-test_config_implicit_creation.1.1.1.jsonp"
}
2 changes: 0 additions & 2 deletions test/testfiles/jpp-test_config_0508.jsonp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
// 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"
}
33 changes: 33 additions & 0 deletions test/testfiles/jpp-test_config_1001.jsonp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// 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.
//**************************************************************************

{
"param1" : {},
${param1}['subkey']['subkey']['subkey'] : "subkey value",
"param2" : {},
${param2.subkey.subkey.subkey} : "${param1.subkey.subkey.subkey} extended",
"param3" : {
"subkey" : {
"subkey" : {
"paramA" : "ABC",
${param3.subkey.subkey.paramA} : "DEF",
// https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/224
"paramA" : ${param2.subkey.subkey.subkey},
"paramB" : "XYZ",
${param3.subkey.subkey.paramB} : ${param2.subkey.subkey.subkey}
}
}
}
}