1つのswiftファイルに対して1つのテストファイルでテストを行いたいのですがうまくいきません。
ネットで記述されているswiftテストの記事は、デフォルトで作成したテストファイルを使用しているのが多く、
テストファイルを複数作成してやる方法を見つけることができませんでした。
参考になるような資料はありませんか?
UI/Unit Test Case Classを作成しました。
テストしたいクラスのインスタンス化をしようとするとエラーが出ます。
どのようにしたら改善するできるでしょうか?
swift
1import XCTest 2 3class ConnectionManagementTest: XCTestCase { 4 5 override func setUp() { 6 super.setUp() 7 8 // Put setup code here. This method is called before the invocation of each test method in the class. 9 10 // In UI tests it is usually best to stop immediately when a failure occurs. 11 continueAfterFailure = false 12 // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 13 XCUIApplication().launch() 14 15 // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 16 } 17 18 override func tearDown() { 19 // Put teardown code here. This method is called after the invocation of each test method in the class. 20 super.tearDown() 21 } 22 23 func testExample() { 24 // Use recording to get started writing UI tests. 25 // Use XCTAssert and related functions to verify your tests produce the correct results. 26 } 27 28 func test(){ 29 //ここでエラー 内容:Use of undeclared type 'ConnectionManagement' 30 let connectionManagement:ConnectionManagement 31 32 //ここでエラー 内容:Use of unresolved identifier 'ConnectionManagement 33 connectionManagement = ConnectionManagement.sharedConnectionManagement 34 } 35} 36