Swift - Unit testing functions that involve IBOutlets? -
I am setting up a unit test for my SWIFT project and I'm having trouble testing the class function in which Updating IBoletlet is included.
I have a function, validateUrl, which expects to pass a string, then it validates if it is valid, it enables UIButton, if it is invalid, then it Disables UIButton when I run a test that calls this function, the app crashes on the line of code that enable or disable UIButton. Both the storyboard and the controllers have a proper test goal set.
This line of code:
self.submitButton.enabled = true // Enable the Submit button
with this error Exits:
Fatal error: Unexpectedly found zero while unwrapping an alternate value -text "itemprop =" text "> You have to start the view controller using the storyboard. See the document here:
If you start the visual controller directly, then it will not have any connection because in this case the VC does not know about the storyboard itself.
Comments
Post a Comment