/HTTP5201-A-Lab3

Security and Quality Assurance Lab 3 - Unit Testing

Primary LanguageJavaScript

5201 - Lab3 (February 16, 2018)

Unit Testing

REQUIREMENTS:

  • 1. Create a function called checkHumbrId that accepts a string.
  • 2. The function should validate a Humber college ID number (for uppercase and lowercase ‘N’).
  • 3. If the input validates, the function will return the Boolean true, otherwise it will return false.
  • 4. Your partner will create a second function called test__checkHumbrId, which will test the checkHumbrId function.
  • 5. This second function will take 2 parameters: a value to pass to the checkHumbrId function, and the expected result of running that value with the function.
  • 6. When run, it should output the results of the test to the html page. The output should read as follows:
    • Value tested: xxxxxx Expected result: xxxxxx ==PASSED== (OR…)
    • Value tested: xxxxxx Expected result: xxxxxx xxFAILEDxx

Together, you will create a list of tests to run for Test-to-pass, test-to-fail, and boundary testing (at least 6 tests).

  • EXTRA CHALLENGE: Implement BEM, “use strict”, and validate with JSLint.

  • EXTRA EXTRA CHALLENGE: Style the results so that ==PASSED== is green, and xxFAILEDxx is red.

  • EXTRA SUPER CHALLENGE: Collaborate through GitHub.