1 How to run Unit Test
You shall not pass edited this page 2015-12-31 11:06:56 +01:00

The tests use third party framework.

Cocoapod must be installed to download the dependencies.

sudo gem install cocoapods

(close any xcode OAuthSwift project if opened) in OAuthSwift directory

 pod install

open workspace OAuthSwift.xcworkspace (not project OAuthSwift.xcodeproj)

To launch test, choose scheme OAuthSwiftTests and do Menu:Product then Test (Command U)

Configure for ServicesTests (Work in progress)

Like Demo-application you must have configured your key and secret

To add a new service test

You must complete the configuration file ServicesTest.plist by

  • adding a section, with all needed parameters and url if not already done
<key>Fitbit</key>
	<dict>
		<key>version</key>
		<string>1</string>
		<key>requestTokenUrl</key>
		<string>https://api.fitbit.com/oauth/request_token</string>
		<key>authorizeUrl</key>
		<string>https://www.fitbit.com/oauth/authorize?display=touch</string>
		<key>accessTokenUrl</key>
		<string>https://api.fitbit.com/oauth/access_token</string>
		<key>callbackURL</key>
		<string>oauth-swift://oauth-callback/fitbit</string>
  • adding into plist the javascript selector to find form element to login and then to authorise api
# for dropbox
<key>form_selector</key>
<string>form[id=&quot;login-form&quot;]</string>
<key>form_button_selector</key>
<string>button[name=&quot;submit&quot;]</string>
<key>form_username_selector</key>
<string>input[id=&quot;id_username&quot;]</string>
<key>form_password_selector</key>
<string>input[id=&quot;id_password&quot;]</string>
  • adding into ServicesTests the test method
    func testServiceName() {
        testService("ServiceName")
    }

PS: testBitBucket failed