I am fairly new to automation and am trying to form the basic structure for my company moving forward. I have done some research and am trying to implement POM but am a bit confused over structure and length of test cases.

Should test cases include navigation to the intended test page or should this be included in the setup?

Say for example I am trying to add a new item, it requires:

  • Logging in
  • Navigation through 3 pages (button press on each and possible check)
  • Reach page then filling out the form.

Now in my test case I am writing all these steps but it feels bloated and difficult to maintain, since all I am doing is basically clicking one button on several pages it makes the test case messy.

Most documentation online seems to deal only with login and rarely goes into more depth after that first step.

1 Answer 1


There would likely be several test cases relevant to the particular area of your site. So I would use the following approach:

  1. Define procedures (or functions) which would represent each particular user step like Login, etc.
  2. Group the tests which have some common precondition steps
  3. Set those precondition steps for all the mentioned tests. This is easily achievable if you use some test execution frameworks like JUnit or TestNG. You just annotate the "preconditions" method so that it is automatically executed before each particular test is.
  • Does this not mean you will have reliance on other tests passing in order for the main one to pass? I thought each test should be decoupled from others? Not to mention these precondition steps are mainly just site navigation to mimic a user.
    – Jonnyboy
    Apr 23, 2018 at 11:46
  • yes, you can think of those "other" tests as smoke tests. Unless you have smoke tests passed (tests which check if you can reach the particular site area) you won't get much value from other types of tests.
    – Alexey R.
    Apr 23, 2018 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.