seemoo-lab / internalblue

Bluetooth experimentation framework for Broadcom and Cypress chips.
693 stars 86 forks source link

Add Testing to internalblue #16

Closed fmagin closed 4 years ago

fmagin commented 4 years ago

This PR adds various testcases in preparation of the py3k port.

The trace tests ensure that example command line requests result in byte identical communication between the framework and a fake chip, based on a recording of an interaction with a real chip. They can currently be run with python -m unittest traces while in the tests directory and the properly setup venv.

Some unittests ensure that certain APIs still return the same parsed objects, i.e. that data received from the chip is still parsed correctly. They can be run with pytest ./ while in the tests directory and the properly setup venv.

At some point this will be refactored so the trace tests use pytest too, for now this would require refactoring the testcase generation the load_tests protocol is currently not supported by pytest

Because the python3 port has priority this does not include any CI setup yet.

The type annotation aren't necessarily fully correct yet and mostly serve to help during development not for automatic type checking yet. This is only the goal for the py3k port, because Python 3 has more powerful annotations.