Now that I picked Jasmine, how did I get started? Here is what I did (this post is a merging of many, many posts I looked at to get me pointed in the right direction)
Step 1: Create a new test project
Open up Visual Studio 2012 and create a basic MVC 4 application (empty)
Step 2: Get Jasmine
Install the Jasmine NuGet Package
Step 3: Run your application in order to validate that jasmine is running correctly
Yup, we are good
Step 4: Get Chutzpah
I wanted a way to run my tests inside of Visual Studio and this plugin seemed to do the trick. I opted to install the test adapter which can be found here
Step 5: Validate that Chutzpah adapter was setup correctly
As you can see from above, it is setup correctly.
Now I wanted to be able to author my tests in Typescript and have them run as well.
Step 6: Download the Jasmine typescript definition file. I put this inside my scripts folder as seen below
Step 7: Create my Test Spec
The trick to getting this to work of course is that I need to include the jasmine-1.2.d.ts definition file inside my .ts file as below
I also need to reference my class under test file inside my .ts file as below
Once I did both of these I could write my first test as below
Bam, now I have a jasmine test written via Typescript and runnable via the Chutzpah test running. Of course I am sure there are other ways to get this to work, this is just what worked for me.
Till next time,
12-23-2012 6:49 AM