You can either run individual jasmine spec files and check the result from within your Django test suit or open an url from your devserver and run all specs at once, checking the result on the webpage.
Add 'djasmine' to your INSTALLED_APPS:
INSTALLED_APPS = [ ... 'djasmine', ]
Include the djasmine URLconf in your project urls.py like this:
Add the following to your project settings:
import jasmine_core JASMINE_SPEC_ROOT = BASE_DIR + '/path/to/spec/files' STATICFILES_DIRS = [ jasmine_core.__path__, JASMINE_SPEC_ROOT, ]
For more specialized needs you can provide your own 'djasmine/specrunner.html' template.
Running Jasmine specs from Django tests
Create your Django tests by using djasmine.testcase.JasmineRunnerTestCase as base class for your test cases. There is one required class property, webdriver, that should specify the Selenium WebDriver class you wish to use for the test, e g selenium.webdriver.firefox.webdriver.WebDriver.
Run and check result of a Jasmine spec file with the assertSpecPasses method, which takes one argument: the name of your spec file.
from djasmine.testcase import JasmineRunnerTestCase from selenium.webdriver.firefox.webdriver import WebDriver class MyIntegrationTest(JasmineRunnerTestCase): webdriver = WebDriver def test_all_works_nicely(self): self.assertSpecPasses('my_tests.spec.js') # Runs everything in this spec file and checks result ... (other checks of backend state possible here) ...
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.