Example of a User Input with a list or drop-down box

Does anyone have an example of teststep with a user input, where the user selects an item from a pre-populated list (like a list box or drop-down list)?

2 Likes

@dara_sariaslani are you looking for a Dialog pop up or just a simple Test Step setting? If the former in general you can leverage all the Attributes from within the UserInput step, so using this example as a base you can modify one of the classes to use the AvailableValues attribute:

    class EnterSNDialog
    {
        // Name is handled specially to create the title of the dialog window.
        public string Name { get { return "Please enter serialnumber"; } }
        
        // Serial number to be entered by the user.
        [Display("Serial Number")]
        public string SerialNumber { get; set; }

        private List<int> Channels = new List<int> { 1, 2, 3 };

        [Browsable(false)]
        public List<int> ChannelList 
        { 
            get { return Channels; }
            set { Channels = value; }
        }


        [AvailableValues("ChannelList")]
        public int ChannelNumber { get; set; }
    }

A more general AvailableValues (what we use to create a dropdown list) can be found here:

1 Like

@brennen_direnzo - thanks. I am looking for a dialog pop-up that is displayed during testplan execution, since the values that the list will need to display depend on previous steps having been executed. I will Use the dialog example you have shown here.

2 Likes

There is another example of a Dialog popup here, it is for a barcode scanner, it is a more customizable approach. May or may not be relevant to what you are trying to do

1 Like