Skip to content

Running Automated Tests

Boris Vidolov edited this page May 29, 2014 · 11 revisions

General Information

#####The ADAL.iOS library has two sets of automated tests:

  1. Internal unit tests. They test the internal logic and try not to rely of the presence of remote authority servers. The tests are built as part of the library. At the moment xCode supports running of logic tests only on the simulator. The only tests within these that actually attempt to reach to the server are the authority validation ones. There are 100+ of these tests and all of them run in less than 30 seconds.
  2. End to End (E2E) tests. These tests attempt to verify whole scenarios like obtaining a token against a real server, after validating the authority and ensuring that the cache and cookie state is appropriate. There are only a few of these tests and they are built as part of the sample project. These tests take a bit longer to run ~1 min. E2E tests can run on actual device.
    Both of these test types run automatically on pull requests on Travis. If you submit a pull request, you can check the Travis status (an icon next to the latest checkin).

Running Unit Test

  1. Open the ADAL project in Xcode
  2. Select ADALiOS as a target from the targets drop down.
  3. Click on the "Show test navigator" icon on the navigation pane on the left.
  4. Select ADALiOSTests.
  5. Press the run button that appears when you hover the mouse over the selection. Alternatively, you may run of the test classes or even individual tests. Tests that fail will have a red icon displayed in the test navigator. Test failures will show in the code and in the "Issue navigator".
    A quick way to run all tests is to press Command-U, which is equivalent to Product/Test from the menu.
    Improtant: The unit tests can run only against simulator, not on an actual device. This is an Xcode limitation.

Running E2E Tests

  1. Open the ADAL project in Xcode
  2. Select MyTestiOSApp as a target from the targets drop down.
  3. Click on the "Show test navigator" icon on the navigation pane on the left.
  4. Select MyTestiOSAppTests and proceed the same way as the unit tests. You can run the E2E tests on real device too.

Pointing the E2E tests to your own server/tenant

The test data for E2E tests is controlled by the file Samples/MyTestiOSApp/MyTestiOSApp/TestData.plist. Feel free to edit this file to point to your own server with your own username and password, if you would like to make sure that your server-side setup is working.