{"id":4733,"date":"2012-07-09T03:25:16","date_gmt":"2012-07-09T03:25:16","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2012\/07\/09\/javascript-unit-tests-on-team-foundation-service-with-chutzpah\/"},"modified":"2022-07-22T08:47:07","modified_gmt":"2022-07-22T16:47:07","slug":"javascript-unit-tests-on-team-foundation-service-with-chutzpah","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/javascript-unit-tests-on-team-foundation-service-with-chutzpah\/","title":{"rendered":"Javascript Unit Tests on Team Foundation Service with Chutzpah"},"content":{"rendered":"<p>Significant investments were made in Visual Studio 2012 Unit Testing to make it extensible. A number of frameworks and test runners have built adapters for Visual Studio. Peter Provost maintains a list of Plugins <a href=\"http:\/\/blogs.msdn.com\/b\/visualstudioalm\/archive\/2012\/03\/02\/visual-studio-11-beta-unit-testing-plugins-list.aspx\">here<\/a>. For Javascript Unit Testing in Visual Studio, <a href=\"http:\/\/matthewmanela.com\/projects\/chutzpah\/\">Matthew Mannela<\/a> has released <a href=\"http:\/\/chutzpah.codeplex.com\/\">Chutzpah,<\/a> an open source Javascript Test Runner.\u00a0 Chutzpah has a test adapter for Visual Studio 2012. With this adapter, you can run QUnit &amp; Jasmine tests in Visual Studio.<\/p>\n<p>\u00a0<\/p>\n<p>To run javascript unit tests in Visual Studio Unit Test Explorer, you just need to install the Chutzpah Test Adapter for Visual Studio 2012 from the Extensions &amp; Updates dialog.<\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"\" width=\"511\" height=\"315\" \/><\/p>\n<p>\u00a0<\/p>\n<p>This article describes the steps required to enable running of these Javascript unit tests on Team Foundation Service [Hosted Build Agent].<\/p>\n<p>\u00a0<\/p>\n<p>1&#46; Download Chutzpah.VS2012.vsix from <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/f8741f04-bae4-4900-81c7-7c9bfb9ed1fe\">VS Gallery<\/a>.<\/p>\n<blockquote>\n<p>Rename it to Chutzpah.VS2012.zip.<\/p>\n<p>Extract all its contents.<\/p>\n<\/blockquote>\n<p>2&#46; Check in the following extracted files into source control in Team Foundation Service.<\/p>\n<blockquote>\n<p>a. Chutzpah.dll<\/p>\n<p>b. Chutzpah.VS2012.dll<\/p>\n<p>c. Chutzpah.VS.Common.dll<\/p>\n<p>d. Chutzpah.VisualStudio.Settings.dll<\/p>\n<p>e. Phantomjs.exe<\/p>\n<p>f. StructureMap.dll<\/p>\n<p>g. JSrunners\/ChutzpahRunner.js<\/p>\n<p>h. JSRunners\/Qunitrunner.js<\/p>\n<p>i. Chutzpah.VS2012.TestAdapter.dll<\/p>\n<p>j. Microsoft.VisualStudio.TestPlatform.ObjectModel.dll<\/p>\n<p>k. SassAndCoffee.Core.dll<\/p>\n<p>l. SassAndCoddee.Javascript.dll<\/p>\n<p>m. ServiceStack.Text.dll<\/p>\n<p>n. TestFiles\/qunit\/qunit.css<\/p>\n<p>o. TestFiles\/qunit\/qunit.html<\/p>\n<p>p. TestFiles\/qunit\/qunit.js<\/p>\n<p>q. TestFiles\/jasmine\/* if you are using jasmine tests.<\/p>\n<\/blockquote>\n<p>3&#46; In Visual Studio, Open Team Explorer &amp; connect to Team Foundation Service.<\/p>\n<p>\u00a0\u00a0\u00a0 Bring up the Manage Build Controllers dialog. [Build \u2013> Manage Build Controllers]<\/p>\n<p>\u00a0\u00a0\u00a0 Select Hosted Build Controller<\/p>\n<p>\u00a0\u00a0\u00a0 Click on Properties button to bring up the Build Controller Properties dialog.<\/p>\n<p>\u00a0<\/p>\n<p>4&#46; Change Version Control Path to custom Assemblies to refer to the folder where you checked in the binaries in step 2.<\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/07\/8284.image_thumb_3B31803F.png\" width=\"387\" height=\"404\" \/><\/p>\n<p>\u00a0<\/p>\n<p>5&#46; In Team Explorer, go to the Builds section and Edit your Build Definition which will run the javascript tests.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Click on the Process tab<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Select the row named Automated Tests.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Click on \u2026 button next to the value.<\/p>\n<p>6&#46; Select the Tests to Run and click Edit. Change the Test assembly specification to ***.js<\/p>\n<p>\u00a0<\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/07\/6204.image_thumb_2272332F.png\" width=\"305\" height=\"419\" \/><\/p>\n<p>NOTE: If you want to have a mix of C# unit tests and javascript unit tests, you can add another Test Run and use ***.dll as its Test Assembly file specification.<\/p>\n<p>7&#46; Create your Web application in Visual Studio and add your Qunit or Jasmine unit tests to them. Make sure that the js files (that contain the tests) are getting copied to the build output directory.<\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/07\/3630.image_thumb_1B7280AA.png\" width=\"368\" height=\"186\" \/><\/p>\n<p>\u00a0<\/p>\n<p>8&#46; Check in your project and the unit tests into Team Foundation Service. Add this project to the build which you modified in step 5.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 Now go ahead and queue your build.<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0 After the build completes, you will see that the javascript tests have been run and their results reported in the Build Summary.<\/p>\n<p><img decoding=\"async\" title=\"image\" style=\"border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2012\/07\/1452.image_thumb_17A4B60D.png\" width=\"527\" height=\"450\" \/><\/p>\n<p>\u00a0<\/p>\n<p>Mathew Aniyan<\/p>\n<p>Program Manager \u2013 Visual Studio ALM.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Significant investments were made in Visual Studio 2012 Unit Testing to make it extensible. A number of frameworks and test runners have built adapters for Visual Studio. Peter Provost maintains a list of Plugins here. For Javascript Unit Testing in Visual Studio, Matthew Mannela has released Chutzpah, an open source Javascript Test Runner.\u00a0 Chutzpah has [&hellip;]<\/p>\n","protected":false},"author":98,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4733","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"acf":[],"blog_post_summary":"<p>Significant investments were made in Visual Studio 2012 Unit Testing to make it extensible. A number of frameworks and test runners have built adapters for Visual Studio. Peter Provost maintains a list of Plugins here. For Javascript Unit Testing in Visual Studio, Matthew Mannela has released Chutzpah, an open source Javascript Test Runner.\u00a0 Chutzpah has [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/4733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/98"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=4733"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/4733\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=4733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=4733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=4733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}