DocumentationLogging & debugging
Logging & debugging
Debugging end-to-end tests is notoriously difficult. To help give visibility, Carbonate provides extensive logging capabilities.
Automatic log dumping
When your test fails, Carbonate automatically injects its logs into the test exception so that they appear in your test output:
info: Loading page [...]
info: Querying action [...]
info: Waiting for DOM update to finish [...]
notice: No actions found, extracting from page [...]
info: Successfully extracted actions [...]
info: Performing action [...]
info: Querying assertion [...]
notice: No assertions found, extracting from page [...]
Alternative logging:
Alternatively, if you want log to a file, you can specify this in the logging parameter of the SDK constructor:
self.carbonate_sdk = carbonate.SDK(
# ...
logging=f'var/log/tests.log' # Log to a file
)
You can also provide your ownlogger, providing it is compatible with the Python logger interface. When providing your own logger, all logs will be sent to the logger - regardless of whether the test passed or failed.
Disabling log dumping
If you don't need this feature, you can disable log dumping by passing False
to the logging parameter of the SDK constructor
self.carbonate_sdk = carbonate.SDK(
# ...
logging=False # Disable logging for all tests
)