Protractor e2e测试用例的推荐文件夹结构是什么?

时间:2015-06-25 06:58:58

标签: javascript angularjs testing protractor project-structure

量角器中的e2e测试用例的文件夹结构应该与应用程序的文件夹结构相同吗?

1 个答案:

答案 0 :(得分:4)

This depends on the folder structure of your application :-).

To use Protractor effectively you need:

  • Page objects representing navigational states in your application. They hide the HTML implementation details and provide an API to your application in terms of the application domain.
  • Actual scenarios navigating through the pages and states. These scenarios can be simple (involving one state transition) or longer (involving the navigation across multiple states).

The page objects likely correspond to Angular elements such as templates, so you might follow a similar folder structure.

The actual test cases navigating through the states are closer to user stories. If you use a structured story format, you might organize scenarios into narratives ("As a ... I want ... so that ...") which then come with a number of acceptance scenarios ("Given ... when ... then") grouped together.

If you want to learn more about setting up Protractor tests using state machines, you can have a look at my blog post.