【发布时间】:2022-11-04 17:52:55
【问题描述】:
有没有办法在 Flutter 中为 Sentry 编写单元测试?
我有一个函数可以接收一组输入并向 Sentry 报告
reportError({...}){
Sentry.captureException(stackTrace, stackTrace: stackTrace, hint: hint);
}
我想为此编写一个单元测试
test('sends to sentry', () {
reportError(
hint: 'error',
response: Response(
json.encode(<String, dynamic>{'message': '4: error'}),
401,
),
);
});
问题是,如何验证错误是否已记录?
【问题讨论】:
标签: flutter unit-testing dart sentry