Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to debugger #1513

Merged
merged 1 commit into from
Mar 14, 2021
Merged

Conversation

joelpramos
Copy link
Contributor

@joelpramos joelpramos commented Mar 13, 2021

  • Previously when the debugger stopped with an error in a step, whenever a step was evaluated via "Debug Console" in VS Studio the previous exception throwable was always returned confusing the user about his activites;
  • Added a simple version of using conditional breakpoints in VS Code. The condition needs to evaluate to a boolean.
    • if it evaluates for something else other than a boolean the debugger will not use the condition and it'll just stop on the breakpoint like
    • Only simple Karate expressions are accepted (no keywords, just boolean conditions e.g. variable == 'val') or JS functions in the format of function() { return true; }
    • For convenience of syntax highlighting, added support to include the Cucumber prefix but keywords (e.g. match) will NOT work. Few examples of using this:
      a) code in the Karate boolean condition directly
      image
      b) boolean condition with the star ('*') prefix for fancy colors:
      image
      c) condition in JS
      image
      d) go nuts with your JS ...
      image

Tips:

  • Right click on the left of the line number for the option 'Conditional Breakpoint'
    image
  • Use Shift+Enter to add new lines in that debugger window/swimlane in VS Code.
  • Press Enter to confirm/apply the condition

Description

Thanks for contributing this Pull Request. Make sure that you submit this Pull Request against the develop branch of this repository, add a brief description, and tag the relevant issue(s) and PR(s) below.

  • Relevant Issues : (compulsory)
  • Relevant PRs : (optional)
  • Type of change :
    • New feature
    • Bug fix for existing feature
    • Code quality improvement
    • Addition or Improvement of tests
    • Addition or Improvement of documentation

- improvement to evaluate steps with VS Code debugger: error message is not returned if the engine is in an error state
@joelpramos
Copy link
Contributor Author

Improvements of using the "Debug Console" after errors.

Previously after an error occurs in a step and the debugger stops, if you tried to do anything in the Debug Console (e.g. '* print 'test') the step would be executed but the previous error message from the context would be returned. Not anymore.

image
image
image

@ptrthomas ptrthomas merged commit 5812ceb into karatelabs:develop Mar 14, 2021
@ptrthomas
Copy link
Member

merged and want to make sure @kirksl is aware of these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants