OSD600 and DPS909 Winter 2018 Lab 4

From CDOT Wiki
Revision as of 13:56, 20 March 2018 by Soutrik.barua (talk | contribs) (3. Blog)
Jump to: navigation, search

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:

# Name Gist of test cases (URLs) Blog Post (URL)
1 Woodson Delhia https://gist.github.com/Woody88/7295790410b01f6473f2e7ee502bc0c8
2 Hao Chen https://gist.github.com/haoRchen/b3249dd14d7ced8fe11487304da335a8 https://medium.com/haorc/testing-with-javascript-3c6fe1b22d0d
3 Matthew Quan https://gist.github.com/irrationalRock/362826160d1646f69d274a3e729d5bb0#file-s15-4-4-8_a1_t1-js https://mattprogrammingblog.wordpress.com/2018/03/13/osd600-lab4-looking-at-web-standards/
4 Yuriy Kartuzov https://gist.github.com/YuriyKartuzov/c195ed5cb2e09fdae4dfc2106995a604 https://yuriykartuzov.wordpress.com/2018/03/12/lab-4/
5 Owen Mak https://gist.github.com/Owen-Mak/569dd52440e48192a5edab013f0228e4 https://makowen.wordpress.com/2018/03/13/side-quest-2-ecma-and-unit-tests/
6 Jafar Frotan https://gist.github.com/a-one-d-one/913f5830b5bbfb1c7b6abf37eed79100 https://medium.com/@jaf.frotan/innovation-adhering-to-standards-and-diving-into-testing-bfcc9d8aa5b7
7 Pranoy Santosh https://gist.github.com/pranoy10/10fd4bbf04a7490567d527017c8d52df
8 Kevin Pham https://gist.github.com/kqpham/65891808231e9bfb1d7182d5800b0002
9 Zhihao Cai https://gist.github.com/josechoy/0b396ef5609ee2e13c4057f81eb5b9b2 https://choyzhihao.wordpress.com/2018/03/14/get-familiar-with-javascript-standard/
10 Alex Wang https://gist.github.com/AlexWang-16/5991e9e7cf9b526cd7cab0b4a069a36a https://alexopensource.wordpress.com/2018/03/15/learning-and-working-with-emcascript-standardization-tests/
11 Oleh Hodovaniuk https://gist.github.com/ohodovaniuk1/f5f68bca012f9d3b222bd24f0b4252db https://ohodovaniuk.wordpress.com/2018/03/13/osd600-lab-4/
12 Qiliang Chen https://gist.github.com/KignorChan/e82a9a597e2a02115238227e911ff1b5 https://qchen102.blogspot.ca/2018/03/studying-for-open-standard.html
13 Bakytzhan Apetov https://gist.github.com/apetov/bc60c73a584c2205cc498fe06f295ec3 https://bapetov.wordpress.com/2018/03/15/lab-4-running-tests/
14 Hongcheng Zhang https://gist.github.com/StevenZhang123/bd6697f51205954323895994927c7fd3 https://hongcheng1993.wordpress.com/2018/03/15/lab4-osd/
15 Patrick Godbout https://gist.github.com/PatMB30/7a483999a2986b8358c4155d74c587e8 https://mb30myopensourceblog.blogspot.ca/2018/03/running-test-suites-and-playing-with.html
16 Justin Vuu https://gist.github.com/jevuu/552694721103f4e39304fbd33e9f1287 https://justosd.wordpress.com/2018/03/16/osd600-lab-4-contributing-to-open-standards/
17 Joseph Pham https://gist.github.com/jpham14/24c5772b69e72dafadd1fb126031a739 https://jpham14.wordpress.com/2018/03/16/lab-4-contributing-to-open-standards/
18 Yalong Li https://gist.github.com/yalooong/16fd3eaa19584fe4ad13e1f241f1e3e0 https://yalongxyz.blogspot.ca/2018/03/ecmascript-test-suite-create-reverse.html
19 Liam Newell https://gist.github.com/hibyguy/836dd91212be43a73334a6d7d51eaca3
20 Aliaksandr Ushakou https://gist.github.com/aushakou/9e35a93b20a82208c58aa12a3da71dd2
21 Soutrik Barua https://gist.github.com/buttersnipps/be6961429e8091b8e4af6c78a3d981a0 http://soutrikbarua.blogspot.ca/2018/03/testing-in-open-source-projects.html
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40