Verifying variable set inside tested object?

Simple function: setMyID(). It has a numeric argument “myID” and sets variables.instance.myID to the argument value.

How to check that it was set w/o using my own getMyID() function call?

Generally, it would be best to test your object in terms of their input/output, not how they handle things internally. Tying your tests to the way your object work on the inside may lead to over specified software, and too many test would need to be modified when you make changes to the software.

I highly recommend as an excellent resource with tons of information about the do's and don'ts of effective test automation.

Best regards


Thanks for the advice, and you’re right: It seems very dumb/specific to say “Did the setter set a variable?” I’ll share your link with our group.