We prepared for you a few manually introduced bugs in order to learn how to use Rookout.
The first two will make sure you understand how to create and analyze our default rule - Dump Frame.
The third bug will introduce a new rule type - Log. You will be walked through the process of editing the rule in order
to add custom elements to it.
For more information about Rule Scripting refer to our reference
Level: Beginner
-
The bug:
Clear Completed
button does not work. When clicked - completed todos are not cleared.- Reproduce: Add a few todos, check one or more as completed using the checkbox on the left of the task and click the
Clear completed
button on the bottom right corner.
- Debug:
- Load the app's code from github / local - as explained in here
- In the Rookout app, open the file
src/main/java/com/rookout/tutorial/TodoController.java
- Add a
dumpframe
rule on thereturn
of theclearCompleted
function by clicking left to the line numbering (just like you would have created a breakpoint on an IDE)
- Try clicking on
Clear completed
again to see the message that pops in the Rookout app - We can now see the whole stacktrace leading to this point and the local variables:
- Notice how we created a new variable
todoStore
instead of overridingtodos
- Now we know what the bug is!
- Reproduce: Add a few todos, check one or more as completed using the checkbox on the left of the task and click the
Level: Beginner
- The bug: Special characters (<,>,;,`,&,/,\) are not being accepted as part of the title when Adding or Updating a Todo.
- Reproduce: Add a todo with special characters. All of these characters should disappear.
- Debug:
- In the Rookout app, open the file
src/main/java/com/rookout/tutorial/TodoController.java
- In the addTodo function you will we see that the todo title is being filtered by
replaceAll
with a regex - Let's add aDump Frame
to the line after it - Try to add a todo with some special characters (e.g:
do <> this
) - We can clearly see both
newTodoRecord.title
andtodoTitle
- which is the cleaned title.
- In the Rookout app, open the file
Level: Intermediate
- The bug: Duplicate Todo adds an invalid todo instead of an exact copy of an existing one.
-
Reproduce: Add a task and when hovering on the text, on the right side you have the & symbol. Click on it to duplicate the task.
-
Debug:
- In the Rookout app, open the file
src/main/java/com/rookout/tutorial/TodoController.java
- Using the Rules pane on the right, select the Rule Type "Log"
- Add the rule in the duplicateTodo function on the line with
todos.add(newTodoRecord);
- Before triggering the rule, let's edit it so it returns what we want
- In the Rules pane on the right, click the Edit Rule (pen) icon next to the rule you just added. It will open up the Rule configuration as a JSON file
- On line 37 in the
paths
object let's add a property"store.rookout.locals.dup": "frame.newTodoRecord"
- On line 51 we have
processing.operations
object, let's add a new operation in the array : name: send_rookout - means we are sending the information to the rookout web application path: store.rookout.locals.dup - we tell the rule what information to send
{ "name": "send_rookout", "path": "store.rookout.locals.dup" }
- In the Rookout app, open the file
-
Head over to our reference to understand all the Rookout components.
See our installation guides for platform-specific installation examples.