Adam Pritchard 9 лет назад
Родитель
Сommit
f8bada2f83

+ 20 - 1
MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnelTests/PsiphonTunnelTests.m

@@ -8,15 +8,30 @@
 
 #import <XCTest/XCTest.h>
 
-@interface PsiphonTunnelTests : XCTestCase
+#import "PsiphonTunnel.h"
+
+
+@interface PsiphonTunnelDelegate : NSObject <TunneledAppDelegate>
+@end
+@implementation PsiphonTunnelDelegate
+
+- (NSString * _Nullable)getPsiphonConfig {
+    return @"";
+}
 
 @end
 
+
+@interface PsiphonTunnelTests : XCTestCase
+@property PsiphonTunnelDelegate *psiphonTunnelDelegate;
+@end
+
 @implementation PsiphonTunnelTests
 
 - (void)setUp {
     [super setUp];
     // Put setup code here. This method is called before the invocation of each test method in the class.
+    self.psiphonTunnelDelegate = [[PsiphonTunnelDelegate alloc] init];
 }
 
 - (void)tearDown {
@@ -27,6 +42,9 @@
 - (void)testExample {
     // This is an example of a functional test case.
     // Use XCTAssert and related functions to verify your tests produce the correct results.
+    
+    PsiphonTunnel *tunnel = [PsiphonTunnel newPsiphonTunnel:self.psiphonTunnelDelegate];
+    XCTAssertNotNil(tunnel);
 }
 
 - (void)testPerformanceExample {
@@ -37,3 +55,4 @@
 }
 
 @end
+

+ 26 - 1
MobileLibrary/iOS/build-psiphon-framework.sh

@@ -214,4 +214,29 @@ fi
 # Delete the temporary simulator build files.
 rm -rf "${BUILD_DIR}-SIMULATOR"
 
-echo "Done."
+echo "BUILD DONE"
+
+#
+# Run tests
+# 
+
+cd ${BASE_DIR}
+
+echo "PWD $(pwd)"
+# Run the framework projects tests
+xcodebuild test -project "PsiphonTunnel/PsiphonTunnel.xcodeproj" -scheme "PsiphonTunnel" -destination 'platform=iOS Simulator,name=iPhone 7'
+rc=$?; if [[ $rc != 0 ]]; then
+  echo "FAILURE: PsiphonTunnel tests"
+  exit $rc
+fi
+
+# Run the sample app project tests
+rm -rf "SampleApps/TunneledWebRequest/TunneledWebRequest/PsiphonTunnel.framework" 
+cp -R "${BUILD_DIR}/PsiphonTunnel.framework" "SampleApps/TunneledWebRequest/TunneledWebRequest"
+xcodebuild test -project "SampleApps/TunneledWebRequest/TunneledWebRequest.xcodeproj" -scheme "TunneledWebRequest" -destination 'platform=iOS Simulator,name=iPhone 7'
+rc=$?; if [[ $rc != 0 ]]; then
+  echo "FAILURE: TunneledWebRequest tests"
+  exit $rc
+fi
+
+echo "TESTS DONE"