![]() |
How to match weblist data with expected values - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: How to match weblist data with expected values (/Thread-How-to-match-weblist-data-with-expected-values) |
How to match weblist data with expected values - Anupama - 05-16-2018 Hello All, I am new to UFT and I have this task where I need to perform a comparision between list of all the items available in a weblist with expected list. And I was told not use any excel or Local/global data sheets. And this weblist I am talking about is common for different users but with no of items might vary. So I want parametrize this in way that I can use it as function and can use for diffrent users. Below is the code I am using to capture all the weblist values. Since I am not supposed to use a excel or data sheets. I dont know hoe to compare with expected data. Code: all = Browser("B").Page("P").WebList("L").GetROProperty("all items") Please help RE: matching weblist data with expected values - Ankur - 05-17-2018 It should be a simple thing to achieve. What are the places where you are allowed to fetch expected data from? (flat file, database, anything else?) RE: How to match weblist data with expected values - Anupama - 05-17-2018 Hi Ankur, We basically use parameter.item method to parameter anything, unfortunately our client wants it like that. So the sample goes like this. 'Browser(b).page(p).weblist("listname").parameter.item("ParameterName") ' we pass name and value in the properties here' Now this can be used to verify only one value. So is there any possible way to do this for list of parameter values. without using or placing the values in any external sources like Db, excel, datasheets etc? Thanks in advance. RE: How to match weblist data with expected values - Ankur - 05-17-2018 I still don't get why they don't want you to use a proper file to store data but if they insist it is indeed doable. Just store the entire list as a comma (or whatever delimiter you like) separated value in the parameter. Then split the variable and do the comparison. RE: How to match weblist data with expected values - Anupama - 05-18-2018 Can I get a sample Code on how to loop that and compare with the weblist. It would really help a lot RE: How to match weblist data with expected values - Ankur - 05-18-2018 Store both the lists as dictionary and then use this function to compare the two dictionaries. This is the most optimum method to compare two lists in VB Script. Code: Function CompareArrays(array1, array2) Code Source A second method can be to use arrays and then using two loops compare the values of those arrays one by one (but it is not as optimized as the method above.) |