1

I am in confusion to write the test cases for one of my requirement.I have a signup process it will have 8 steps to complete a signup.How to write a test script for all steps by validating the each and every validation for single field. I am using the java along with selenium webdriver how the framework should like ?

All validations should take in a single test case ?

I am happy and welcome with your ideas/approch

1
  • 1
    You should probably mention what technology you are using together with Selenium to write your tests, i.e. Python, Ruby, Java. In most cases though, there should be a clear difference between test steps and test cases. Your 8 steps of the signup process should become test steps, forming a single test case.
    – Cronax
    Commented Apr 29, 2016 at 8:23

3 Answers 3

1
  1. Separate your actions on a webpage from test cases. Follow Page object pattern/framework.
  2. You can use junit or testNg unit testing framework to write your test cases. I would advise you to use testNg as gives you lot of flexibility.
  3. Now you like to validate all 8 steps that you want to execute, now the question is what if first step fails, what do you want to do next? a) Do you want to fail a test case and stop the execution there? Or, b)You want to execute all the steps without worrying its validation status and report status at the end?

For (a) its very straightforward, use Assert.assertEquals(actual, expect) method. If you want to follow (b) then you would like to use soft Assertion which will allow you to execute all the steps and it report cumulative status in the end.

For soft Assertions using junit, find out details here. For test, find it here.

0

You should use one of test framework. If you use Java I recommend to use TestNG. Then you can use assertion (e.g. Assert.assertTrue(yourCondition, message) for all fields, it depends on test case and your goal. Note that if any assertion is failed then test execution is finished. If you want to prepare test cases with different login data you can use DataProvider from TestNG.

0

The very first thing you should do is create a matrix of your steps which will give you exact idea how many test scenarios you have to test.

Based on the matrix create a CSV (or any other data provider) according to matrix and add the data. Each row of CSV will be 1 test scenario and each row will have additional column which is expected output for e.g: if user name is invalid then a expected error message should be given for test scenario.

Now write a function which will read the data from CSV row by row and assert the expected output with actual output.

Hope it helps you.

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.