mardi 16 mai 2017

How to test a segue attached in storyboard

I want to attach a Show segue to a property cell of a table view in storyboard. Now I want to test this binding is exists. i.e. I want to have a test that would fall if I delete the segue in the Interface Builder or changed the segue identifier.

From a user perspective, user taps on a cell of the table view and then this segue should be performed.

From testing perspective, I can swizzle the prepare(for:sender:) method the verify the performing of a segue, but I don't know how to trigger a "tap" programmatically.

I've tried tableView.selectRow(at:animated:scrollPosition), cell.setSelected(_:animated:) and those both didn't work.

  1. How to programmatically trigger the segue added via InterfaceBuilder ?
  2. Or is there any other way to test this segue binding?

Aucun commentaire:

Enregistrer un commentaire