How to use assertMap method of com.galenframework.tests.integration.GalenFullJsProjectIT class

Best Galen code snippet using com.galenframework.tests.integration.GalenFullJsProjectIT.assertMap

Source:GalenFullJsProjectIT.java Github

copy

Full Screen

...49 private void assertReports(String htmlReportPath, String jsonReportPath) throws IOException {50 try {51 ObjectMapper mapper = new ObjectMapper();52 JsonNode jsonTree = mapper.readTree(FileUtils.readFileToString(new File(jsonReportPath + "/report.json")));53 assertMap(toMap(jsonTree), new HashMap<String, TestStatistic>() {{54 put("Add note page on desktop emulation device", new TestStatistic(74, 0, 0, 74));55 put("Add note page on mobile emulation device", new TestStatistic(73, 0, 0, 73));56 put("Add note page on tablet emulation device", new TestStatistic(74, 0, 0, 74));57 put("Login page on desktop emulation device", new TestStatistic(80, 0, 0, 80));58 put("Login page on mobile emulation device", new TestStatistic(84, 0, 0, 84));59 put("Login page on tablet emulation device", new TestStatistic(79, 0, 0, 79));60 put("My notes page on desktop emulation device", new TestStatistic(81, 0, 0, 81));61 put("My notes page on mobile emulation device", new TestStatistic(83, 0, 0, 83));62 put("My notes page on tablet emulation device", new TestStatistic(81, 0, 0, 81));63 put("Welcome page on desktop emulation device", new TestStatistic(70, 1, 0, 71));64 put("Welcome page on mobile emulation device", new TestStatistic(68, 0, 0, 68));65 put("Welcome page on tablet emulation device", new TestStatistic(70, 1, 0, 71));66 }}67 );68 List<String> errorMessages = collectAllErrorMessages(jsonTree, jsonReportPath);69 assertErrorMessages(errorMessages, asList(70 regex().exact("\"login_button\" width is ").digits(2).exact("px instead of 20px").toString(),71 regex().exact("\"login_button\" width is ").digits(2).exact("px instead of 20px").toString()72 ));73 } catch (Exception ex) {74 throw new RuntimeException("Report validation failed:\n" +75 "Html Report: " + htmlReportPath + "/report.html\n" +76 "Json Report: " + jsonReportPath + "/report.json", ex);77 }78 }79 private void assertMap(Map<String, TestStatistic> realMap, Map<String, TestStatistic> expectedMap) {80 assertEquals(realMap.size(), expectedMap.size());81 for (Map.Entry<String, TestStatistic> expected : expectedMap.entrySet()) {82 assertTrue(realMap.containsKey(expected.getKey()), "Should contain: " + expected.getKey());83 assertEquals(realMap.get(expected.getKey()), expected.getValue(),84 "Should have same value for key:" + expected.getKey() + " \nas: " + expected.getValue()85 + ", but got: " + realMap.get(expected.getKey()));86 }87 }88 private void assertErrorMessages(List<String> errorMessages, List<String> expected) {89 assertEquals(errorMessages.size(), expected.size());90 Iterator<String> expectedIterator = expected.iterator();91 int number = 0;92 for (String errorMessage : errorMessages) {93 number ++;...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Galen automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful