Robot Framework itself provides a good set of basic guidelines for writing good tests. You can read it here. The rest of this generally guide generally assumes you are familiar with this, as well as writing Robot Framework and python.
ONAP basically follows the structure represented at this link and the image linked below
The robot framework layer is managed for you and you should install whatever the setup.sh file has as any other version could cause issues with compatibility.
`-- robot |-- assets | |-- keys | |-- templates | |-- aai | |-- vid | `-- etc |-- library - any python libraries needed to run tests are installed here (you dont edit these directly!) | `-- eteutils - this is the robot code we write in the python testing utils project aka robotframework-onap. Put any python code libraries we write in there, but do not edit in here |-- resources | |-- aai | |-- vid | `-- etc `-- testsuites - put any robot test suites we write in here |
You should put anything you need as input like json files, cert keys, heat templates and templates. You should include subfolders for each component.
Two special folders are keys (put any private keys used in testing in here, you should NOT include keys used anywhere but testing, because they are here they are not secure.) and templates (put any json templates in here)
You should put any robot resource files aka reusable keywords we write in here, you should include subfolders for each component. These should be written in as reusable a manner as possible as they are meant to be keywords that provide a specific functionality, and if that functionality needs enhancement it should be added to the main keyword. Resources should be a useful library for all the test cases to call upon!
Robot uses tags to separate out test cases to run. below are the tags we use
Repository Name: testsuite
Code was originally written all in robot. In order to increase re-usability the target is to write this level of items in python code. This code is located in https://gerrit.onap.org/r/gitweb?p=testsuite/python-testing-utils.git;a=tree;f=robotframework-onap;h=113e26102f4e9a3e729d46f0f1936d08de02045b;hb=refs/heads/master. However not all code has been ported there, but if it has you should be putting your changes there. If the component has not been ported, it will be in /robot/resources/<component>/whatever.robot or /robot/resources/<component>_<whatever>.robot and you can add/edit your items there. If you are making a new component, it should be created in the python library.
Items that are not testcases and have some usability only within a single testsuite can we put in /robot/resources/
All tests should be in /robot/testsuites. Since there are various reasons for splitting logically grouped items into separate files, please put them in a folder so that robot will show them together in the hierarchy. Certain tests like demos, orchestration, healthcheck and post init checks are already existing and should be put in their respective files
You should follow the industry best practices for Robot Framework, a few good resources for that are