Integration testing for Javascript Code - javascript

I've written a lot of javascript code that interacts with a number of different web services. I now need to write integration testing code for it. My experience with integration testing is limited. Could anyone recommend some good tools and online tutorials?

look at this post this may help you i guess... http://robots.thoughtbot.com/post/4026880618/javascript-integration-testing-example-installing-and

We use cucumber http://cukes.info/ so we create functional testing that tests integration with server too.
cucumber runs with ruby, if you want to do it with JS try cucumberjs or a combination of zombiejs and jasminejs. NodeJS required

Related

Test Driven JavaScript Development with Django vs Node.js

I have a web project coded 80% in JavaScript and 20% in Django without a single unit testing as I rushed for Minimum Marketing Features. Now that the project is getting funded, I decided to invest some time to introduce TDD. I had a great deal of inspiration from this KickStarter-funded tutorial.
http://www.letscodejavascript.com/
The author uses Node.js, Jake, Lint, Nodeunit, and Karma to simplify the whole integration process. The server/client tests in all major browsers is done in a single command and I was really hooked to this idea, but it requires switching to Node.js.
I've searched for TDD in Django and ran into this tutorial that makes use of Selenium.
http://www.tdd-django-tutorial.com/
However this TDD was primarily based on unit testing in server. Here are the questions.
Can multiple client JavaScript testing be done in Django/Python?
I assume the answer is no since js files are nothing more than static library in Django. Correct me if I'm wrong.
Is it worth using Node.js just for the sake of TDD Javascript?
My logic was either you use Python or Node.js for the server, but since tools like Karma and Buster.js requires Node.js, I was wondering whether setting up the Node.js alongside Django just for multiple client testing is plausible choice when considering lower cost of maintenance.
Thank you :D
You can take a look at using selenium in your django test suite. Django's official docs cover this in moderate detail
To answer your question about Node.js - I would say that it's probably not worth the complexity to add node.js SOLELY for the purpose of running unit tests. Also, since your javascript is likely built to run in a browser, it's less likely that things will break down if you use a tool like selenium (which runs the code in an actual browser, providing a python scripting interface).

Is it possible to use Testacular for non-AngularJS app for end-to-end testing

I'm building a simple app and want to use Testacular as the test runner. Testacular is simple to setup for unit testing but the possibility of using it for e2e also seems great, however my app will not be in AngularJS. Is this possible (or simple) to do or should I be looking more towards Selenium?
Yep! From Testacular's GH Page:
Testing Framework Agnostic
Describe your tests with Jasmine, Mocha, QUnit. Or write a simple adapter for any framework
you like.
Since the aforementioned testing frameworks aren't library-dependent, it would make sense that as long as you can test your library code using one of those frameworks you can use testacular to provide a test-runner for it.
That being said testacular is not selenium. It allows you to test your code in a browser environment but as far as I know doesn't provide navigation, DOM Querying, user-emulation etc. like selenium does. If you're looking for selenium functionality for your JS code you should check out Soda which is an awesome library written by TJ and the rest of the gods on Mt. Olympus ::cough:: I mean developers at LearnBoost that provides a JS adapter for selenium's wire protocol, among other things.
But if you still think testacular is the way to go then take a look at their sample configuration file which should get you started in the right direction. Hope this helps!

Continuous JavaScript Testing

Does anyone know of a good JavaScript testing tool which integrates automated testing with your Testing Framework of Choice. I am aware of TestSwarm (which is not automated testing) and Travis-CI (which isn't really available for closed-source projects).
Any other ones out there?
You can use Selenium:
Its test can either be generated by its IDE, or can be written in high level languages such as Java, PHP, etc.
Its can be instantiated from a Command-Line.
Its can be integrated with continuous-integration servers like Jenkins (In-build plugin).
The fact, that it can be instantiated from command-line (preferably written in java), makes it integrable by any CI Server
Two that I know of (although I'm not sure they are really meant for this purpose...) are Simple Test js and the MIT project Sikuli. Sikuli is great for making a cursor click on things and test out the user interactions. Neither one of these naturally will integrate well with your testing framework of choice but they will certainly allow you to write unit tests. Hopefully someone else will know of a better solution.

unit testing ajax in .net

How you test ajax? What do you use?
Share information.
For me, testing ayah was torture.
I'm using jsUnit and mockajax but, nothing works...
help me please.
I know this question is a bit old, but I just wrote a framework for doing JavaScript unit testing (and coverage) in .net. So just write your ajax unit tests in what ever JS framework u want (like qUnit, JSUnit, closure, etc) and use my project to provide bindings to .Net. Allows you to use Visual Studio and your standard CI tools to run your tests.
https://github.com/gatapia/js.net
Let me know what u think.
Thanks
Guido

Looking for Info on a Javascript Testing framework

Hi Can somebody fill me in on JavaScript Testing Frameworks?
I'm working on a project now and as the JS (Mostly jQuery) libraries grow, it's getting more and more difficult to introduce change or refactor, because I have no way of guaranteeing the accuracy of the code without manually testing everything.
I don't really know anything about JavaScript Testing Frameworks, or how they integrate/operate in a .Net project, so I thought I'd ask here.
What would a good testing framework be for .Net?
What does a JavaScript test look like? (e.g. with NUnit, I have [TestFixture] classes & [Test] methods in a ProjectTests assembly)
How do I run a javascript test?
What are the conceptual differences between testing JS & testing C#?
Is there anything else that would be worth knowing?
Thanks
Dave
As for jQuery testing(and Javascript testing in general) you should maybe take a look at QUint, jQuerys testing suite. You simply include a couple of javascript-files, and a css-stylesheet, write your testes in the same document(or if you want to include them of course), and open the document. The testing framework sets up the page, and lets you run the test.
As for implementation with C# and .Net I can't help you.
Already lot of questions (and replies) about this subject on stack overflow:
The most complete: What are some JavaScript Unit Testing and Mocking Frameworks you have used?
Looking for a better JavaScript unit test tool
Javascript Unit-testing?
You should at least be aware of jsUnit.

Categories

Resources