When I run this code, the first answer does not show a version property, but the second does:
put (key1:"value1") into params
I cannot find any other hidden properties or documentation that mentions this one. Is this intended? Are there any other hidden properties?
I’m passing around property lists with an optional version property and it never finds an empty version property to fill with the default version of the app under test.
I know I can work around this (by changing the name of the property in my code and all of our task files or by checking for “purple” or “green” in the version property), but which work-around I use depends on knowing if this behavior is intended.
Here’s what I believe is happening: Version is a built in command. The dot notation is one way of calling a command or function (try executing “put version()”). The expression blah.version (where “blah” can be anything) is calling the version command on a SenseTalk object, which is going to return the current version of Eggplant/SenseTalk as its value. BTW, “params” is also a built-in keyword; you should probably avoid using built-in keywords and functions as variables and keys to avoid unintended side effects like those that you have already seen.
Can I get a simple list of the keywords I need to avoid using? Searching the manual for keywords is very frustrating because the keywords are used all over the manual.
Appendix A of the SenseTalk Reference has a list of restricted words, but that doesn’t cover every keyword that is used in SenseTalk. You can always just start typing the word that you want to use and then hit the escape key to see possible completions – if your intended word is in the list, then you probably want to pick a different one.
In general, the only words you really can’t use as variable names or command/function names are listed in Appendix A of the SenseTalk Reference manual, as Matt pointed out. Any other words, even though they have meaning in specific contexts, can be used as you like.
In your examples, the word “version” is perfectly fine as a property name. The only problem here is that the dot notation is flexible in that it will access either a property or a function, which makes it more difficult to tell if that property has been set. There are a couple ways around this. One is to use the “property” syntax to explicitly refer to the property:
put property version of params
Another would be to directly check for the property’s existence:
put property "version" of params exists
You might also want to think about setting the explicitProperties to true, although that won’t really help you in this particular situation.
It’d be really nice to have a simple list of keywords – Maybe as a search option in the manual?
Autocomplete doesn’t do it for me. It also contains non-keywords that I’ve used. So there’s words in there that I want to use and words I don’t want to use and I don’t always remember the one’s I’ve created. It’d be great if it would distinguish between the two…