DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. JavaScript
  4. test262 – ensuring that JavaScript implementations comply with the ECMAScript specification

test262 – ensuring that JavaScript implementations comply with the ECMAScript specification

Axel Rauschmayer user avatar by
Axel Rauschmayer
·
Jul. 28, 11 · Interview
Like (0)
Save
Tweet
Share
2.39K Views

Join the DZone community and get the full member experience.

Join For Free

With so many JavaScript implementations out there, how do you guarantee that all of them stay true to ECMA-262 (the ECMAScript language standard)? The answer is test262, a suite of tests to be run by an implementation. Quote from the test262 website:

What is test262? test262 is a test suite intended to check agreement between JavaScript implementations and the ECMA-262 Specification (currently 5th Edition). The test suite contains thousands of individual tests, each of which tests some specific requirements of the ECMAScript specification.
A press release [2] has more details:
For the first time, Ecma will publish a standardized test suite for the latest version of ECMA-262 edition 5.1, known as Test262. Via this suite, developers will be able to test how closely implementations of ECMAScript follow the specifications in ECMA-262 edition 5.1. The test suite will be published as an Ecma Technical Report and will be made available to developers via the normal Ecma distribution channels and http://test262.ecmascript.org/. The test suite will be released in increments with the first version planned for December 2011 and updates provided later.

The test suite has been created by the Ecma Technical Committee 39, with committee members including Mozilla, Microsoft, Google and many others helping to make the suite a resource that helps developers provide fine-tuned feedback on support for the standard.

Over 10,000 tests cover the specification today. Test suites are an integral part of the process needed to create interoperable cross-platforms standards.

A Microsoft blog article [1] (which pointed me to the press release) has a neat idea for running test262 faster:
You can use Web Workers to run test262 even faster. To demonstrate the promise of Web workers to make the Web faster overall, we’ve published a test drive that runs the tests from the standards body using Web workers.
Structure of the tests. The test infrastructure currently seems a bit complicated: A JSON “table of contents” file points to files such as the following:
{"testsCollection":{"name":"Chapter - 11.11_Binary_Logical_Operators",
"numTests":"32","tests":[{"code":"RVM1...
The string value of code is a Base64-encoded file that looks as follows:
    ES5Harness.registerTest( {
    id: "S11.11.1_A1",

    path: "TestCases/11_Expressions/11.11_Binary_Logical_Operators/11.11.1_Logical_AND_Operator/S11.11.1_A1.js",

    assertion: "White Space and Line Terminator between LogicalANDExpression and \"&&\" or between \"&&\" and BitwiseORExpression are allowed",

    description: "Checking by using eval",

    test: function testcase() {
       //CHECK#1
    if ((eval("true\u0009&&\u0009true")) !== true) {
      $ERROR('#1: (true\\u0009&&\\u0009true) === true');
    }
Related reading:
  1. test262: Industry JavaScript Standards Test Available
  2. Press release 30 June 2011 - ISO/IEC and Ecma International ratify “ES5.1”, the latest ECMAScript specification of Ecma International
  3. A brief history of ECMAScript versions (including Harmony and ES.next)

 

From http://www.2ality.com/2011/07/test262.html

ECMAScript Implementation Testing JavaScript Test suite

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Spring Cloud
  • Cucumber.js Tutorial With Examples For Selenium JavaScript
  • Apache Kafka Is NOT Real Real-Time Data Streaming!
  • Using GPT-3 in Our Applications

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: