global

def switch_to_child(child, source)

def switch_to_child(child, source)
  return if @child == child
  if @child
    if from_first_background(@child)
      @first_background_failed = @child.failed?
    elsif from_hidden_background(@child)
      if not @first_background_failed
        @failed_hidden_background_step = @child.get_failed_step_source
      end
      if @previous_outline_child
        @previous_outline_child.after unless same_scenario_outline_as_previous_test_case?(source)
      end
    end
    unless from_scenario_outline_to_hidden_backgroud(@child, child)
      @child.after 
      @previous_outline_child = nil
    else
      @previous_outline_child = @child
    end
  end
  child.before unless to_scenario_outline(child) and same_scenario_outline_as_previous_test_case?(source)
  @child = child
end