@@ -20,13 +20,44 @@ Verification Templates
2020The sections below are seen as typical ways when writing tests and their specification.
2121Their usage differs based on the selected testing framework and the implementation language of the module(s).
2222
23- gTest
24- -----
23+ C++
24+ ---
2525
26- gTest is a commonly used and accepted test framework to write test cases for C/C++ code.
26+ For C++ code gTest is a commonly used and accepted test framework to write test cases for C/C++ code.
2727
2828Each test case requires a link to one or more requirement/design element.
29- A more detailed description of how to link code to requirements is available here: :need: `gd_req__verification_link_tests_cpp `
29+
30+ For linking C++ tests to requirements **record properties ** shall be used. Attributes
31+ which are common for all test cases can be specified in the Setup Function (SetUp()), the other
32+ attributes which are specific for each test case need to be specified within the test case:
33+
34+ Below code is exemplary and can be used as a template when writing test cases.
35+
36+ .. _verification_template_cpp :
37+
38+ C++ Properties Template
39+ ^^^^^^^^^^^^^^^^^^^^^^^
40+
41+ .. code-block :: cpp
42+
43+ class TestSuite : public ::testing::Test{
44+ public:
45+ void SetUp() override
46+ {
47+ RecordProperty("TestType", "<TestType>");
48+ RecordProperty("DerivationTechnique", "<DerivationTechnique>");
49+ ...
50+ }
51+ };
52+
53+ TEST_F(TestSuite, <Test Case>)
54+ {
55+ RecordProperty("PartiallyVerifies", "ID_2, ID_3, ...");
56+ RecordProperty("FullyVerifies", "ID_4, ID_5, ...");
57+ RecordProperty("Description", "<Description>");
58+
59+ ASSERT ...
60+ }
3061
3162 When writing test cases using gTest, they shall follow the recommendations from the official gTest documentation.
3263For very basic start follow http://google.github.io/googletest/primer.html
@@ -41,7 +72,29 @@ Details on the definition an the test organization in rust can be found here:
4172https://doc.rust-lang.org/book/ch11-03-test-organization.html
4273
4374Each test case requires a link to one or more requirement/design element.
44- A more detailed description of how to link code to requirements is available here: :need: `gd_req__verification_link_tests_rust `
75+
76+ Below code is exemplary and can be used as a template when writing test cases.
77+
78+ .. _verification_template_rust :
79+
80+ Rust Properties Template
81+ ^^^^^^^^^^^^^^^^^^^^^^^^
82+
83+ For linking Rust tests to requirements **#[record_property] ** shall be used:
84+
85+ .. code-block :: rust
86+
87+ use test_properties::record_property;
88+
89+ #[record_property("PartiallyVerifies", "ID_2, ID_3, ...")]
90+ #[record_property("FullyVerifies", "ID_4, ID_5, ...")]
91+ #[record_property("Description", "<Description>")]
92+ #[record_property("TestType", "<TestType>")]
93+ #[record_property("DerivationTechnique", "<DerivationTechnique>")]
94+ #[test]
95+ fn test_case_function() {
96+ ...
97+ }
4598
4699 When writing test cases in rust, they shall follow the recommendations from the official rust documentation.
47100https://doc.rust-lang.org/book/ch11-01-writing-tests.html
@@ -54,7 +107,28 @@ When writing test cases in python, this should be done using pytest.
54107Note that python unittest does not support metatags and therefore should not be considered as test framework.
55108
56109Each test case requires a link to one or more requirement/design element.
57- A more detailed description of how to link code to requirements is available here: :need: `gd_req__verification_link_tests_python `
110+
111+ For linking python tests to requirements **metadata ** shall be used.
112+
113+ For allowed values for test_type & derivation_technique please check :need: `gd_req__verification_link_tests `
114+
115+ Below code is exemplary and can be used as a template when writing test cases.
116+
117+ .. _verification_template_python :
118+
119+ Python Properties Template
120+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
121+
122+ .. code-block :: python
123+
124+ @add_test_properties (
125+ partially_verifies = [" tool_req__docs_dd_link_source_code_link" ],
126+ test_type = " requirements-based" ,
127+ derivation_technique = " requirements-analysis" ,
128+ )
129+ def test_group_by_need_empty_list ():
130+ """ Test grouping empty list of needlinks."""
131+ ...
58132
59133 When writing test cases in python, they shall follow the recommendations from the official python and community documentation.
60134https://docs.python-guide.org/writing/tests/
0 commit comments