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?
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.
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.
Related
Am I correct in saying that Protractor must have the Protractor/Selenium Webdriver installed on the machine where the tests are being run but Angular Scenario runner executes within the browser?
I would essentially love to be able to run tests/scenarios remotely to give potential interviewers an insight into the behaviour/nature of a site I am developing.
I have used iMacros in the past, however, the tests weren't strictly portable between Firefox and Chrome?
Is my assumption about the difference between Protractor and Angular Scenario runner correct?
Thanks,
Mark.
Protractor wraps the WebDriverJS - javascript selenium bindings, and adds quite a lot on top of it, specifically to testing Angular sites but not necessarily. When you run Protractor, you need your application to be served and accessible, you may need to start the selenium server or use the direct connect feature available for Firefox and Chrome, see also:
Difference running Protractor with/without Selenium?
Protractor: How it works?
Angular Scenario runner on the other hand is something you should not be considering - it is currently deprecated and is in the maintenance mode.
Am I correct in saying that Protractor must have the
Protractor/Selenium Webdriver installed on the machine where the tests
are being run but Angular Scenario runner executes within the browser?
If you are using NPM then you can have Protractor/Selenium Webdriver as local dependencies. They don't have to be installed globally. See https://github.com/angular/protractor.
I would essentially love to be able to run tests/scenarios remotely to
give potential interviewers an insight into the behaviour/nature of a
site I am developing.
Do you mean a live demo of the site using protractor or something like that to show the workflows and usecases? If so then you might be over engineering the solution. A Youtube video would have the same effect.
I have used iMacros in the past, however, the tests weren't strictly
portable between Firefox and Chrome?
Protractor tests are portable, you just need the correct webdrivers and make sure to point to the browser binaries.
Is my assumption about the difference between Protractor and Angular
Scenario runner correct?
I cannot answer this. I don't know enough about Angular Scenario Runner.
I would advise against it though as it is depreciated, see note at top of page https://docs.angularjs.org/guide/e2e-testing.
I'm using Microsoft.Silverlight.Testing and MS Tests for the silverlight testing.
Is it possible to run the silverlight unit tests with a Bamboo CI server?
I've found the way how to do this.
There is a good project StatLight which allows to run Silverlight unit tests inside the embeded container.
I have written xUnit tests for my C# solution.
Visual C# Express does not integrate with unit test tools, so people usually use external tools, and indeed I have used the external xUnit test runner so far.
But now I would like to debug a particular test within Visual C# Express, because this test crashes the xUnit test runner.
I am thinking of creating a dummy executable project that just references the unit tests project and calls the test.
Any smarter idea?
If you're willing to upgrade to Visual Studio 2012 Express for Windows Desktop, you can use the xUnit.net runner for Visual Studio 2012. Otherwise you might be able to attach to the test runner's process (Debug -> Attach to process...) and debug it that way.
I'm not sure if this functionality exists in the Express version, but you should be able to do Tools -> Attach To Process, then attach to the xunit test runner application (make sure it's running). Place a breakpoint in one of your tests, and when you Run the test(s) in the xUnit Test Runner, you should be able to debug like normal.
We have a WinForms application that we're planning to port to Silverlight. Obviously the UI will need to be totally rewritten, but we have a lot of business logic that's well-tested with NUnit tests. We use ReSharper to run the tests inside the IDE, and nunit-console to run the tests on the continuous integration machines.
As we start moving our business-logic classes into Silverlight assemblies, how do we get these unit tests to run against those Silverlight assemblies? My understanding is that NUnit can't run Silverlight tests without significant tweaking, and said tweaking (in the form of a project template) appears to be VS2008- and Silverlight 3-specific (we'll most likely be using VS2010 and Silverlight 4 for our port).
We can move our tests to another testing framework if that's the best option, but there doesn't seem to be much else besides NUnit. The Silverlight Unit Test Framework looks like it runs inside the browser, which is a non-starter for continuous integration.
I'm aware that Silverlight 4.0 assemblies can be loaded into a .NET 4.0 executable, but I'm unsure of what this means for unit testing. Would it work to compile our business-logic assembly as a Silverlight 4.0 DLL, and write a full-framework .NET 4.0 NUnit test assembly that references the Silverlight DLL? It seems like this might work, but has anyone done this successfully with unit tests?
Bottom line, what should we do for our unit tests? We need a solution that
still lets us run tests in the ReSharper test runner;
can also be run from the command line;
works in VS2010.
We don't instantiate any UI objects in our tests, so those pesky DependencyObject threading issues aren't a concern. We just need to test our Silverlight business logic.
Not sure if NUnit is supported or how difficult it would be to add, but you might check out http://AGunit.codeplex.com for ReSharper Silverlight support.
I wrote a little tool to C.I. silverlight tests and attempt to help in normal dev/tdd scenarios - you can go check out http://StatLight.codeplex.com.
You should be able to find an NUnit build for silverlight out there (there's a few). Not sure of any runners that work with NUnit in the browser. However StatLight can run some basic NUnit functionality for you.
Hope this gives you a little help.
HI All
Is there a version of Reshaper that can be used to run Silverlight unit test. I am using Resharper 4.5 although it shows test icons against test methods in the class, but it does actually run the test.
Thanks
I'm the author of the AgUnit plugin.
Silverlight 3 support is currently working if you build the plugin from source, a new release is coming in the next couple of weeks.
If you want to run the tests on a build server, you should take a look at StatLight: http://statlight.codeplex.com/ You should be able to set it up easily with TeamCity.
Update: Silverlight 3 support should be working in the new 0.2 release of AgUnit.
I doubt it, although I am happy to be proven wrong. The test runner for MS Silverlight Unit Test suite is actually a Silverlight app, that runs in the browser. This is done in order to simulate the Silverlight runtime environment, which is different from desktop runtime.
Try this:
http://agunit.codeplex.com/