0

When intent assertion fails, Botium returns a verbose error message that is good for console logging or general reporting. However, I need to run some post processing to analyze what intents were triggered and what were expected.

Here is an example of the verbose message:

Error: INTENT_NAME/INTENT_NAME_input-L2/Line 6: assertion error - Line 6: Expected intent "INTENT_NAME" but found nothing

#

ASSERTION FAILED in IntentAsserter - Expected: "INTENT_NAME" - Actual: empty

INPUT: What is your name?

{"type":"asserter","source":"IntentAsserter","context":{"params":{"args":["INTENT_NAME"]}},"cause":{"expected":"INTENT_NAME","actual":null},"message":"INTENT_NAME/INTENT_NAME_input-L2/Line 6: assertion error - Line 6: Expected intent \" INTENT_NAME\" but found nothing","input":{"sender":"me","channel":null,"messageText":"What is your name?","stepTag":"Line 3","not":false,"asserters":[],"logicHooks":[],"userInputs":[]}}

If I could retrieve just the json in the example above, it would satisfy my requirement.

4

1 回答 1

1

我用摩卡咖啡做了一些挖掘,找到了答案。

https://mochajs.org/api/tutorial-custom-reporter.html

mocha 事件侦听器 EVENT_TEST_FAIL 将错误对象传递给包含所有详细信息的回调。

干杯。

于 2020-05-08T04:31:27.170 回答