lundi 21 décembre 2015

OCMock similar library for Stubbing and mocking in Swift test cases

I tried to test code written in Swift. For testing properly I need to mock , stub and make some expectations. In objective C OCMock library is very useful for doing mocking , stubbing and expectations. But I need to test swift code in swift only. I tried to mock objects my self by subclassing class and override the methods and properties but that increases testing code Do there is some library similar to OCMock that can test swift code?

I also tried to write test cases for Swift code in Objective c using OCMock But OCMock is not behaving as expected and my test cases always fails. I had integrated this by enabling Define Modules in settings and also defined the Briging Header file path and in test case imported the Projectname.swift.h file so that swift code is accessible but OCMock is not behaving as expected. I had referred following links also for mocking

http://ift.tt/1Oknb42

Swift mocking/stubbing framework

http://ift.tt/Td0Bim

Kindly suggest any library so that test cases code can be reduced and I can write test cases in optimised way!!

Thanks

Aucun commentaire:

Enregistrer un commentaire