## Operating System: Windows 10
=======================================
## Katalon Studio Version: 5.5.0
## Katalon Studio logs:
No logs related to the time of the event.
## Steps to reproduce
Create a Test Case
Add a Zero Argument Closure, like so:
{-> println("TEST") }
Attempt to Run the Test Case Directly in Katalon Studio.
## Expected Behavior
All else constant, it should run and print “TEST”
## Actual Behavior
**
**
## Backgroun Information
When a Test Cases contains a zero argument closure, AND you attempt to run the single test case directly in the IDE (without a suite or test collection) this error is presented:
“There are errors in the script. Please fix before Executing”
However, zero argument closures are syntactically valid . Additionally, they compile fine and the same Test Cases can be run from a Test Suite without issue.
At first it may seem like there is no difference here, but some libraries/frameworks monitor the number of arguments a closure is using.
This is the case for my Scripts with Cucumber Step Definitions. I’m unable to run a Test Case directly when debugging, because I must provide a zero argument closure when Cucumber expects one.
Luckily I am able to work around this by housing the Test Case in a Test Suite and running the Test Suite instead of the Test Case directly.
// Zero argument closure.
{ -> }
// Implicitly 1 argument closure, with 'it' as the argument
{ }
// This is syntactically correct, but Katalon prevents running
Given(~/^Some user$/) { -> // Write code here assert true}
// Katalon allows this,
// Cucumber complains about the 1 implicit 'it' argument
Given(~/^Some user$/) {
// Write code here assert true}