11

I have been trying to figure out what is the best way to write/run automated jasmine tests in visual studio. Currently, I am using jasmine with Resharper (using PhantomJS) and the test can be run from visual studio. Now I want to run the tests as part of continuous integration and very are using TFS. Searching online give me few options which made me rather confused.

1) Use Chutzpah as a test runner to execute jasmine tests.

2) Use Karma as a test runner (but it also requires Chutzpah test adaptor for visual studio).

I get the feeling that using Karma is somewhat better than anything else but I couldn't understand the benefits of Karma instead of just using Chutzpah. Can anyone please clarify what should be the usage?

tangokhi
  • 945
  • 2
  • 8
  • 20

2 Answers2

19

DISCLAIMER: I am the author of Chutzpah so take anything I say with a pinch of bias.

Both Karma and Chutzpah are both good tools to be able to run JavaScript unit tests. Karma is the more active open source project and has a large group of people contributing to it. It is very configurable and lets you (as Sean says) target browser besides Phantom. There are VS plugins for it as well but I have not used them much.

Chutzpah is a mature product that is also very configurable. It will always run your tests in PhantomJS but does let you open them in a new browser in order to debug. Chutzpah VS integration is mature and seamless.

Matthew Manela
  • 16,572
  • 3
  • 64
  • 66
  • is there a way with to run the test when a test/file is modified in chutzpah like autoWatch in karma? – KKS Mar 09 '16 at 23:16
  • If using Visual Studio yes, but from the command line not yet. I plan to add this feature eventually though – Matthew Manela Mar 11 '16 at 20:28
  • @MatthewManela How do you make the tests run when a file is modified within Visual Studio? – Brendan Murphy Sep 26 '16 at 23:09
  • There is an option in the test explorer that says "run tests after build". This is unfortunate wording but for Chutzpah means "run tests after save" – Matthew Manela Sep 28 '16 at 01:15
  • @MatthewManela I am sorry I went to the link https://github.com/mmanela/chutzpah/wiki/Chutzpah.json-Settings-File and tried to find out "run tests after build" property I could not find it . Can you point me to some sample where do we put this property and what is exactly its name in chutzpah.json ? – Rupesh Kumar Tiwari Mar 03 '17 at 22:29
  • It is not in the chutzpah.json, it is in the Test Explorer UI in Visual Studio. – Matthew Manela Mar 04 '17 at 05:54
-1

The biggest benefit of Karma over Chutzpah is it can be configured to use Chrome (or any other browser) to be the test runner which makes tests a lot easier to debug with browser developer tools.

Sean.W
  • 43
  • 3