Can chutzpah run qunit tests from a url? - qunit

Can Chutzpah run qunit tests from a url? I need a lot of server-side injected markup and json data in my qunit tests, so I like to run the test suite within my visual studio project on localhost instead of mocking tons of test data in my test.js files.

As of version 2.4 Chutzpah now supports running against a remote url. See the documentation here.

Maybe it helps to share our testing strategy.
We use chutzpah for javascript unit tests. No dependency on a running server. The tests run very quickly as part of the build. (But we are not testing generated javascript code which is your scenario).
We test against running server by writing tests in JavaScript and running them with PhantonJS. See my answer for an example of one of our tests: automated functional web GUI testing frameworks (asp.net)
If you don't like writing the tests in Javascript like this (it is not as nice as using a unit testing framework - like qUnit or jasmine) you could checked out CasperJS.

Related

testing with Protractor Selenium Cucumber in a maven project

We use Cucumber with selenium in a maven project to automate our functional tests and Jenkins for the continuous integration,
Now we start to use AngularJS front-end in the project
I'm not sure if it's a good idea to start using Protractor ?
if yes how can we use'it in the same maven project along side with cucumber?
Protractor is not java based. You need to use Javascript/nodejs in order to run Protractor. Normally in nodejs, there are separate task runners or build tools, such as Grunt/Gulp/Webpack. There might be a way you can leverage to run protractor with maven: https://github.com/greengerong/maven-ng-protractor
IMHO if your application is pure angular application, protractor can provide you some level of conveniences, if your application is in the middle of migration, I rather stay with what you have right now, to me, it doesn't provide much business value on migration from selenium to protractor.

Bamboo and Web UI Testing

We have a node.js project that we are building with Atlassian Bamboo. We are doing CI/CD, or that's the plan. We are using Mocha to do Unit/API testing. But I didn't see anything in the task types to do web UI testing. We have used Selenium in the past, and that was the idea this time as well. But there is no nice, easy to use test runner and parser, as there is with Mocha.
Anyone have any experience with this in Bamboo? Any suggestions on how to do this?
I am using Selenium with Bamboo and I have configured Maven plugin and TestNG Parser . You can pass Selenium Grid URL/Base URL etc in environment variables.

NUnit and Selenium WebDriver

I was working on setting up Selenium in a project today, and the thought came to mind: "Should I be using the NUnit framework in correlation with my Selenium tests?"
Here's my concern with using the NUnit framework: From the NUnit website, it states that: "NUnit is a unit-testing framework for all .Net languages". The purpose of the framework is to build unit tests, not integration tests.
Selenium tests are typically (I don't know of any instance when they aren't) integration tests. So, going back to my question, is it good practice to use a unit testing framework to do integration tests? Are there integration test frameworks that are robust enough to compete with NUnit, of which would be more appropriate?
The two main options for .NET development are, for the most part, NUnit, and MSTest. IMHO, neither are very well optimized for automated browser tests.
You can force each to do what you want, but features such as TestNG's #DataProvider are a pain to implement, especially if you are dynamically changing your data provider for each test (say, loading your browsers to test through a properties file) -- this is trivial with TestNG, but NUnit and MSTest take a significant amount of "hacking" to make it work.
TL;DR version: Someone really needs to port TestNG over to .NET :)

Mocha tests in browser to output xunit reports

I'm running a set of tests with mocha and i need the tests to run in the browser, therefore ; i'm doing this :
mocha.setup('bdd')
the tests do run fine in the browser, but i need this to be executed in jenkins. I must run the tests in the browser and i'm trying to get the reporter to output xunit reports .
i've tried the xunit-file package and another one called "mocha-multi" , it looks like browser tests only support the html reporter. Is there a way to output both the xunit and browser reports? or at least to execute the tests in the browser and report xunit results?
so there is no way to have two reporters if you're running the tests in the browsers and not in node js. After digging into mocha,i realized that there is a tests results variable as part of the mocha objects that you can instantiate in the browser. You need to use this to actually access the resutls and write the report yourself.

Running unit tests and integration tests separately using MSTest

We use Visual Studio 2010 Ultimate with tests written in MSTest. Both our unit tests and integration tests* are written in MSTest.
**By our definition, an integration test is an MSTest TestMethod that takes a while to run and/or calls out to external components such as a database or web services.*
I'm looking for a way of easily filtering out the integration tests so that only unit tests run without all the integration tests running too.
My ideas so far:
Mark integration tests with the [Ignore] attribute. This works but is a real pain when you do want to run the integration tests.
Assign a [TestCategory] attribute to the different test types. This allows them to be run separately but only through the Test View panel. You can't use CTRL+R, A (Run All Tests in Solution) or other similar shortcuts/hotkeys.
The integration tests are in a separate project, is there something that could be done to stop them running at the project level? As long as it's easy to toggle.
Write the integration tests in a different test framework, e.g. NUnit. This would keep them totally separate from a tooling point of view.
Does anyone have any other suggestions? Are there any plug-ins that can help with this?
I recommend having a different project (or projects) for integration tests because depending on your runner the only real way to run or not run tests across all runners is to include or not include a test class library.
But, I also recommend, if you're using MSTest, to use the TestCategoryAttribute to tag non-unit tests. You can then "filter" tests to be run in Test View with MSTest.
Runners like Resharper and apparently TestDriven.net (http://bit.ly/tmtYC2) allow you to then filter-out those tests from general unit-test executions.
If your unit test project is in a separate namespace, you could use the keyboard shortcut CTRL+R, T to run all tests in the current context (i.e. namespace MyApp.Tests.Unit). To do this place the cursor just after the opening curly brace in the namespace clause of any unit test class.
I have a suggestion but you won't like it.
Abandon MSTest entirely, while other unit test frameworks have been evolving MSTest as almost stopped in time. Yes, it has a major benefit of integrating directly with VS, but if I'm not mistaken that will change in VS 2011 which will provide native support for custom unit test runners integration.
(Note: The stopped in time part may be not true because I confess not paying to much attention to MSTest since I used it sparingly with VS 2008)
I use NUnit and separate my unit tests from the integration tests by using a different class library project. Then I automate the running of the tests using Gallio command line runner allowing me to configure separate scripts for running unit and integration tests.
Finally, personal opinions aside, I'm not sure but the TestDriven.net plugin may have support for running tests with a specific category only, so you could check that.

Resources