null, undefined, NaN, [object Object]

One common mistake in Web development is to use the value of a variable or property that is not in the expected state. JavaScript has two bottom values: null and undefined. Due to the widespread use of JavaScript, it is common to see these values rendered in the UI. Most of the time, these values are not intended for the end user and can be confusing. The AutoExplore agent is now able to detect these values and highlight them in the reports.

Root cause

The null value is used to represent the absence of a value. The undefined value is used to represent the value that is not yet defined.

Technically, these values end up in the UI due to a string interpolation where the read value is not defined. Before quickly rushing into a fix, it is crucial to understand the root cause of the issue. Rendering price as 0 is different from not having a price set.

NaN is a special value that represents a mathematical operation that cannot be performed. These values can end up in the UI due to incorrect calculations or invalid input values. When price is calculated and the formula contains an invalid value, the result is NaN.

[object Object] is a special value that represents an object. This value can end up in the UI when the developer expects a value or property to be a string, but the value is an object. It is common to see these values in the UI after library or API updates, something that used to be a string has been changed to an object.

Detection

The AutoExplore agent is now able to detect these values and highlight them in the reports. OnScreenError is the new error type used to categorize this type of issues. OnScreenError also contains other error-looking texts from the UI other than just null, undefined, NaN and [object Object]. You can use the timeline view to see the exact steps the agent took for reproducing the issue. The final step highlights the value where it was detected.



At AutoExplore, we are committed to helping R&D teams implement autonomous testing as part of their development processes. Would you like to see what issues AutoExplore finds from your application? Contact us for a demo to learn more.

Sampo Kivistö, Founder & CEO

Sampo Kivistö

Tel. +358 452733080