JavaScript for Line of Business Applications
596.1K views | +0 today
Follow
JavaScript for Line of Business Applications
Keeping track of current JavaScript Frameworks that help design your clientside Business Logic Layers.
Curated by Jan Hesse
Beam to my Inbox:
Your new post is loading...
Your new post is loading...

Popular Tags - Filter using the Funnel

Current selected tag: 'QUnit'. Clear
Scoop.it!

Automating JavaScript tests with QUnit, PhantomJS and Grunt

Automating JavaScript tests with QUnit, PhantomJS and Grunt | JavaScript for Line of Business Applications | Scoop.it
QUnit’s setup is fairly simple and is easy to use. To get started, I will be using a simple boilerplate webpage. Notice that the two files required for QUnit (qunit-x.js and qunit-x.css) are included in the page source. Additionally, I have some inline JavaScript for which QUnit tests will be written. home.html Within tests.js, I …
No comment yet.
Scoop.it!

Getting started with JavaScript Unit Testing using QUnit

Getting started with JavaScript Unit Testing using QUnit | JavaScript for Line of Business Applications | Scoop.it

In the test driven development approach, you first write a unit test, and when it fails, you then write an application code to pass the test. In JavaScript, unit testing is not much different than other programming languages. To do unit testing or TDD in JavaScript, you need a testing framework. There are many popular JavaScript testing frameworks available, including:

  • Mocha
  • Jasmine
  • QUnit
  • JSUnit
No comment yet.
Scoop.it!

Integrating QUnit with Travis builds

Integrating QUnit with Travis builds | JavaScript for Line of Business Applications | Scoop.it

Under normal circumstances, following the official guide for setting up QUnit would have been enough, but there were a couple of issues we had to overcome:

  1. We’re using the AMD format for our JavaScript modules.
  2. We want our tests to run automatically as part of our Travis builds.
No comment yet.
Scoop.it!

Integrating Javascript unit tests with Visual Studio build

Integrating Javascript unit tests with Visual Studio build | JavaScript for Line of Business Applications | Scoop.it

The first step was getting hold of QUnit, a Javascript unit test suite capable of executing our tests; in fact, QUnit is apparently used to unit test not only itself, but also JQueryUI, JQuery and JQuery mobile.

So that’s all great and groovy, but requires a manual step of launching the document in a browser in order to execute the javascript.

Enter Chutzpah, a command-line javascript test runner. It uses PhantomJS to execute javascript in a headless (read:no window) Webkit browser and also allows us to execute it from the command line.

No comment yet.
Scoop.it!

Qunit Introduction

Points to Discuss:

* Unit Testing & Test Driven Development

* QUnit

* QUnit API

* Automated Testing (a brief introduction)

No comment yet.
Scoop.it!

Stop Making Excuses and Start Testing Your JavaScript

Talk from HTML5DevConf about JavaScript unit testing.
No comment yet.
Scoop.it!

Which JavaScript Test Library Should You Use? QUnit vs Jasmine vs Mocha

Which JavaScript Test Library Should You Use? QUnit vs Jasmine vs Mocha | JavaScript for Line of Business Applications | Scoop.it

Whether you’re writing javaScript for the browser or for nodeJS, the question exists: what unit test library should I use to ensure my javascript code is working as expected?  There are plenty to choose from, and several that are popular.  If you were considering jUnit, Jasmine, or Mocha, then I’ve got some information you might be interested in: the good, the bad, and the ugly.

Arik Grinstein's curator insight, May 16, 2014 9:29 AM

Testing the Tests

Scoop.it!

Unit Tests with EmberJS

Unit Tests with EmberJS | JavaScript for Line of Business Applications | Scoop.it

Recently I’ve built Ember technology demonstrator, to learn the framework and it’s ecosystem: MVC pattern, data binding, performance, tests and automation.

Ember documentation contains section for Integration Tests. My first intention was to use Jasmine as my test framework of choice. Unfortunately, after hours of digging, I’ve found that there is no good way to test Ember code with Jasmine. The only official way to test Ember apps is an Ember-QUnit, which includes adapter for async operations and helper functions for unit and integration tests.

Long story short, here is GitHub Repository that demonstrates Ember app with integration tests, which can be executed both in terminal and in browser. It uses grunt to automate tasks, and testem to run the tests. Feel free to use it as a starting point for your Ember unit tests.

No comment yet.
Scoop.it!

NQUnit: JavaScript testing within .NET / CI

NQUnit: JavaScript testing within .NET / CI | JavaScript for Line of Business Applications | Scoop.it

QUnit is an awesome unit testing framework for JavaScript that is written by the jQuery team for unit testing jQuery.

This post describes a package I created to be able to run QUnit testing from within any .NET testing framework, and thus also from continuous integration servers.

If you manage to achieve the difficult task of getting your JavaScript unit tests to run and return results within the context of your server-side testing framework then that is a huge win. I think it’s a win because it means you can run all of the tests for your application within the same context resulting in:
* Better efficiency for doing your testing
* More likelihood you will actually run your JavaScript unit tests regularly since it’s convenient to do so
* You get continuous integration for free if you already have a CI server set up.

That last point is important – this means you get continual regression testing of your JavaScript, and if multiple people are working on the same JavaScript then you get notification as soon as a bug is introduced as a side-effect of integrating the code.

No comment yet.
Scoop.it!

Testing JavaScript with QUnit

In this session, we will take a look at how to use QUnit to write unit tests for your JavaScript code.

High-level agenda:

Introduction to QUnit

Code Coverage using BlanketJS

Mocking AJAX using MockJax

Automating unit tests using GruntJS

No comment yet.
Scoop.it!

Automated JavaScript Tests Using Grunt, Phantomjs, and QUnit

Many developers and development shops have embraced testing in their server side code – either using a TDD model, or sometimes just with unit or functional tests created on the fly – but very few developers I talk to test their front end code beyond eyeballing it in a few browsers (or if they’re lucky, with a service like BrowserStack). And even fewer of those use any kind of automation. In this post I’m going to try and help out that majority of you who aren’t testing – or maybe just aren’t automating.

Lately I’ve been converting a number of my jQuery plugins over to Github – something the new jQuery plugin site is requiring – and while doing so I’m refactoring and adding tests with QUnit(created by the same folks that write the jQuery core). I realized pretty quickly that having to go to the browser, hard refresh, and then run the tests again after every change was a time killer, but I didn’t want to write a whole bunch of tests and then go check the results, otherwise I could be tracking down bugs (in my code and the tests) for days. Instead I set up some automated testing using Grunt, PhantomJS, and a couple Grunt plugins. Here’s how.

No comment yet.
Scoop.it!

Testing & Tooling in EmberJS

Testing & Tooling in EmberJS | JavaScript for Line of Business Applications | Scoop.it

One of my favorite parts of Ember is how easy it is to test. The framework comes bundled with a system testing framework, and its object model makes unit testing a breeze. Combine all that with a great test runner that has CI integration, and you have a really awesome testing ecosystem for your new app.

This framework allows you to make high-level assertions regarding your applications’ state, mostly by querying and interacting with the DOM through JQuery in a black box fashion. Since the tests are pure JavaScript however, we also get direct access to our running application if needed for testing.

The framework comes bundles with a few simple helpers to do common operations such as clicking a button, filling in a text field, or querying for the presence of a certain DOM element. A typical system test using ember-testing might look like this...

No comment yet.
Scoop.it!

Buster.JS - A Browser and NodeJS JavaScript testing toolkit.

Buster.JS - A Browser and NodeJS JavaScript testing toolkit. | JavaScript for Line of Business Applications | Scoop.it

Buster.JS is a JavaScript test framework for node and browsers.

It does browser testing with browser automation (think JsTestDriver), QUnit style static HTML page testing, testing in headless browsers (PhantomJS, jsdom), and more. Write your test case with Buster.JS and run it both in Node.js and in a real browser.

There’s a public API for almost everything. You can write reporters for customizing the output of buster test (we already have xUnit XML, traditional dots, specification, tap, TeamCity and more), write extensions that wrap other testing frameworks (we already have buster-jstestdriver), add your own testing syntax (we ship with xUnit and BDD), and much more. Again, the overview lists many of these things.


No comment yet.
Scoop.it!

Test driven Development & Qunit Tutorial

Test driven development Quint tutorial javascript
Arvind Gupta's curator insight, February 4, 2015 3:43 AM

Good article TDD javascript

Scoop.it!

QUnit Page JS

QUnit Page JS | JavaScript for Line of Business Applications | Scoop.it

A Wrapper for QUnit to test Links and Navigation.

No comment yet.
Scoop.it!

QUnit Advanced Concepts: Modules and Configuration

QUnit Advanced Concepts: Modules and Configuration | JavaScript for Line of Business Applications | Scoop.it

In this article I’ll discuss how you can organize your test code in modules, and how you can tweak QUnit to better fit your needs using the configuration properties exposed by the framework.

No comment yet.
Scoop.it!

How to Test Asynchronous Code with QUnit

How to Test Asynchronous Code with QUnit | JavaScript for Line of Business Applications | Scoop.it

Just like synchronous functions, asynchronous ones need love, and even more tests. In this article I’ll teach you how to test asynchronous code with QUnit. In case you don’t recall the assertion methods available, or you totally missed my article, I suggest you read Getting Started with QUnit. The material covered in it will be a prerequisite to this article.

No comment yet.
Scoop.it!

An introduction to JavaScript Unit Testing with qUnit and Sinon.js

An introduction to JavaScript Unit Testing with qUnit and Sinon.js | JavaScript for Line of Business Applications | Scoop.it

If you are developing for the web – apps or websites, then it is almost impossible to escape JavaScript. At some point, you will write some client-side code and as the application grows and the requirements become more complex, your JavaScript code is bound to grow with it. Like with every other complex piece of code, we need to be confident that the code behaves as expected. It doesn’t matter if you decide to use TDD or not, what’s important is to test your code. You can do this manually, very tedious and error prone, or programmatically. The choice is yours!

JavaScript is a different beast on its own, especially if you, like me, are used to doing server-side programming and testing. So how does one start with client-side unit tests?

No comment yet.
Scoop.it!

Unit testing With Qunit (Part 1)

Unit testing With Qunit (Part 1) | JavaScript for Line of Business Applications | Scoop.it

Unit testing is really the painkiller pill that must be used by every developer depending on the technology or language he used to work with.
Now imagine that you write a unit test for every function or a couple of tests for every features of your software. So any new modification of your code that may lead to a bug or regression will be found and detected on the fly.

In my case, I have to find the best unit testing framework and what I mean by the best is: easy to use, easy to understand and easy to configure. Almost every Unit testing framework provide the minimum features I was looking for, I can give the example of Mocha, Jasmine and Qunit.

Jan Hesse's insight:

Part 2: http://naimhamadi.wordpress.com/2014/05/11/javascript-tdd-using-qunit-and-karma/

No comment yet.
Scoop.it!

Don't Forget to Cover Your Client Side!

Don't Forget to Cover Your Client Side! | JavaScript for Line of Business Applications | Scoop.it

By making sure that your application is tested, you are able to reduce the amount of bugs you find in your code, increase the maintainability of your application, and design well structured code. 

Client side unit testing presents different challenges than server side testing. When dealing with client side code, you will find yourself struggling to separate application logic from DOM logic, as well as just structuring JavaScript code in general. Fortunately there are a lot of great client side testing libraries out there to help test your code, create metrics about the test coverage, as well as analyze the complexity of it.

No comment yet.
Scoop.it!

How to employ test driven JavaScript using QUnit

How to employ test driven JavaScript using QUnit | JavaScript for Line of Business Applications | Scoop.it

Test driven development is now widely accepted as a JavaScript workflow, and it’s something we should all embrace because it saves us a great deal of time when coding.

In this article I’ll introduce you to QUnit, a testing framework that will help you spot errors and bugs in your code.

At first, this process may seem complex and tedious. Creating a test for all of your functions does take some time, but it will save you hours of debugging at the end of the project cycle.

Not only that, but you’ll save yourself the blushes we all get when a client emails us about a bug they’ve found.

As a further benefit, you’ll find that this workflow also benefits cross-browser testing, and using this approach you can test in several browsers straight out of the box.

No comment yet.
Scoop.it!

How to Unit Test Custom Exceptions with QUnit

How to Unit Test Custom Exceptions with QUnit | JavaScript for Line of Business Applications | Scoop.it

When writing robust JavaScript code, you will probably want to throw exceptions to let programmers know when they’ve misused your API. Sure, you could throw an instance of the built-in Error object, but then during unit testing how will you tell if the exception you’re seeing is yours and not coming from somewhere else?

 

The solution is to use a custom exception in your method, but this opens up a whole new can of worms. JavaScript’s weak typing and poor support for sub-classing Error mean that a custom exception class can easily be created with no error message, or even worse with no stack trace!

 

Today, I’m going to help you solve both these problems, and introduce you to a neat, undocumented feature in QUnit that will help you unit test your methods.

No comment yet.
Scoop.it!

Advanced QUnit - Front-End JavaScript Unit Testing

Unit testing front-end JavaScript presents its own unique set of challenges. In this session we will look at number of different techniques to tackle these challenges and make our JavaScript unit tests fast and robust. We plan to cover the following subjects: 

* Mocking and spy techniques to avoid dependencies on 
- Functions, methods and constructor functions 
- Time (new Date()) 
- Timers (setTimeout, setInterval) 
- Ajax requests 
- The DOM 
- Events 
* Structuring tests for reuse and readability 
* Testing browser-specific behaviour 
* Leak testing

No comment yet.
Scoop.it!

QUnit or Jasmine?

* Jasmine - a BDD framework that's clearly influenced by RSpec, and

* QUnit - a more traditional test framework from the jQuery project.

 

I compared them on three criteria:

1. Speed of setup. I tend to avoid testing tools that take me more than hour to get up and running.

2. Simplicity. Test frameworks don't need to be complicated; they just need to let me specify how my code should behave and keep out of my way. All things being equal, I'll choose an xUnit style testing framework to an RSpec style framework. If you're thinking "but I prefer BDD!" don't forget that the "B" in BDD is just language, and you can use that language in any framework you like.

3. Support for Continuous Integration. If you can't run your test suite automatically then sooner or later you'll forget to run it manually, and at some point ship a broken app to your users. Running tests in your CI build also enables you to automate continuous deployment, which is always a giggle.

No comment yet.
Scoop.it!

Unit Testing and Writing Testable Code

The obvious benefit of unit testing is that we get an instantaneous overview of whether some basic, expected functionality of our web applications has been broken by recent changes. Depending on your project, and overhead involved, you may want to run unit tests on each save, each commit, each hour, day, or as part of your continuous integration process via Jenkins or TravisCI. You can use your unit tests to verify functional outputs, DOM manipulations, event-driven behavior, or even basic markup structure.

In the case of a monstrous amount of preexisting code, there’s not much that can be done as far as unit test coverage is concerned, except to say that this is the line in the sand. From here on out, all new feature work will require unit test coverage, and any new defects that are reported will require a unit test to verify their solution. In this way, you can let your test library organically grow, while still being able to handle feature work at the same time. Nobody needs to slam on the brakes to be able to write coverage for everything, especially when a lot of it may be dead execution paths, or code that’s slated for refactoring work in the future.

No comment yet.