Git Product home page Git Product logo

iq-scm / titanium-jasmine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guilhermechapiewski/titanium-jasmine

0.0 0.0 0.0 3.56 MB

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

Home Page: http://github.com/guilhermechapiewski/titanium-jasmine#readme

License: Other

Shell 3.28% JavaScript 96.72%

titanium-jasmine's Introduction

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.

titanium-jasmine's People

Contributors

graybill avatar guilhermechapiewski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.