8
Simple Unit Testing in Titanium Alloy Aaron K. Saunders CEO Clearly Innovative Inc @aaronksaunders

Simple Unit Testing in Appcelerator Titanium Alloy

Embed Size (px)

DESCRIPTION

Simple Unit Testing in Appcelerator Titanium Alloy using behave.js and the new titanium CLI for running the scripts

Citation preview

Page 1: Simple Unit Testing in Appcelerator Titanium Alloy

Simple Unit Testing in Titanium Alloy�

Aaron K. Saunders�CEO Clearly Innovative Inc�

@aaronksaunders�

Page 2: Simple Unit Testing in Appcelerator Titanium Alloy

First Thing… "�

•  Why Does Testing Even Matter?�

•  Find the bugs earlier and more often �

•  The automation of running the scripts help to ensure code changes don’t break things.�

•  Easier way of testing functionality �

Page 3: Simple Unit Testing in Appcelerator Titanium Alloy

Setup behave.js�

"   Create new “lib” folder in project if it does not exists�

"   Create a new file in that folder called “behave.js”�

"   Add the contents of this URL to the new file�

"   http://bit.ly/11IAjXB �

Page 4: Simple Unit Testing in Appcelerator Titanium Alloy

Setup Your Test Spec�

"   Create a new folder in assests called “specs”�

"   Create a new file called “test-spec-1.js”�

"   Add this to the file�

Page 5: Simple Unit Testing in Appcelerator Titanium Alloy

Setup Your index.js�

"   Add this code to index.js to run the test based on the deploy-type property�

Page 6: Simple Unit Testing in Appcelerator Titanium Alloy

Run the Titanium CLI �

titanium build --platform ios --deploy-type test �

"   See Appcelerator documentation for more information �

"   http://docs.appcelerator.com/titanium/3.0/#!/guide/Titanium_Command-Line_Interface_Reference�

Page 7: Simple Unit Testing in Appcelerator Titanium Alloy

References�"   CODESTRONG REPO�

"   https://github.com/appcelerator/Codestrong/tree/master/app/assets/spec�

"   https://github.com/appcelerator/Codestrong/blob/master/app/lib/behave.js�

"   This posting explained a more complex approach IMHO�

"   https://github.com/denvers/unit-test-titanium-alloy-project �

Page 8: Simple Unit Testing in Appcelerator Titanium Alloy

More Information �

Aaron K. Saunders�

Clearly Innovative Inc�

[email protected]

@aaronksaunders�

http://blog.clearlyinnovative.com�