Skip to content

Commit

Permalink
Testing + CI (#25)
Browse files Browse the repository at this point in the history
* Track UnityTestTools
* Add initial integration tests for Room and Message
* Add Travis CI scripts
- Per https://github.com/watson-developer-cloud/unity-sdk/blob/develop/.travis.yml
* Moves APIConstraints to Resources so it works outside the editor
* Switch gitmodules to public URLs
* Cache Unity folder on Travis
* Update README.md
  • Loading branch information
RichLogan committed Feb 2, 2017
1 parent e8adf0c commit 58207ad
Show file tree
Hide file tree
Showing 234 changed files with 11,545 additions and 13 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: objective-c
osx_image: xcode61
rvm:
- 2.1.2
cache:
directories:
- ./Unity
before_install:
- chmod a+x ./Travis/installUnity.sh
install:
- ./Travis/installUnity.sh
before_script:
- chmod a+x ./Travis/getSDK.sh
- chmod a+x ./Travis/runTests.sh
script:
- ./Travis/getSDK.sh
- travis_wait 15 ./Travis/runTests.sh
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cisco Spark SDK for Unity
# Cisco Spark SDK for Unity [![Build Status](https://travis-ci.org/RichLogan/CiscoSpark-UnitySDK.svg?branch=master)](https://travis-ci.org/RichLogan/CiscoSpark-UnitySDK)
Native Cisco Spark SDK for Unity 5.4+

You can follow the progress + development of this here: https://trello.com/b/BvpwAZYd/unity-spark-sdk
Expand Down Expand Up @@ -29,8 +29,8 @@ It provides:
1. Import the scripts or UnityPackage.
2. Place the `Cisco Spark Manager` prefab from Cisco/Spark/Prefabs into your scene.
3. Set the `AuthenticationString` variable of the `Request` component in the Inspector.
- Your `AuthenticationToken` or your bot's token can be found at http://developer.ciscospark.com
- Support for integrations is coming
- Your token (or your bot's token) can be found at http://developer.ciscospark.com
- Support for integrations/OAuth is coming!

## Quickstart

Expand Down Expand Up @@ -106,8 +106,6 @@ public class Spark : MonoBehaviour {
```

## Tests
Unfortunately, there is a lack of support for running Asynchronous operations in the Unity Test Tools, and I still need to write proper unit tests for the non-async parts of the SDK.
Instead, there are `MonoBehaviour` test scripts included that will run chains of requests. To run them, just attach any of the `Test*` scripts to a GameObject, and the results will be outputted to the console.
Some of them require known and existing Person IDs to be added (as I can't generate Person objects without admin rights on a Spark instance.)
Tests can be run by cloning from this repository (with `--recursive`) and opening the SparkIntegrationTests scene in Cisco/Spark/Tests. All tests can then be run using the Unity Integration Test Runner by selecting Integration Tests Runner from Unity Test Tools.

**Note: This will create/edit/destroy real test rooms/memberships/etc on the given Spark account, but they will clean up after themselves if possible.**
9 changes: 9 additions & 0 deletions SparkUnity/Assets/Cisco/Spark/Resources.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions SparkUnity/Assets/Cisco/Spark/SparkResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,9 @@ void Awake()
Instance = this;

// Load API Constraints from resource file.
string contents;
using (var streamReader = new StreamReader("Assets/Cisco/Spark/ApiConstraints.json"))
{
contents = streamReader.ReadToEnd();
}
ApiConstraints = Json.Deserialize(contents) as Dictionary<string, object>;
var contents = Resources.Load("ApiConstraints") as TextAsset;
ApiConstraints = Json.Deserialize(contents.text) as Dictionary<string, object>;
ApiConstraints = ApiConstraints["apiConstraints"] as Dictionary<string, object>;
}
}
}
}
Loading

0 comments on commit 58207ad

Please sign in to comment.