Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top