The dos and don'ts when testing
-
You need a test suite in order to execute →unit tests. The test suite in Excel format makes it simpler to modify the test suite. See "Structure of the Excel test suite, modifying the worksheets" for details.
-
Examples for test cases are provided under: Examples for tests
-
See "Restrictions when using the test frameworks" for a collection of all known restrictions regarding the test framework.
-
If you are using a division within a POU under test (e.g. the statement
X := Y / (A-B)
within an ST-code), create an additional test sequence within the test case. Within this test sequence, specify test data leading to a division by zero. If you execute an SiL-test with coverage but without this test sequence, there are branches which will not be covered. -
When creating/opening a test project in a variant of Neuron Power Engineer that is providing the test framework and when subsequently executing the tests, so-called internal meta files and other test files are automatically created. Usually, these files are not relevant. As a consequence and by default, these files are not displayed within the test project. If you create the test project within a GitHub repo, these files are listed within the appropriate Git commit. Neuron recommends listing the following files/folders within the file
.gitignore
in order to exclude them from tracing by Git:Name
Meaning
file
red.xml
internal file which is automatically created when creating/opening the project
folder
libspecs
folder with internal files which are automatically created when creating/opening the project
.settings\testbed_SiL\testbed_SiL.rule
or .settings\testbed_PiL\testbed_PiL.rule
folder
src-gen\testbed_sil\
orsrc-gen\testbed_pil\
folder
target\testbed_sil\
ortarget\testbed_pil\
internal files which are automatically created/updated when executing a SiL- or PiL-test
But do not exclude the following files from tracing by Git (even though the report for the test coverage is not visible within the project by default):
-
the POUs under test (
file-name.file-extension
– e.g.MyTest.iecst
) -
the files containing the test suites for the POUs (
POU-name.robot
andPOU-name.xlsm
) -
the files for the test execution that are located in the same folder as the files containing the test suites (or in subfolders)
These files are at least:consoleLog.txt
, test reportreport.html
, test loglog.html
and files containing information on the execution of the SiL-/Pil-test (e.g.test_POU-name.SiL.tstlog
,summaryTestReport.SiL.xml
,POU-name.SiL.xml
, report for the test coveragePOU-name.SiL.file-extension.gcov
)
-