At Stripe, a simple test automation script receives a list of test result strings and must produce a compact summary. Write a function that parses the results, counts each status, and returns the names of failed tests in the order they first appear.
Implement a function summarize_test_results(results) where results is a list of strings. Each string has the format "<test_name>:<status>", where <status> is one of PASS, FAIL, or SKIP. Return a dictionary with four keys:
passed: number of tests with status PASSfailed: number of tests with status FAILskipped: number of tests with status SKIPfailed_tests: list of unique failed test names in first-seen orderIf a test name appears multiple times with status FAIL, include it only once in failed_tests, but count every failed entry in failed.
Example 1
results = ["login:PASS", "checkout:FAIL", "search:SKIP", "checkout:FAIL"]{"passed": 1, "failed": 2, "skipped": 1, "failed_tests": ["checkout"]}checkout appears once in the failed test list.Example 2
results = ["api:PASS", "ui:PASS"]{"passed": 2, "failed": 0, "skipped": 0, "failed_tests": []}0 <= len(results) <= 10^4: separatorPASS, FAIL, or SKIP