README 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. BIND10 system testing with Lettuce
  2. or: to BDD or not to BDD
  3. In this directory, we define a set of behavioral tests for BIND 10. Currently,
  4. these tests are specific for BIND10, but we are keeping in mind that RFC-related
  5. tests could be separated, so that we can test other systems as well.
  6. Prerequisites:
  7. - Installed version of BIND 10 (but see below how to run it from source tree)
  8. - dig
  9. - lettuce (http://lettuce.it)
  10. To install lettuce, if you have the python pip installation tool, simply do
  11. pip install lettuce
  12. See http://lettuce.it/intro/install.html
  13. Most systems have the pip tool in a separate package; on Debian-based systems
  14. it is called python-pip. On FreeBSD the port is devel/py-pip.
  15. Running the tests
  16. -----------------
  17. At this moment, we have a fixed port for local tests in our setups, port 47806.
  18. This port must be free. (TODO: can we make this run-time discovered?).
  19. Port 47805 is used for cmdctl, and must also be available.
  20. (note, we will need to extend this to a range, or if possible, we will need to
  21. do some on-the-fly available port finding)
  22. The bind10 main program, bindctl, and dig must all be in the default search
  23. path of your environment, and BIND 10 must not be running if you use the
  24. installed version when you run the tests.
  25. If you want to test an installed version of bind 10, just run 'lettuce' in
  26. this directory.
  27. We have provided a script that sets up the shell environment to run the tests
  28. with the build tree version of bind. If your shell uses export to set
  29. environment variables, you can source the script setup_intree_bind10.sh, then
  30. run lettuce.
  31. Due to the default way lettuce prints its output, it is advisable to run it
  32. in a terminal that is wide than the default. If you see a lot of lines twice
  33. in different colors, the terminal is not wide enough.
  34. If you just want to run one specific feature test, use
  35. lettuce features/<feature file>
  36. To run a specific scenario from a feature, use
  37. lettuce features/<feature file> -s <scenario number>
  38. We have set up the tests to assume that lettuce is run from this directory,
  39. so even if you specify a specific feature file, you should do it from this
  40. directory.
  41. What to do when a test fails
  42. ----------------------------
  43. First of all, look at the error it printed and see what step it occurred in.
  44. If written well, the output should explain most of what went wrong.
  45. The stacktrace that is printed is *not* of bind10, but of the testing
  46. framework; this helps in finding more information about what exactly the test
  47. tried to achieve when it failed (as well as help debug the tests themselves).
  48. Furthermore, if any scenario fails, the output from long-running processes
  49. will be stored in the directory output/. The name of the files will be
  50. <Feature name>-<Scenario name>-<Process name>.stdout and
  51. <Feature name>-<Scenario name>-<Process name>.stderr
  52. Where spaces and other non-standard characters are replaced by an underscore.
  53. The process name is either the standard name for said process (e.g. 'bind10'),
  54. or the name given to it by the test ('when i run bind10 as <name>').
  55. These files *will* be overwritten or deleted if the same scenarios are run
  56. again, so if you want to inspect them after a failed test, either do so
  57. immediately or move the files.
  58. Adding and extending tests
  59. --------------------------
  60. If you want to add tests, it is advisable to first go through the examples to
  61. see what is possible, and read the documentation on http://www.lettuce.it
  62. There is also a README.tutorial file here.
  63. We have a couple of conventions to keep things manageable.
  64. Configuration files go into the configurations/ directory.
  65. Data files go into the data/ directory.
  66. Step definition go into the features/terrain/ directory (the name terrain is
  67. chosen for the same reason Lettuce chose terrain.py, this is the place the
  68. tests 'live' in).
  69. Feature definitions go directly into the features/ directory.
  70. These directories are currently not divided further; we may want to consider
  71. this as the set grows. Due to a (current?) limitation of Lettuce, for
  72. feature files this is currently not possible; the python files containing
  73. steps and terrain must be below or at the same level of the feature files.
  74. Long-running processes should be started through the world.RunningProcesses
  75. instance. If you want to add a process (e.g. bind9), create start, stop and
  76. control steps in terrain/<base_name>_control.py, and let it use the
  77. RunningProcesses API (defined in terrain.py). See bind10_control.py for an
  78. example.
  79. For sending queries and checking the results, steps have been defined in
  80. terrain/querying.py. These use dig and store the results split up into text
  81. strings. This is intentionally not parsed through our own library (as that way
  82. we might run into a 'symmetric bug'). If you need something more advanced from
  83. query results, define it here.
  84. Some very general steps are defined in terrain/steps.py.
  85. Initialization code, cleanup code, and helper classes are defined in
  86. terrain/terrain.py.
  87. To find the right steps, case insensitive matching is used. Parameters taken
  88. from the steps are case-sensitive though. So a step defined as
  89. 'do foo with value (bar)' will be matched when using
  90. 'Do Foo with value xyz', but xyz will be taken as given.
  91. If you need to add steps that are very particular to one test, create a new
  92. file with a name relevant for that test in terrain. We may want to consider
  93. creating a specific subdirectory for these, but at this moment it is unclear
  94. whether we need to.
  95. We should try to keep steps as general as possible, while not making them to
  96. complex and error-prone.