TestProject Forum

Best practices for organizing tests and for testing order-dependent scenarios

On our website, an internal user can create an invitation to send to an external user. The external user accesses the website through an email link and completes a profile. The internal user then reviews and approves the profile.

I would like to use a Page Object Model to manage tests. I am considering this structure:

  • Use one project for the website.

  • Under that project, use folders to organize tests

    • One top-level folder for each user type that can access our website (internal, external);

    • One top-level folder for tests that access an email account (outside of our website)

    • One top-level folder for ‘scenario-level’ tests that call lower-level tests. The scenarios test a flow in the system that needs to occur in a particular order.

Project: Company Website

Folder (Top level) Folder (Second level) Tests (for this page)
Internal User Create Invitation Page create invitation, submit invitation, verify invitation
Internal User Review Invitation Page review invitation, get request number
Internal User Profile Page approve profile
External User Profile Page complete profile
Email open email, get request number, open link
Scenarios Invite New Client This scenario test will call each of these tests in order:
  • Internal/Create Invitation Page: create invitation

  • Internal/Create Invitation Page: submit invitation

  • Internal/Create Invitation Page: verify invitation

  • Email Page: retrieve request number

  • Email Page: open email

  • Email Page: click invitation link,

  • LF Profile Page: complete profile,

  • Q Review Invitation Page: open profile,

  • Q Profile Page: approve profile.|Preformatted text

Questions:

  • Are there any best-practice examples available for using the Page Object Model for recorded tests?

  • Is this a reasonable approach? Are there better ways to organize tests?

  • I read somewhere that you should avoid using the output of one test to set a Project parameter value to be used as input for another test (to avoid creating dependencies among tests). Using the ‘scenario’ tests would allow me to store information (e.g. the invitation number) that needs to be passed from one test to another in a Test parameter for the scenario test and would contain the order dependency in that scenario test. Are there better ways to test a series of actions like this?

Hello,
The approach you suggest is indeed a good practice.
Currently, all the elements created during the recording of your application are saved into the elements folder.
It’s possible to create and organize this folder into sub-folders to achieve POM like you are describing in your example.
Any test in your project that set to use this application will use the elements from the elements folder, meaning that by changing an element name or locator you will affect all tests using it. (easy to maintain)
As you can see it’s as simple as drag and drop:

Regarding your second question, it’s possible to use Project parameters to save values between tests or read and write from a CSV file using CSV Operations addon.
Let me know if you still have questions.