Edit: Added a specific Use Case for clarity
Like most users I use parameters for my KWTs. Some parameters have a limited option pool e.g. paramater "WantACookie" can have 3 and only 3 values "Yes", "No" and "Not Sure" This parameter is used to set the text of a combobox. I could create it as a string that correlates with this and each other KWT or script that calls this KWT just needs to send the string. Say, however the the marketing department decided that "Not Sure" is no longer broadcasting the right message and want to change it to "I'm Thinking About It" All those other scripts and KWTs that used to set it to "Not Sure" will break. Is it possible to create the parameter as a list of key->value pairs. That way my other KWTs and scripts can say the vaule should be WantACookie.NotSure and all I have to do is go to my KWTs WantACookie paramter and change the value of the "NotSure" key to "I'm thinking About It" You would probably have to define this KVP list in the parameter type itself I guess and when setting properties in the visual editor, this "Enum" should be available the same way Variables and Parameters are from a dropdown.
A specific Use Case:
The Enum is a way to define a limited amount of set options that you know won't change
Say I'm an e-commerce site. I wan't to make sure users don't have a bad experience by accidentally buying something when they intended to just add it to the wish list. Three tests:
1. Textbox1.Keys()->Textbox2.Keys(),texbox3.Keys,etc,-> buttonPlaceOrder.Click() -> Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? Yes ->Pass
2. Textbox1.Keys()->Textbox2.Keys(),texbox3.Keys,etc,-> buttonAddWishList.Click() -> Open Wishlist page -> Are ther items ? Yes -> Pass -> Open Basket -> Are there items? No ->Pass
3. Textbox1.Keys()->Textbox2.Keys(),texbox3.Keys,etc,-> buttonCance.Click()l -> Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? No ->Pass
All three tests have the data populate in common. I don't really care what data is in there and I won't use it in a Data Loop so it can all be the same and be written into a single test so I don't have to duplicate all those .Keys() and .Clicks() into all my KWTs
So, create one KWT PopulateOrder that does the keypresses.
One step further I can see the only thing that distinguishes the process is what button gets clicked. If I specify this as a parameter like PopulateOrder(OrderAction) I can change my tests to this by simply dragging the new KWT into my visualiser :
1. PopulateOrder(Order) -> Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? Yes ->Pass
2. PopulateOrder(WishList) -> Open Wishlist page -> Are ther items ? Yes -> Pass -> Open Basket -> Are there items? No ->Pass
3. PopulateOrder(Cancel)->Open Wishlist page -> Are ther items ? No -> Pass -> Open Basket -> Are there items? No ->Pass
The last steps in my Populate order is an if statement:
If(OrderAction equals "Order"){buttonPlaceOrder.Click()}
If(OrderAction equals "WishList"){buttonAddWishList.Click()}
If(OrderAction equals "Cancel"){buttonCancel.Click()}
If I drag the KWT into another KWT I can supply this parameter. Problem is, if a user doesn't know the exact string required and they type in, say "PlaceOrder", the KWT will fail because none of the if statements match. If on the other hand I can define the parameter as an enum that the user can choose from a dropdown I know the logic will always work e.g.
if(OrderAction equuals OrderActionEnum.Order) {buttonPlaceOrder.Click()}
It's something I would really have appreciated when I started using TC. It would have helped standardise my tests by always having the option based parameters defined, thereby avoiding loads of rework due to early inexperience.
It still helps because I wouldn't have to open the PopulateOrder just to double check what string I need to send.