You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

n this guide, you will learn how to debug the custom rules you have created with the Kiuwan Rule Developer. 

Contents: 

Why do I need to debug my rules?

Sometimes we need to perform complex checks and take into account multiple cases of how our code should be constructed or which best practices it should follow.

Although Kiuwan offers a complete API reference (bundled with Kiuwan Rule Developer), we often hit a wall when we try to foresee how our rule will behave when executed in non-trivial scenarios. But we at Kiuwan know about these walls and we want you to easily jump over them.

By debugging a complex rule we will be able to fine-tune its behavior, making the rise of spurious defects less likely to happen.

Spurious defects

We say that a false positive is introduced in an analysis result when a defect arises, although it shouldn't.

We say that a false negative is introduced in an analysis result when a defect that should arise does not arise.

 

Set up the debugger tool

Kiuwan Rule Developer allows you to remotely debug the rule you are editing in your IDE while it is being executed.

If you want to debug your rules, you should launch Kiuwan Rule Developer in debug mode.

Open a console and type:

OSCommand

Windows

> AGENT_HOME/bin/agent –development debugPort=xxxx *
Unix

> AGENT_HOME/bin/agent.sh –development debugPort=xxxx *


(*) xxxx is the port number where the Kiuwan Rule Developer will wait for a remote debug tool to become attached to. Note that the application will not be launched until the remote debug tool is detected by the process.

0002

Once the Kiuwan Rule Developer is waiting for the debugger to be attached, create a remote debug configuration in your IDE.

Let's see how to do this with Eclipse:

  • Right-click your Kiuwan custom rules project in the Explorer view.
  • Select Debug As and then select Debug Configurations…
  • Double click Remote Java Application on the left side of the dialog shown.
  • Fill the Connection Properties form with these values:
    • Host: localhost
    • Port: xxxx (the port number you specified when launching Kiuwan Rule Developer).
  • Click Debug.

0003
Make sure the specified debug port matches
 the one configured in your remote debug tool. If the attachment is successful, Kiuwan Rule Developer will start and you will see a red label indicating the current debugging port in the bottom left of the Rule Developer window:

0004

 

Once Kiuwan Rule Developer is started in debug mode:

  1. Set a breakpoint in your rule’s source code.
  2. Execute the rule in Kiuwan Rule Developer.
  3. Eclipse should stop in the breakpoint.
  4. You are ready to debug your custom rule!

 

0005

 

  • No labels