def test_log_on_breakpoint(debugger_api: _DebuggerAPI): from robocorp_ls_core.debug_adapter_core.dap.dap_schema import TerminatedEvent from robocorp_ls_core.debug_adapter_core.dap.dap_schema import OutputEvent debugger_api.initialize() target = debugger_api.get_dap_case_file("case_condition.robot") debugger_api.target = target debugger_api.launch(target, debug=True) line = debugger_api.get_line_index_with_content("Log ${counter}") debugger_api.set_breakpoints( target, line, line_to_kwargs={line: { "logMessage": "Counter is: ${counter}" }}) debugger_api.configuration_done() debugger_api.read(TerminatedEvent) debugger_api.assert_message_found( OutputEvent, accept_msg=lambda output: output.body.output.strip() == "Counter is: 1", ) debugger_api.assert_message_found( OutputEvent, accept_msg=lambda output: output.body.output.strip() == "Counter is: 2", )
def test_simple_launch(debugger_api: _DebuggerAPI): """ This is an integrated test of the debug adapter. It communicates with it as if it was VSCode. """ from robocorp_ls_core.debug_adapter_core.dap.dap_schema import TerminatedEvent from robocorp_ls_core.debug_adapter_core.dap.dap_schema import OutputEvent debugger_api.initialize() target = debugger_api.get_dap_case_file("case_log.robot") debugger_api.launch(target, debug=False) debugger_api.configuration_done() debugger_api.read(TerminatedEvent) debugger_api.assert_message_found( OutputEvent, lambda msg: "check that log works" in msg.body.output)