Test Case Variable Types and Data Binding

I wrote exhaustive unit tests to prove this out and the team agreed on what appears to be the only way to implement boolean in data binding without confusion. I can provide those if necessary, but the behavior is rather fundamental and obviously a design choice. It should be documented, but I can’t find that in the data binding docs. IMO, type coercion should be attempted and warnings/errors should be thrown.

Due to a unexpected behavior in some test cases, we ended up doing an exhaustive test with test case variable types and data binding. We tested String, Boolean and Number data types only.

The short version is, Katalon converts all variable types to String when using data binding. This appears to be true whether or not the “Bind to test case as String” checkbox is selected on the data file. If this checkbox has any impact, we were unable to determine it.

Also, if no data is bound to a test case input, then the type defined on the test case remains unchanged.

These two facts led to inconsistent test case behavior between unit testing individual test cases and complete test suite executions using data binding. Please see below.

DO NOT USE NUMBER OR BOOLEAN. They will be converted to String when using data binding.

To use boolean variables, you must:

  1. Declare the variable as type String on the Test Case
  2. To default to true, set the default value to “true” or “TRUE”
  3. To default to false, set the default value to anything other than “true” or “TRUE”
  4. When supplying booleans via data binding (e.g. in XLSX), use “true” or “TRUE” to convey the Boolean true
  5. When supplying booleans via data binding (e.g. in XLSX), use anything non-null value other than “true” or “TRUE” to convey the Boolean false
  6. If you do not provide a value via data binding, the default value on the test case will be used.

Katalon Studio Version: 7.*

Expected Behavior:

Katalon would do some type coercion to force data bound via test suite into the intended data type of the test case.

Actual Behavior:

Everything is converted to a string. Therefore, any test case logic which treats test case variables as the defined data type begin behaving as strings.

@duyluong @ThanhTo @Jass

Placing this under bugs until one of the devs has responded.

1 Like