Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Validate Test Steps Against Output

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

Your question is Validate Test Steps Against Output. 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

Given a string log_output and an array of strings expected_steps, write a function that returns True if every expected step appears in log_output in the same order, and False otherwise. Each expected step must appear as a substring after the previous matched step, which simulates a simple automated test case verifier.

Constraints

  • 0 <= len(log_output) <= 10^5
  • 0 <= len(expected_steps) <= 10^3
  • 0 <= len(expected_steps[i]) <= 10^3
  • All inputs are strings and matching is case-sensitive

Function Signature

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