Software testing for humans
Intern is a complete test system for JavaScript designed to help you write and run consistent, high-quality test cases for your JavaScript libraries and applications. It can be used to test any JavaScript code.
- Plain JavaScript code, in any module format (or no module format!)
- Web pages generated by server-side languages (like Java, PHP, or Ruby)
- Native or hybrid iOS, Android, and Firefox OS applications
Intern is minimally prescriptive and enforces only a basic set of best practices designed to ensure your tests stay maintainable over time. Its extensible architecture allows you to write custom test interfaces, executors, and reporters to influence how your tests run & easily integrate with your existing coding environment. Intern also comes with Grunt tasks so it can be quickly added to existing Grunt-based workflows, and is designed to work out-of-the-box with popular continuous integration services like Jenkins and Travis CI.
If you’re into name-dropping, Intern gets used every day by teams at Twitter, Stripe, Mozilla, IBM, Marriott, Philips, Zenput, Alfresco, Esri, HSBC, ING, Intuit, and more. It’s also the testing framework of choice for growing numbers of open-source projects.
Note that this documentation is for Intern 4 master, which is currently an alpha release.
- For the latest stable (Intern 3) release docs, please see the Intern 3 README.
- For the latest unstable (Intern 4) release docs, please see the release README.
-
Install from npm
$ cd /my/project $ npm install intern@next
-
Create an
intern.json
file in your project root.{ "suites": "tests/unit/**/*.js" }
-
Verify that your configuration works by running Intern and checking that no errors are output.
$ ./node_modules/.bin/intern
-
Start writing tests!
Intern installs a global variable that tests may not be aware of if nothing imports the base intern
package. Also, Intern includes typings for several packages that haven’t made it onto DefinitelyTyped yet (and so can’t be installed as @types packages). To ensure Intern’s types are loaded, add the following to your tsconfig.json
:
{
"types": ["intern"]
}
Intern can run unit tests in browsers that support ECMAScript 5, including mobile browsers on Android and iOS, and in Node 4+. It’s self-tests run against IE 10 and 11, Firefox 33 and current, Chrome 38 and current, and Safari 9 and 10, as well as Node 6 and 7.
Intern can run functional tests using WebDriver-compatible applications and services, including Selenium, Appium, Selendroid. It has built-in support for cloud testing services from BrowserStack, CrossBrowserTesting, SauceLabs, and TestingBot.
- Getting started - Setting up Intern to test a project
- How To - Quick answers to common questions
- Concepts - General testing concepts and definitions
- Architecture - How Intern is organized
- Configuration - How to configure Intern
- Writing tests - The various ways of writing tests with Intern
- Running - How to run Intern
- Continuous integration - Using Intern with CI systems
- Extending - Extending Intern
- Developing - For Intern developers
- Contributing - How to contribute to Intern development
The best place to ask questions and get answers about Intern is Stack Overflow. Just tag your question with intern
. If you have more immediate questions, or just want to chat with other people interested in Intern, there’s an #intern
IRC channel on freenode, and a Gitter room at theintern/intern. See the Help page for more information.
Intern is a JS Foundation project offered under the New BSD license.
© SitePen, Inc. and its contributors