Skip to content

Latest commit

 

History

History

UnitTests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Guide to unit testing

image image

Description

Testing framework to check all RFEM Python Client objects and types. Using pytest pkg enables user to run all test together or separately. This is to be maintained. Testing procedure should be exetuded before every commit to ensure compatibility.

Getting started

Dependencies

Step by step

  1. Open RFEM 6 application, NoAssert mode if possible. Always set language to English. The best version of RFEM is current GM, unless you are testing features that are not merged. Check if there are no opened dialogues in RFEM and server port range under Options-Web Services corresponds to the one set in initModel.
  2. Run whole .\UnitTests folder to exetue tests or .\UnitTests\Examples.py to execute all examples. This ensure maximum scope. Execution is independent of current working directory. Pytest has many parameters it can be runned with. Refer to help (via pytest -h) or documentation. Ensure that all tests are either passed or skipped conditionally.
> py -m pytest --tb=no .\RFEM_Python_Client\UnitTests # silent mode
> py -m pytest -s .\RFEM_Python_Client\UnitTests\test_zCalculate.py # verbose, printing out every print() in test
> py -m pytest .\RFEM_Python_Client\UnitTests\Examples.py # execute all examples
> py -m pytest .\RFEM_Python_Client\UnitTests\Examples.py --maxfail 1 # end after 1st fail
> py -m pytest --lf .\RFEM_Python_Client\UnitTests\Examples.py # run last failed tests

output: image Indication: . - passed, s - skipped, e - error, f - failed

  1. This step is optional. To assess code coverage, run coverage. Pytest can be executed inside coverage process, leaving nothing out. Coverage enables to automaticaly create formated output (html, json, or dxf). Again, for more information refer to help (coverage -h) and html (coverage html -h). In html the results can be sorted out or filtered. Files can be inspected separately. Coverage results can be directed into UnitTests folder since they are ignored by github and they will not be commited to repository. Use separate folder for the results. There is a lot of files generated.
> py -m coverage run -m pytest --tb=no .\RFEM_Python_Client\UnitTests
...
> py -m coverage html [target folder]
> start [target folder\index.html]

image

image

Contribute

Contributions are always welcome! Just be sure to start with UnitTests/template.py