2016-04-08 13 views
3

Şu anda testimi 1 dosyaya yazdım (varsayılan). Birden fazla dosya ve test yapmak mümkün mü?XCTest ve ayrı bir dosya ile iOS testi

- (void)setUp { 
    [super setUp]; 
    // Put setup code here. This method is called before the invocation of each test method in the class. 
} 

- (void)tearDown { 
    // Put teardown code here. This method is called after the invocation of each test method in the class. 
    [super tearDown]; 
} 

- (void)testExample { 
    // This is an example of a functional test case. 
    XCTAssert(YES, @"Pass"); 
} 

cevap

4

Dosya başına birçok dosya ve çok sayıda sınava sahip olabilirsiniz. İlki sadece otomatik Xcode tarafından yapılan biridir, ancak özel kılan tüm tam o:

  1. test hedefinin bir üyesi mi XCTestCase bir alt sınıfını uygular (uygulamanıza değil hedef)

Aynı özelliklere sahip başka bir dosya oluşturmak kolaydır. Xcode, Dosya

-> Yeni -> iOS -> Kaynak -> UI Test Durum Sınıf

kongre (bir kaynak dosyasına grupla ilgili testler ve daha sonra bu kaynak dosyasını ___ Tests.swift isim veya .m)

Örneğin, SharingTests.swift, testSharingToFacebook() ve testSharingToTwitter() yöntemlerini içerebilir.