Difference between revisions of "OSD600 and DPS909 Winter 2018 Lab 4"
(→3. Blog) |
(→3. Blog) |
||
(12 intermediate revisions by 8 users not shown) | |||
Line 62: | Line 62: | ||
| Woodson Delhia | | Woodson Delhia | ||
| https://gist.github.com/Woody88/7295790410b01f6473f2e7ee502bc0c8 | | https://gist.github.com/Woody88/7295790410b01f6473f2e7ee502bc0c8 | ||
− | | | + | | https://woodsondelhia.wordpress.com/2018/04/24/lab-javascript-ecmascript-standard-testing |
|- | |- | ||
| 2 | | 2 | ||
Line 92: | Line 92: | ||
| Pranoy Santosh | | Pranoy Santosh | ||
| https://gist.github.com/pranoy10/10fd4bbf04a7490567d527017c8d52df | | https://gist.github.com/pranoy10/10fd4bbf04a7490567d527017c8d52df | ||
− | | | + | | http://pranoydps909.blogspot.ca/2018/04/ecma-script-testing.html |
|- | |- | ||
| 8 | | 8 | ||
Line 157: | Line 157: | ||
| Aliaksandr Ushakou | | Aliaksandr Ushakou | ||
| https://gist.github.com/aushakou/9e35a93b20a82208c58aa12a3da71dd2 | | https://gist.github.com/aushakou/9e35a93b20a82208c58aa12a3da71dd2 | ||
− | | | + | | https://aushakou.wordpress.com/2018/04/23/a-first-glance-at-open-standards/ |
|- | |- | ||
| 21 | | 21 | ||
Line 180: | Line 180: | ||
|- | |- | ||
| 25 | | 25 | ||
− | | | + | |Zukhruf Khan |
− | | | + | |https://gist.github.com/zeddkay/8de670467d3f4109d426424ee534a30d |
− | | | + | |https://zedsdps909blog.wordpress.com/2018/03/25/open-standards-and-tests/ |
|- | |- | ||
| 26 | | 26 | ||
− | | | + | |Abel Inocencio |
− | | | + | |https://gist.github.com/simon-inoc/8963b7d7372bef04651d4389ce1dfaf1 |
− | | | + | |https://haxbyte.wordpress.com/2018/03/26/lab-4-getting-a-feel-of-testing/ |
|- | |- | ||
| 27 | | 27 | ||
− | | | + | |Vimal Raghubir |
− | | | + | |https://gist.github.com/Vimal-Raghubir/f1d1f512d1e81ed987e277ce388ceb76 |
− | | | + | |https://medium.com/@vraghubir/ecmascript-and-test-suites-6c3c892e9341 |
|- | |- | ||
| 28 | | 28 | ||
− | | | + | |Evan Davies |
− | | | + | |https://gist.github.com/EmdaviesSeneca/f36f80958c3f24386f2d7d7a88036ca1 |
− | | | + | |http://openthoughtsopensource.blogspot.ca/2018/03/testing-testing-123.html |
|- | |- | ||
| 29 | | 29 | ||
− | | | + | |Aleksey Glazkov |
− | | | + | |https://gist.github.com/alexglazkov9/8a66907939cedf0e5365fe736210a919 |
− | | | + | |https://aglazkovblog.wordpress.com/2018/04/12/open-standards-and-javascript-tests/ |
|- | |- | ||
| 30 | | 30 | ||
− | | | + | |Michael Fainshtein |
− | | | + | |https://gist.github.com/mfainshtein2/26651032e9d1938bc39e3ff6cebf1dfb |
− | | | + | |https://moderatelyokaydeveloper.wordpress.com/2018/04/21/standards-for-automated-testing/ |
|- | |- | ||
| 31 | | 31 |
Latest revision as of 13:27, 24 April 2018
Contents
Contributing to Open Standards
This week we're discussing open standards, and for our lab will try writing some tests for the JavaScript (ecmascript) standard.
In order for implementors of the standard to know if they've got any bugs, a comprehensive set of tests are necessary. These tests should be something that can be run by any and all JavaScript implementations (i.e., we don't Microsoft to have their tests, Google to have their tests, Mozilla to have their tests, etc. and not share with each other). JavaScript should work the same everywhere, no matter which implementation you us.
In this Lab you will gain experience doing the following:
- reading a language standard
- running a test suite
- identifying testable aspects of the standard
- writing tests
- sharing work using gist.github.com
1. Running the Test Suite
The language is specified in https://tc39.github.io/ecma262/, and its test suite is available at https://github.com/tc39/test262.
To run the tests on your computer using node.js, follow the steps listed in https://github.com/bterlson/test262-harness#test262-harness.
When you run the tests, do all the tests pass or do any of them fail for you?
2. Become Familiar with Tests
Read the docs at https://github.com/tc39/test262/blob/master/CONTRIBUTING.md, which cover things like naming, general layout, assertions, error handling, etc.
Based on what you've just read, take a look at this test for String.prototype.toUpperCase(). See if you can make sense of the code and what it's testing.
3. Array.reverse
In JavaScript, Arrays can be reversed using the reverse()
method. It is defined in the standard at https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.reverse. Begin by reading the definition of steps in the spec.
What sort of things could you test with Array.reverse
? Based on what you read above, what sort of things need to be true about how Array.reverse
works? Try to write a few tests for things you just thought about, using what you learned in 2.
To add a new test, you can create new .js
files underneath test/
.
4. Extending the Existing Tests
There are actually tests written now. You can see them in the Array.prototype.reverse() tests
There is a bug to improve these tests, based on things learned while writing the TypedArray.prototype.reverse tests.
Take a look at the code for the TypedArray.prototype.reverse tests and compare it to what is happening in the Array.prototype.reverse() tests.
Can you figure out some things you could change (i.e., ideas to borrow from the other tests)? Try rewriting some of the tests for Array.reverse
to do what you think might be better.
NOTE: you do not need to submit your tests. This lab is only about reading the spec and existing tests, and understanding how they work.
3. Blog
Write a blog post about your experience reading the spec and tests and trying to write new tests. Put any code that you wrote into a gist on GitHub (i.e., you don't need to do a pull request or submit them anywhere).
Please add a line for your blog in the following table: