Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.



Ive downloaded the trial to go along with my Delphi turbo pro, and ran the advanced demo, and watches didnt work as I had expected.

When I changed the value it wasnt sent to the smart inspect console. How does a watch value really help if I have to keep sending the value each time it changes, thus meaning I could have just logged it?



It’s correct that you need to send a Watch again if you change the corresponding variable value. SmartInspect cannot detect automatically if a variable has been changed somehow.

A call to a Watch method is nearly the same as a call to the related Log method with the difference of where the values are displayed in the Console. For example, if you log an integer with the LogInteger method it is displayed in the main tree (what we call a view) of the Console. If you log an integer with the WatchInteger method, it is displayed in the Watches toolbox on the left and optionally also in the Watches Graph on the right.

Watches are intended to track and display frequently changing variables like the amount of active database connections or open file handles, a loop counter or the amount of memory your application is using. The Watches toolbox can either display the latest value of such a variable (the Latest tab) or the value which was current at the time of the currently selected log entry in the active view (the Selected tab). The Watches Graph can be used to track Watches over time and displays a convenient time graph for each added Watch.

Normally, it is not a problem that you need to send updated values manually. Often you change variables only in a single location and thus only need to insert the related Watch method once. If you want to track an instance variable, for example, you would insert a Watch statement to the appropriate setter method of the object property:

[code]TExample = class
FValue: Integer;
procedure SetValue(const Value: Integer);
property Value: Integer read FValue write SetValue;

procedure TExample.SetValue(const Value: Integer);
FValue := Value;
SiMain.WatchInteger(‘FValue’, FValue);

So, each time you change the instance variable FValue, the updated value is also automatically send to the Console or a log file.