Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. Tests/
  2. --BehaveTest1/
  3. ----BehaveTest1.feature
  4. ----steps/
  5. ------test_steps.py
  6. --BehaveTest2/
  7. ----BehaveTest2.feature
  8. ----steps/
  9. ------test_steps.py
  10.  
  11. import sys, os
  12. sys.path.append('../common')
  13. import common
  14.  
  15. Tests/
  16. ├── BehaveTest1
  17. │   ├── BehaveTest1.feature
  18. │   └── steps
  19. │   └── test_steps.py
  20. ├── BehaveTest2
  21. │   ├── BehaveTest2.feature
  22. │   └── steps
  23. │   └── test_steps.py
  24. ├── common.py
  25. ├── __init__.py
  26.  
  27. import Tests.common
  28.  
  29. from behave import when, then
  30.  
  31. @when("foo")
  32. def foo(context):
  33. pass
  34.  
  35. @then("bar")
  36. def bar(context):
  37. pass
  38.  
  39. $ behave Tests/BehaveTest*
  40. Feature: BehaveTest1 # Tests/BehaveTest1/BehaveTest1.feature:1
  41.  
  42. Scenario: foo # Tests/BehaveTest1/BehaveTest1.feature:3
  43. When foo # Tests/common.py:3 0.000s
  44. Then bar # Tests/common.py:7 0.000s
  45.  
  46. Feature: BehaveTest2 # Tests/BehaveTest2/BehaveTest2.feature:1
  47.  
  48. Scenario: foo # Tests/BehaveTest2/BehaveTest2.feature:3
  49. When foo # Tests/common.py:3 0.000s
  50. Then bar # Tests/common.py:7 0.000s
  51.  
  52. 2 features passed, 0 failed, 0 skipped
  53. 2 scenarios passed, 0 failed, 0 skipped
  54. 4 steps passed, 0 failed, 0 skipped, 0 undefined
  55. Took 0m0.000s
  56.  
  57. :$ behave Tests/BehaveTest1/BehaveTest1.feature
  58.  
  59. import Tests.common
  60.  
  61. DIRECTORY STRUCTURE:
  62. +-- features/
  63. +-- steps/ (optional, common steps)
  64. +-- alice.features/
  65. | +-- steps/ (specific steps for alice sub features, can use common steps)
  66. | +-- *.feature
  67. +-- bob.features/
  68. +-- steps/
  69. +-- *.feature
  70. +-- environment.py
  71.  
  72. features/test.feature
  73. test_steps/
  74. test_steps/classes
  75. test_environment.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement