teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

やったこと

2018/05/24 07:20

投稿

L85A2
L85A2

スコア60

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