Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the recommended folder structure for Protractor e2e test cases?

Should the folder structure for e2e test cases in Protractor be the same as that of the application?

like image 734
ashok_khuman Avatar asked Jun 25 '15 06:06

ashok_khuman


People also ask

Which folder in an Angular 8 project is used for end to end testing?

Jasmine is a testing library the provides all the assertion and utility functions needed to write unit and E2E tests. Let's take a look at a simple example of an E2E test. In our Angular CLI project we have a folder named e2e . This is where our e2e tests are kept.


Video Answer


1 Answers

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.

like image 55
avandeursen Avatar answered Sep 22 '22 11:09

avandeursen