• Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 13 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

titanium-jasmine provides testing for Appcelerator’s Titanium Mobile applications using Pivotal’s Jasmine as the core testing framework.

titanium-jasmine

titanium-jasmine provides testing for Appcelerator’s Titanium Mobile applications using Pivotal’s Jasmine as the core testing framework.

How it works

Titanium Mobile translates your hard won JavaScript skills into native applications that perform and look just like they were written in Objective-C (iPhone and iPad) or Java (Android).

Jasmine is a BDD-style framework for JavaScript that makes your tests look awesome:

describe("titanium-jasmine", function() {
  it("should help you develop titanium applications", function() {
    expect(yourTests).toBe('awesome');
  });
});

titanium-jasmine puts together Jasmine and Titanium Mobile, so you can write Jasmine tests that will run inside your iPhone, iPad and Android applications. titanium-jasmine is a really simple testing framework that will help you test your Titanium Mobile applications properly.

Instead of trying to mock all Titanium.* objects and functions, titanium-jasmine will run the tests on your simulator so you can keep using Titanium includes and helper functions on your code, thus making testing much easier.

* Screenshot: titanium-jasmine test results on the iPhone.

* Screenshot: titanium-jasmine test results on Android.

Features

titanium-jasmine supports all Jasmine features from suites, specs and matchers to asynchronous testing, spying/mocking/faking and before/after functions.

How to start the project

Download the source code, go to the project root and type:

$ make run-iphone

* Tested with all Titanium Mobile SDK versions from 1.5.0 to 1.6.1. To change the SDK version, change the TI_SDK_VERSION configuration in the bin/titanium.sh script.

To run the application on the iPad, type:

$ make clean && make run-ipad

To run the application on Android, type:

* You must have android, applicable sdk versions, and at least one emulator device created and running.

$ make clean && make run-android

* You just have to use “make clean” before the run command if you change the device type. If you’re using the same device between executions, it’s not necessary to execute “make clean” because it will force Titanium to re-compile the entire project again, which is considerably slow.

To run the application executing the tests, go to project root and type:

$ make test-iphone

Or:

$ make test-ipad

Or:

$ make test-android

* Remember to execute “make clean” whenever you change the device type.

You don’t have to import the project on Titanium Developer. You can do that if you want, but I prefer to start from the command line. If you want to do this in your project too, just copy Makefile and the bin directory to your project.

How to use in your projects

This project comes with a sample application located in the SampleApp directory. You can inspect this sample app to understand how the testing structure works.

To use titanium-jasmine in your projects, just copy the SampleApp/Resources/test folder and modify the files accordingly.

Here are some details about some key files and directories:

  • SampleApp/Resources/test/enabled.js is the file that controls if the application is in “test mode” or not. This file does not exist in the repository because it is created by the “make” script. When you start the application with the “make” command, this file will be created containing the configuration to start the test runner or not. If you want to know more about this, take a look at the Makefile file in the project root. The Makefile requires bin/titanium.sh script to run.
  • SampleApp/Resources/test/test_main.js is a sample file that contains the actual tests. You can (should) create as many files as you want, just remind to import all the modules on tests.js.

More info

If you want more info about how to use Makefiles in your Titanium Mobile projects, please take a look at my blog post about it.

If you want to see how I use titanium-jasmine on a real production project, please take a look at Yahoo! Meme’s source code on GitHub.

If you have any other questions, please contact me through Twitter or e-mail.

License

titanium-jasmine is licensed under Apache Public License (Version 2). See LICENSE for more details.

Developed by Guilherme Chapiewski. Android support by Linus Graybill.

More Repositories

1

simple-db-migrate

simple-db-migrate is a generic database migration tool inpired on Rails migrations.
Python
197
star
2

titanium-cache

titanium-cache provides caching for Appcelerator’s Titanium Mobile applications.
112
star
3

correios-api

API Ruby e REST para obter informações de encomendas/Sedex dos Correios.
Ruby
60
star
4

fluent-mail-api

Fluent Mail API is a simple Java API that uses Sun's JavaMail API and a fluent interface/internal DSL to send e-mail messages.
Java
38
star
5

yql-ios

Objective-C library that provides YQL connectivity for iOS applications.
Objective-C
37
star
6

correios-api-py

API Python para obter informações de encomendas/Sedex dos Correios.
29
star
7

git2svn

Migrate a Git repository to SVN preserving history (yes, you read it right)
Shell
25
star
8

meme-py

Python client for Yahoo! Meme
Python
16
star
9

django-supermodels

Model extensions for Django to provide dynamic finders.
Python
10
star
10

pyccuracy-tmbundle

Pyccuracy TextMate bundle.
8
star
11

jquery-meme

JQuery plugin for Yahoo! Meme
JavaScript
6
star
12

correios-macosx-widget

Widget do Dashboard (Mac OS X) para rastreamento de encomendas dos Correios.
JavaScript
5
star
13

cruzalinhas-ios

CruzaLinhas para iOS.
JavaScript
3
star
14

git-repository-extractor

Extracts subdirectories of a Git repository into smaller and separate repositories.
Shell
3
star
15

youtube-yql-api

Google App Engine service used as the backend for YouTube YQL tables.
Python
2
star
16

meme-ios-backend

Backend application for Yahoo! Meme iOS apps.
Python
2
star
17

ynspector

ynspector inspects a given directory and runs a command everytime a file is changed.
2
star
18

pyccuracy-presentation

Pyccuracy presentation stuff.
Ruby
2
star