Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for writing functional tests and unit tests #397

Closed
karlcow opened this issue Nov 14, 2014 · 2 comments
Closed

Documentation for writing functional tests and unit tests #397

karlcow opened this issue Nov 14, 2014 · 2 comments

Comments

@karlcow
Copy link
Member

karlcow commented Nov 14, 2014

The issue #395 made me think, that we lack documentation for:

  • writing functional tests
  • writing unit tests
  • run tests before committing code

The only thing we have now is in CONTRIBUTING.md
https://github.com/webcompat/webcompat.com/blob/master/CONTRIBUTING.md#running-tests

which is a bit dry.

You can run tests from the project root with the nosetests command.

For example, right now we get:

→ nosetests
....F...
======================================================================
FAIL: Test that the /issues route 307s to /index (for now).
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/karl/code/webcompat.com/tests/test_urls.py", line 79, in test_issues_redirect
    self.assertEqual(rv.status_code, 307)
AssertionError: 200 != 307

----------------------------------------------------------------------
Ran 8 tests in 0.808s

FAILED (failures=1)
@miketaylr
Copy link
Member

Just a note I sent a PR fixing that failing test last night.

@miketaylr
Copy link
Member

Dumping a few notes.

The python unit tests are vanilla flavored https://docs.python.org/2/library/unittest.html tests. nose is smart enough to pick up unit tests without having to register them anywhere, which is cool.

Functional tests are run using http://theintern.io/, a NodeJS Selenium client. We use http://chaijs.com/api/assert/ assertions and the https://theintern.github.io/leadfoot/ library to "drive" selenium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants