Posts

Showing posts with the label Xcode

UITestCase Automation Testing with Xcode

Image
UITestCase using Xcode TestCases for UI helps to automate the testing. In case of iOS , it is subclass of XCTestCase , which is part of XCTest framework . The subclassed object can be usually considered a Test Suite. A Test Suite is nothing but a group of similar test classes intended to test a specific behavior. To understand more about the automation testing using Xcode , we will consider a simple example which will test the alert message being shown appropriately or not for each button being tapped. The code is available on GitHub .                 XCTestCase and life cycle of a test suite XCTestCase subclass objects has all the required methods to setup and run a test case. More precisely methods for test suite life cycle. a) class method setUp -> use this to initialize the inputs required , before the first test case executes. override class func setUp(){ } b) method setUp  -> executed ...

Swift code in Objective-C

Image
Xcode allows to write you with a Swift and use it in your existing project which could be in Objective-C. Consider the below UserObject Swift Written Class. UserObject Class in Swift import Foundation class UserObject: NSObject {     var userId: String ?          func printName(nameValue: String ) -> Void {         print ( "Name = \ ( nameValue )" )     }         func printAnotherName(nameValue: String ) -> Void {         print ( "Name = \ ( nameValue )" )     } } ViewController in Objective-C Now what if you want this newly written UserObject Swift Class to use in your existing Objective-C Class. @interface ViewController () @end @implementation ViewController - ( void )viewDidLoad {     [ super viewDidLoad ];     UserObject *userObject = [[ UserObject ...