How do I know what should be a test case and what a test suite in Selenium?
Is there any general rule for it? I’ve read the seleniumhq site any several others, but
they only have some basic examples while I want to test a whole website.
My questions are for example:
-
Say I’m testing some multi-step web form. Should I make it one test suite and each
step (in web form) would be a single test case or all steps should be one test case? -
Say I’ve built a web forum and I want to test several features in it. Do I make one
test suite and each test case tests each feature (or several cases per each feature) OR
I’ll have many test suites and each suite tests one feature with a few test cases. -
What to do if I have a form which contains 5 checkboxes – each of them can be obviously clicked
or not. This may have some consequences when I submit the form. So – theoretically there are 2^5=32
possible execution flows. Should I test all 32? Or maybe should I just test each checkbox separately
to simplify things. When can/should I simplify, when not? (assuming that checkboxes MAY be
somehow related). -
Should each feature have test cases which test both positive and negative results?
For example should I just focus on correct workflows – i.e. submit valid form and see if the
website did what I asked for (worked) OR also submit empty form and check if error message
appeared.
Can you answer these giving some practical examples (if needed)? – maybe using some (StackOverflow?)
site as example site.
Answer to 1 and 2:
I think this is more of an issue about test design rather than Selenium. Consider Selenium as a tool which controls the browser/website, just like a user would do. It simulates a user clicking through the page. To know what a test case is and what a test suite is, you should think of the functionalities of your web application you want to test. Let’s say you have a web shop, then one test case could test the following use case:
It depends on your application which workflows or functionality you want to test.
I would consider a test suite for a whole project so one suite for one web application. And this application has a lot of test cases. Every test case is a use case.
When building a test suite, consider some design patterns like ui-mapping, page object design and consider the advantages of a test management system (like TestNG in Java).
here are some links to that:
Answer to 3 and 4:
It is similar to 1 and 2. It is always a question WHAT you want to test. Or a question what your project leader wants you to test (or customer). Every functionality which is important and should work should be tested.