0

I am writing Cypress Integration Test for UpdatePassword. One reason I wanted one whole test: We had a minor bug before, when the user enters a bad password, and then fixes it up, the Submit Button would not be Reenabled to press.

What is the best way design, should I create whole or separate?

I can create one whole full test case, like this

  1. User inputs bad password
  2. Check for red label warning html element
  3. Then Put in good password
  4. Confirm Success

Or separate into two

Test Case 1

  1. User inputs bad password
  2. Check for red label warning html element

Test Case 2.

  1. Then Put in good password
  2. Confirm Success

enter image description here

2 Answers 2

2

I'd say two tests:

Test One

  1. User enters bad password
  2. Check the warning label has the correct information

Test Two

  1. User enters bad password
  2. User enters good password
  3. Check the confirm button is enabled

If you want, you can go on to a third test that contains the steps from test two plus clicking the button and checking that the proper update successful message returns.

This approach does mean more repetitive tests, but it has the advantage of tests not relying on any prior tests.

2
  • why did people vote down my question? trying to learn, can you vote up? thanks
    – mattsmith5
    Commented Aug 11, 2023 at 16:52
  • @mattsmith5 - Have you read the FAQs about asking in the Help site? (sqa.stackexchange.com/help) This community tends to downvote questions users find too simplistic or too opinion-based rather than commenting or making edit suggestions.
    – Kate Paulk
    Commented Aug 11, 2023 at 19:02
1

In my experience the decision of whether to create single or multiple test scripts covering single/multiple test cases is a crucial decision.

I would suggest combining multiple validations in a single test to create a real-world scenario where the user sees different validation messages for different attempts, and then one attempt gets successful.

  • The only challenge that will arise is the failure of the whole script if any of the assertions fail in between before the last step, and as a result, the rest of the code will not be tested or executed.

  • An automation strategy is to use "soft assertions" to continue the script execution in case any of the assertions fail in between. This will allow you to cover multiple validation scenarios in a single test script.

Test Example

  1. User inputs bad password 1
  2. Assertion for validation 1 (soft assertion; in case it fails, it moves to execute the 3rd step)
  3. User inputs bad password 2
  4. Assertion for validation 2 (soft assertion; in case it fails, like a typo in the message, it moves to execute the 5th step)
  5. Enter a valid password
  6. Confirm Success

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.