Presentation is loading. Please wait.

Presentation is loading. Please wait.

The unknown spice girl. Aka NineCollective Jasmine Testing.

Similar presentations


Presentation on theme: "The unknown spice girl. Aka NineCollective Jasmine Testing."— Presentation transcript:

1 The unknown spice girl. Aka NineCollective Jasmine Testing

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({ ○ })})


Download ppt "The unknown spice girl. Aka NineCollective Jasmine Testing."

Similar presentations


Ads by Google