1

From the knowledge I have acquired while doing automation with other tools, I want to ask about specifics of doing that in Selenium (with Java). Questions:

  1. I remember watching a video on Junit where all the assert methods are wrapped up in a try block and an additional library is imported to make sure that a test fails, if an assert fails. How common is that approach?

  2. Contrary to above, some say that you should never put assert methods in a try block. If you do that, running a java file will pass, even if an assert fails. Is doing this way also common?

  3. If you have many tests to run, is it common to sort returns of assert methods in an excel file and later run only those tests, where asserts return false?

  4. If you do continuous integration, it is important, from the way I understand, for a run to fail, if an assert method returns false. Otherwise, unfixed bugs will be deployed into production. Am I right and if so, how do you assure that that happens?

Narendra Chandratre
2,8347 gold badges31 silver badges60 bronze badges
asked Aug 13, 2016 at 5:05
1
  • @NarendraC Hello. You suggested edits to this question and I accepted it, but it has not been answered yet. Could you please try to answer. Thanks Commented Aug 16, 2016 at 16:27

1 Answer 1

1

Best of my knowledge, sharing answers hope it will help

Answer 1:

  • Yes. Assert failure should fail test case too. I'm keeping same practice and even many documents pointing towards this practice.
  • I will suggest we should avoid repetitive use of same Assertion

Answer 2:

  • No, I have different opinion. We should use assertion
  • Assertion -> If condition failed, program explicitly gets terminated. This is the power and if fails we can figure something is not working as expected

Answer 3:

  • Its possible to re-run only those tests which get failed using TextNG
  • Check this

Answer 4:

  • Continuous Integration, used to execute our tests continuously
  • "run to fail" is it really? I think we execute test to confirm that it gets pass means everything is working fine & as expected
  • As mentioned above, Assert has power to restrict and terminate execution if condition fails
  • Due to this we always ensure that unfixed bugs must not be deployed into production [Automation is not a replacement to manual testing for deployment of application]
answered Aug 16, 2016 at 18:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.