Skip to content

Commit e14b6f9

Browse files
Merge pull request #160 from test-fullautomation/HolQue/task/selftest_and_documentation_extensions
Extended self test JPP_1000; added self test JPP_1001
2 parents 7c11746 + dc266f9 commit e14b6f9

File tree

10 files changed

+134
-23
lines changed

10 files changed

+134
-23
lines changed

test/JPP_TestUsecases.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ JPP_0952|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (3)
5252
JPP_0953|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (4): file is completely empty
5353
JPP_0954|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (5): file is empty (multiple pairs of brackets only)
5454
JPP_1000|IMPLICIT_CREATION|GOODCASE|JSON file with dictionary keys to be created implicitly
55+
JPP_1001|IMPLICIT_CREATION|GOODCASE|JSON file with dictionary keys to be created implicitly (same key names at all levels)
5556
JPP_1150|CYCLIC_IMPORTS|BADCASE|JSON file with cyclic imports (JSON file imports itself)
5657
JPP_1151|CYCLIC_IMPORTS|BADCASE|JSON file with cyclic imports (JSON file imports another file, that is already imported)
5758
JPP_1200|PATH_FORMATS|GOODCASE|Relative path to JSON file

test/JPP_TestUsecases.html

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,6 +1771,39 @@
17711771
53
17721772
</b></font></td>
17731773

1774+
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
1775+
<font size="2" face="Arial" color="#595959">
1776+
<b>
1777+
<a target="_blank" href="https://github.com/test-fullautomation/python-jsonpreprocessor/blob/develop/test/testfiles/jpp-test_config_1001.jsonp">JPP_1001</a>
1778+
</b></font></td>
1779+
1780+
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
1781+
<font size="2" face="Arial" color="#4169E1">
1782+
IMPLICIT_CREATION
1783+
</font></td>
1784+
1785+
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
1786+
<font size="2" face="Arial" color="#008000">
1787+
GOODCASE
1788+
</font></td>
1789+
1790+
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="left">
1791+
<font size="2" face="Arial" color="#595959"><i>
1792+
<b>JSON file with dictionary keys to be created implicitly (same key names at all levels)</b><br>
1793+
Expected: JsonPreprocessor returns values
1794+
1795+
1796+
</i></font></td>
1797+
1798+
1799+
</tr>
1800+
<tr valign="middle" align="left">
1801+
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
1802+
<font size="2" face="Arial" color="#FF0000">
1803+
<b>
1804+
54
1805+
</b></font></td>
1806+
17741807
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
17751808
<font size="2" face="Arial" color="#595959">
17761809
<b>
@@ -1801,7 +1834,7 @@
18011834
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
18021835
<font size="2" face="Arial" color="#FF0000">
18031836
<b>
1804-
54
1837+
55
18051838
</b></font></td>
18061839

18071840
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="middle">
@@ -1834,7 +1867,7 @@
18341867
<td colspan="1" valign="center" bgcolor="#F5F5F5" align="right">
18351868
<font size="2" face="Arial" color="#FF0000">
18361869
<b>
1837-
55
1870+
56
18381871
</b></font></td>
18391872

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

test/JPP_TestUsecases.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,16 @@ Test Use Cases
577577

578578
----
579579

580+
* **Test JPP_1001**
581+
582+
[IMPLICIT_CREATION / GOODCASE]
583+
584+
**JSON file with dictionary keys to be created implicitly (same key names at all levels)**
585+
586+
Expected: JsonPreprocessor returns values
587+
588+
----
589+
580590
* **Test JPP_1150**
581591

582592
[CYCLIC_IMPORTS / BADCASE]
@@ -609,5 +619,5 @@ Test Use Cases
609619

610620
----
611621

612-
Generated: 04.10.2023 - 17:39:40
622+
Generated: 05.10.2023 - 14:27:01
613623

test/JPP_TestUsecases.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ Test JPP_1000 / IMPLICIT_CREATION / GOODCASE
244244
Description: JSON file with dictionary keys to be created implicitly
245245
Expectation: JsonPreprocessor returns values
246246
------------------------------------------------------------------------------------------------------------------------
247+
Test JPP_1001 / IMPLICIT_CREATION / GOODCASE
248+
Description: JSON file with dictionary keys to be created implicitly (same key names at all levels)
249+
Expectation: JsonPreprocessor returns values
250+
------------------------------------------------------------------------------------------------------------------------
247251
Test JPP_1150 / CYCLIC_IMPORTS / BADCASE
248252
Description: JSON file with cyclic imports (JSON file imports itself)
249253
Expectation: No values are returned, and JsonPreprocessor throws an exception
@@ -257,5 +261,5 @@ Description: Relative path to JSON file
257261
Expectation: JsonPreprocessor resolves the relative path and returns values from JSON file
258262
Hint.......: Works with raw path to JSON file (path not normalized internally)
259263
------------------------------------------------------------------------------------------------------------------------
260-
Generated: 04.10.2023 - 17:39:40
264+
Generated: 05.10.2023 - 14:27:01
261265

test/component_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#
2323
# --------------------------------------------------------------------------------------------------------------
2424
#
25-
VERSION = "0.13.0"
26-
VERSION_DATE = "04.10.2023"
25+
VERSION = "0.14.0"
26+
VERSION_DATE = "05.10.2023"
2727
#
2828
# --------------------------------------------------------------------------------------------------------------
2929
#TM***

test/pytest/pytestfiles/test_11_IMPLICIT_CREATION_GOODCASE.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#
1919
# XC-CT/ECA3-Queckenstedt
2020
#
21-
# 13.09.2023 - 10:58:36
21+
# 05.10.2023 - 14:27:02
2222
#
2323
# --------------------------------------------------------------------------------------------------------------
2424

@@ -37,4 +37,12 @@ class Test_IMPLICIT_CREATION_GOODCASE:
3737
def test_JPP_1000(self, Description):
3838
nReturn = CExecute.Execute("JPP_1000")
3939
assert nReturn == 0
40+
# --------------------------------------------------------------------------------------------------------------
41+
# Expected: JsonPreprocessor returns values
42+
@pytest.mark.parametrize(
43+
"Description", ["JSON file with dictionary keys to be created implicitly (same key names at all levels)",]
44+
)
45+
def test_JPP_1001(self, Description):
46+
nReturn = CExecute.Execute("JPP_1001")
47+
assert nReturn == 0
4048
# --------------------------------------------------------------------------------------------------------------

test/testconfig/TestConfig.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#
2323
# --------------------------------------------------------------------------------------------------------------
2424
#
25-
# 04.10.2023
25+
# 05.10.2023
2626
#
2727
# !!! Temporarily tests are deactivated by the following line commented out:
2828
# # # listofdictUsecases.append(dictUsecase)
@@ -2039,16 +2039,36 @@
20392039
dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1000.jsonp"
20402040
dictUsecase['EXPECTEDEXCEPTION'] = None
20412041
dictUsecase['EXPECTEDRETURN'] = """
2042-
[DICT] (2/1) > {dTestDict} [DICT] (4/1) > {kVal_1} [STR] : 'Val_1'
2043-
[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'
2044-
[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'
2045-
[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
2046-
[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
2047-
[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
2048-
[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
2049-
[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
2050-
[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
2051-
[DICT] (2/2) > {Val_1} [STR] : 'Val_1'
2042+
[DICT] (2/1) > {dTestDict} [DICT] (5/1) > {kVal_1} [STR] : 'Val_1'
2043+
[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'
2044+
[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'
2045+
[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'
2046+
[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
2047+
[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
2048+
[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
2049+
[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
2050+
[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
2051+
[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
2052+
[DICT] (2/2) > {Val_1_extended} [STR] : 'Val_1'
2053+
"""
2054+
listofdictUsecases.append(dictUsecase)
2055+
del dictUsecase
2056+
# --------------------------------------------------------------------------------------------------------------
2057+
dictUsecase = {}
2058+
dictUsecase['TESTID'] = "JPP_1001"
2059+
dictUsecase['DESCRIPTION'] = "JSON file with dictionary keys to be created implicitly (same key names at all levels)"
2060+
dictUsecase['EXPECTATION'] = "JsonPreprocessor returns values"
2061+
dictUsecase['SECTION'] = "IMPLICIT_CREATION"
2062+
dictUsecase['SUBSECTION'] = "GOODCASE"
2063+
dictUsecase['HINT'] = None
2064+
dictUsecase['COMMENT'] = None
2065+
dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_1001.jsonp"
2066+
dictUsecase['EXPECTEDEXCEPTION'] = None
2067+
dictUsecase['EXPECTEDRETURN'] = """
2068+
[DICT] (3/1) > {param1} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [STR] : 'subkey value'
2069+
[DICT] (3/2) > {param2} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [STR] : 'subkey value extended'
2070+
[DICT] (3/3) > {param3} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (2/1) > {paramA} [STR] : 'subkey value extended'
2071+
[DICT] (3/3) > {param3} [DICT] (1/1) > {subkey} [DICT] (1/1) > {subkey} [DICT] (2/2) > {paramB} [STR] : 'subkey value extended'
20522072
"""
20532073
listofdictUsecases.append(dictUsecase)
20542074
del dictUsecase

test/testfiles/import/import.1/jpp-test_config_implicit_creation.1.1.jsonp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
{
1717
${dTestDict}['kVal_2']['I-am-not-existing-1']['I-am-not-existing-2'] : ${dTestDict}['kVal_1'],
18+
// use what has been created implicitly before
19+
${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'],
20+
${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},
1821
// overwrite what has been created implicitly before:
19-
${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'],
20-
"[import]" : "./import.1.1/jpp-test_config_implicit_creation.1.1.1.jsonp"
22+
${dTestDict}['kVal_3']['I-am-not-existing-3']['I-am-not-existing-4'] : "${dTestDict}['kVal_1']_extended",
23+
// further assignments
24+
"[import]" : "./import.1.1/jpp-test_config_implicit_creation.1.1.1.jsonp"
2125
}

test/testfiles/jpp-test_config_0508.jsonp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// limitations under the License.
1414
//**************************************************************************
1515
{
16-
// reference: https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/225
17-
//
1816
"teststring_1" : "teststring_1.value",
1917
"teststring_1" : "${teststring_1}.suffix_1"
2018
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2020-2023 Robert Bosch GmbH
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//**************************************************************************
15+
16+
{
17+
"param1" : {},
18+
${param1}['subkey']['subkey']['subkey'] : "subkey value",
19+
"param2" : {},
20+
${param2.subkey.subkey.subkey} : "${param1.subkey.subkey.subkey} extended",
21+
"param3" : {
22+
"subkey" : {
23+
"subkey" : {
24+
"paramA" : "ABC",
25+
${param3.subkey.subkey.paramA} : "DEF",
26+
// https://github.com/test-fullautomation/robotframework-testsuitesmanagement/issues/224
27+
"paramA" : ${param2.subkey.subkey.subkey},
28+
"paramB" : "XYZ",
29+
${param3.subkey.subkey.paramB} : ${param2.subkey.subkey.subkey}
30+
}
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)