Frage

I am using the PLCrashReporter framework to detect crashes and send those to our back end. There, I convert the PLCrashReport data structure into a JSON object. Now I was wondering how I could unit-test these functionality.

Is there a way to create a PLCrashReport from crash file or from source?

Thank you.

War es hilfreich?

Lösung

Assuming you're using the PLCrashReport API to actually parse the protobuf report, this is a bit more tricky than it needs to be, mainly because the API necessary to create arbitrary PLCrashReport instances — the only option is to parse an actual report.

Your best bet would be to generate a crash report (eg, via -[PLCrashReporter generateLiveReport]), use it as a static test resource, and write your tests against that known data.

This is a use case we should support better, though, so I've filed a PLCrashReporter issue to track the request.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top