2

My question is which approach is recommended when writing automation test for testing something like filters present on page no.3?

  1. Should I directly use url of page no.3 in my test file and test filters on the same page. Or
  2. Use complete path like open home page , click some button to navigate to page no.2 and then navigating to page no.3 by clicking any link.

Should I mimic real user experience like whole path or jus url because I already have test scripts written for page no.1 and 2 ?

Thanks in advance.

  • 1
    Have you talked to your team about which approach would best serve what they need? – Brian Jul 17 at 22:05
  • 1
    Developers are suggesting to use direct url's because currently my tests are testing more than it should be but I m not sure. What if page 2 navigation is broken. – Sara Jul 17 at 22:21
  • 1
    Can you get to page 3 without having to go to page 1 and 2? Is there anything on the first two pages that changes the functionality/layout of page 3? – Brian Jul 17 at 22:22
  • 1
    Direct url is the only way. It's a ticketing site with events listed like ticketmaster. – Sara Jul 17 at 22:26
0

Based on your post and comments, I think it would be fine for you to just use the direct URL to the page you are testing. I do similar things in certain tests in my own automation solution.

Having said that, I think you should also create a test that DOES go from page 1 to page 2 and on to page 3. Simply to cover the case you stated of the user experience.

  • 1
    Ya I can try using suggested approach that way I wll cover both cases. Thanks so much. – Sara Jul 17 at 22:33
2

Like a lot of things in life, it depends.

Both options you lay out will work for test automation. However, what is your overall goal?

Are you testing a feature that is on one page? If so, you can load that page directly and test that feature. This is what you listed as option 1.

Are you testing a feature integration point, like a page redirect? Are you testing an end-to-end user scenario? For these, you'll want start at a beginning point and test from there. This is what you listed as option 2.

Ultimately, you'll probably end up with a mix of these solutions. Some questions to consider are:

  • How much setup do you have to do before the filter is applicable?
  • What is the intent of the filter while considering end-to-end scenarios?
  • How fast do you want your tests to perform?

For example, if you're testing a travel site and want to book a plane ticket for a specific airline, then option 2 is the better option, since you have to setup a departure date/time, starting airport, ending airport, etc. Once the applicable results are loaded, then you can filter per airline.

If you're testing an ecommerce site and you want to filter a category by a sub-category, option 1 would be better, since you most likely will know the direct url for the main category page without having to use a search query or menu navigation to get there.

It really depends on your context and what your test is attempting to assert.

  • Very well explained..Thanks for replying @Lee Jensen – Sara Jul 18 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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