me_digvijay
me_digvijay

Reputation: 5492

How to catagorize or group selenium webdriver tests

Suppose I have a web page with several links on it. Also it has few buttons which execute some JavaScript.

So should I create one Java class for testing each of these links and elements or should I test all the links in just one test method and other elements in another one(so ending up with two Scripts).

Is there a another way of gouping these tests.

Thank you.

Upvotes: 0

Views: 599

Answers (2)

Nathan Merrill
Nathan Merrill

Reputation: 8386

I have found that writing test cases based on actions is much more useful than writing based on pages.

Obviously, we would love to have everything automated. But realistically, this isn't possible. So we test what is most important...which happens to be: 1. The primary purposes of the product you are testing, and 2. The security of the product.

To make this easier to understand, lets say I have a Checkout page.

If I were to test based on a page, I would make sure every link on the page would work. I would verify that I can type in a new number in the quantity field, and make sure that the page verifies that the credit card number I type in is correct.

This method would somewhat test Security, but beyond that, it would test the UI. What would happen if I clicked on the Checkout button, and I was sent to the right page, but the item I was trying to checkout disappeared? That is a huge problem, but the test based on the page would work.

However, if I were to test based on actions (go to this page, add to cart, type in personal information, and then checkout), now I have made sure that the most important part of your program works, checked security, and even a little UI testing.

All in all, write your testing to do what the average user would do. No normal person is going to sit on the same page, testing out every little feature on that page.

Upvotes: 1

cegprakash
cegprakash

Reputation: 3125

It depends on whether you like to see 1/1 tests passed or 2/2 tests passed.

Upvotes: 0

Related Questions