1 / 14

Jasmine Spice

The unknown spice girl. Aka NineCollective Jasmine Testing. Jasmine Spice. Setting up Jasmine. In Command Prompt type InstallGems.bat. Rebuilding for test run. If you make changes to or create a new viewModel run rake asset:compress in Git Bash.

otis
Télécharger la présentation

Jasmine Spice

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The unknown spice girl. Aka NineCollective Jasmine Testing Jasmine Spice

  2. Setting up Jasmine • In Command Prompt type InstallGems.bat

  3. Rebuilding for test run • If you make changes to or create a new viewModel run rake asset:compress in Git Bash. • This will later be done automatically.

  4. Run the test server • To set up the server and run the tests type rake js:server. • This will run the test server.

  5. Getting the port number • You find the port number for localhost after you run js:server

  6. Capturing the Browser • In your browser go to localhost:port number. • Click Capture the Browser

  7. Captured Browser

  8. Run the tests • Type rake js:run in a different Git Bash to run the tests.

  9. Auto running Jasmine tests on file change • Instead of rake js:run you can do rake js:auto to run the tests automatically if you have growl installed • Must have Growl installed and running. • www.growlforwindows.com

  10. Setting up a Spec • It() sets up a spec for testing. • To create a Spec you would type it(‘Meaningful Description’ function () { code to run goes inside here.}) • Inside the Spec you would use expect( Item to Test ) . Matcher to use. • You can disable a Spec by using xit() instead of it().

  11. Setting up a Suite • Group your specs into suites. • To set up a Suite you use describe(). • The suite set up looks like this describe( ‘Suite name’, function () { Then a call do the different Specs you will be testing }). • The Suite name will be reported when Spec is ran. • Suites are ran in the order that the describe calls are made.

  12. Setting up a Suite (cont.) • You can call variables within a describe block that are accessible by the Specs • If you create a global variable it will not be reset between each Spec call. • To initialize a variable between each Spec use beforeEach(). • Suites can be nested. • You can disable a Suite by using xdescribe() instead of describe().

  13. Matchers • Matchers are used to test a certain outcome. • You can define your own Matchers to assert a more specific expectation. • A matcher function gets the value from this.actual. • You can pass as many arguments as you want into the function call. • It returns a Boolean value.

  14. The way we use Jasmine • We use nested Suites to test each part. • descirbe({ • Describe({ • Describe({ • })})

More Related