i have scenario validate 100 employee names, querystring return them in xml format.all want validate employee names in assertion statement given below. instead of adding each name in scenario outline example, possible send list of 100 employee names input can iterate through them in java , validate in assertion condition. please advice.
scenario outline: when user queries employee information, correct records returned given webservice running when user queries employee information "<querystring>" user receives correct data "<name>" examples: |querystring|name| |some localhost url|peter| |some localhost url|sam| . . @then("^the user receives correct data\"([^\"]*)\"$") public void the_user_receives_correct_data(string arg1) throws throwable { queryresultpage = selenium.getpagesource(); asserttrue(queryresultpage.contains(arg1)); }
so answere here lings comment can do, use these filenames in step definition load files in code. cucumber doesnt support direct file loading far know. use locate full ressource pathes relative path file names:
public static string getabsoluteresourcepath(string resourcepath) { if (systemutils.is_os_windows) { return utils.class.getresource(resourcepath).getpath().substring(1).replace("/", file.separator); } else { return utils.class.getresource(resourcepath).getpath().replace("/", file.separator); } } the resourcepath should relative file path
Comments
Post a Comment