Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Automating Repetitive Test Tasks

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Automating Repetitive Test Tasks. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

As part of QA automation for an Alnylam Amvuttra workflow, a test runner records whether each expected result matches the observed result. Write a function that scans the records and returns the IDs of all failed test cases in their original execution order.

A test case passes when expected equals actual. It fails otherwise.

Formal Specification

Implement collect_failed_tests(results).

  • Input: results, a list of dictionaries. Each dictionary contains three strings: id, expected, and actual.
  • Output: Return a list of test case ID strings whose expected and actual values differ.
  • Do not modify the input list or its dictionaries.

Constraints

  • 0 <= len(results) <= 10^5
  • Every record contains nonempty string values for id, expected, and actual
  • Test case IDs are unique
  • Comparisons are case-sensitive

Function Signature

def collect_failed_tests(results):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output