-1

In test automation frameworks, what is the best way to verify if a value obtained during an execution is the expected one or not? I was thinking about 4 ways to do that but I do not understand what would be the correct reasoning and why.

  1. Compare the value with the expected one through an "If" statement and manually throw an exception if it does not match.

  2. Print an error message to standard output from the test run.

  3. Store the value and at the end perform a verification of all the values ​​collected from the tests and report the differences.

  4. Use an assertion to compare the value with the expected one and let the framework collect and report the result.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
JustToKnow
  • 785
  • 6
  • 23

1 Answers1

0

The ideal way would be to:

Use an assertion to compare the value with the expected one and let the framework collect and report the result.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352