README.testing 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. The short story
  2. ===============
  3. Python-based tests:
  4. "build/env/bin/hue test all" runs all the tests.
  5. You should be running that before you push.
  6. Windmill-tests:
  7. build/env/bin/hue test windmill
  8. runs all the windmill tests. It uses port 8999.
  9. build/env/bin/hue runserver_plus
  10. followed by
  11. build/env/bin/windmill -e test=core/src/desktop/windmilltests.py firefox http://localhost:8000/
  12. Longer story
  13. ============
  14. The ``test`` management command prepares the arguments (test app names)
  15. and passes them to nose (django_nose.nose_runner). Nose will then magically
  16. find all the tests to run.
  17. Tests themselves should be named *_test.py. These will be found
  18. as long as they're in packages covered by django. You can use the
  19. unittest frameworks, or you can just name your method with
  20. the word "test" at a word boundary, and nose will find it.
  21. See apps/hello/src/hello/hello_test.py for an example.
  22. Helpful command-line tricks
  23. ===========================
  24. To run tests that do not depend on Hadoop, use:
  25. build/env/bin/hue test fast
  26. To run all tests, use:
  27. build/env/bin/hue test all
  28. To run only tests of a particular app, use:
  29. build/env/bin/hue test specific <app>
  30. E.g.
  31. build/env/bin/hue test specific filebrowser
  32. To run a specific test, use:
  33. build/env/bin/hue test specific <test_func>
  34. E.g.
  35. build/env/bin/hue test specific useradmin.tests:test_user_admin
  36. Start up pdb on test failures:
  37. build/env/bin/hue test <args> --pdb --pdb-failure -s
  38. Special environment variables
  39. =============================
  40. DESKTOP_LOGLEVEL=<level>
  41. level can be DEBUG, INFO, WARN, ERROR, or CRITICAL
  42. When specified, the console logger is set to the given log level. A console
  43. logger is created if one is not defined.
  44. DESKTOP_DEBUG
  45. A shorthand for DESKTOP_LOG_LEVEL=DEBUG
  46. DESKTOP_PROFILE
  47. Turn on Python profiling. The profile data is saved in a file. See the
  48. console output for the location of the file.
  49. DESKTOP_LOG_DIR=<dir>
  50. Specify the HUE log directory. Defaults to ./log.
  51. DESKTOP_DEPENDER_DEBUG
  52. When specified, re-evaluate the js depender every time.
  53. DESKTOP_DB_CONFIG=<db engine:db name:test db name:username:password:host:port>
  54. Specify alternate DB connection parameters for HUE to use. Useful for
  55. testing your changes against, for example, MySQL instead of sqlite. String
  56. is a colon-delimited list.
  57. Writing tests that depend on Hadoop
  58. ===================================
  59. Use mini_cluster.py! You should tag such tests with "requires_hadoop", as follows:
  60. from nose.plugins.attrib import attr
  61. @attr('requires_hadoop')
  62. def your_test():
  63. ...
  64. Hudson Configuration
  65. ====================
  66. Because building Hadoop (for the tests that require it) is slow, we've
  67. separated the Hudson builds into "fast" and "slow". Both are run
  68. via scripts/hudson.sh, which should be kept updated with the latest
  69. and greatest in build technologies.
  70. Headless Windmill
  71. =================
  72. Ideally, all you need to do is install xvfb and run "xvfb-run bin/hue test_windmill".
  73. To debug, however, you'll need to be able to check out what's going on. You can run
  74. "xvfb-run bash", followed by "x11vnc", and then connect to your X via VNC from another
  75. machine. This lets you eavesdrop nicely.