Visual Studio Unit Test Integration
Could you please provide a unit test platform integrated within Visual Studio Test Explorer and of course TFS builds.
I know about Chutzpah extension, but :
- it doesn't integrate well with VS
- it's very slow (iterating over the entire solution content)
- it doesn't follow the new tools for front/web dev (eg TaskRunnerExplorer)
I also know about Javascript Unit Test framework (QUnit, Jasmine), but they don't integrate with VS either.
Thanks
@chriscamicas, have you tried NTVS? It is an excellent resource.
import assert = require('assert');
export function myTest() {
assert.ok(true, "This shouldn't fail");
}
Definitely heard this before, surprised we didn't already have something logged for it. Edited the title for clarity.
@NoelAbrahams thanks for the link, seems a nice extension. I'll try it. @danquirk thanks
@NoelAbrahams I just took a look at NTVS, it's a really great plugin, wonderful integration with VS. But, in order to run the tests, it seems you need to create a specific NodeJS project.
In my case, I have a classic Asp.Net project (csproj) with TypeScript files inside... I can't use NTVS in this project (can't add unit test files). I should probably split my project in 2, one for the backend (keep Asp.Net), another for the front : move to NodeJS project to use this great tooling, but it lacks build mechanism for the front (gulp tasks in my case).
Anyway, TypeScript unit tests should be available in every project containing a TS file. This issue/suggestion would be a really great improvement.
@chriscamicas, it's probably good practice to keep your source and tests separate. NTVS, as the name implies, is primarily for writing server-side TypeScript (or JavaScript) and tests.
For client (browser) code, the best option at present is QUnit or similar (which as you say don't integrate with VS). I'm not really sure that I want browser testing to be integrated in Visual Studio; that sounds rather messy. I believe Chutzpah attempts to do that, but not very well as you state above.
@chrisbubernak I've found Chutzpah pretty strong inside VS for my own purposes - for what it's worth I'm writing Jasmine tests and I've found it performant enough. Though I am helping it along with a chutzpah.json file so maybe that's why. If you're curious you can see an example of how this works here
@NoelAbrahams - intrigued by your comment. Are you using a some kind of grunt / gulp filewatcher along with NTVS to do the running? Don't know if you've got an example you could point to?
@johnnyreilly, I haven't used Chutzpah, so you may be right there.
Are you using a some kind of grunt / gulp filewatcher along with NTVS to do the running?
Do you mean for running the tests? The tests just show up on Test Exporer and they can be run from there.

Yes I did mean running the tests (Chutzpah similarly drops them into Test Explorer). I think I'll investigate NTVS further...
Don't know if you've got an example you could point to?
The steps are:
-
Install NTVS.
-
Create an NTVS project. A "Blank Node.js Web Application". (They should be found under TypeScript).
-
Add a new file of type "TypeScript UnitTest file".
-
Add the test case
import assert = require('assert'); export function myTest() { assert.ok(true, "This shouldn't fail"); }NB: You will need to import your SUT from where you have it defined.
-
Build the project.
-
Open up Test Explorer and the test
myTestshould show up.
NTVS does the file system watching etc. and updates the test explorer when changes are made.
Sweet!
FYI - NodeJS developers had forked the source code into io.js as of last Tuesday (Dec 2nd, 2014) due to their frustrations with "manager" 's iron grip control over source code in GitHub. The "manager" wouldn't accept their bug fixes and coding improvement, so their frustration had boiled over.
I do not know if NTVS will stick to NodeJS or io.js down the road.
Just giving you head up. ;-)
This is out of scope of this repo. We would love to see this end-to-end integration happening though. The TypeScript core team does not have resources to address all such requests. We would be happy to work with any interested parties to facilitate the solution in any way possible, but I do not think we can take on such feature at the time being.
@NoelAbrahams thank's for the link to NTVS and explanation :+1: