Cloudkibo / KiboPush_Automated_Testing

KiboPush_AutoManted_Testing
0 stars 1 forks source link

Improve tests consistency #66

Closed Smat26 closed 6 years ago

Smat26 commented 6 years ago

Their can be flakiness in the tests when they are done.

They can be improved by following practices highlighted in various articles, which are:

  1. Asserting error vs failed test
  2. Looking into Explicit and Implicit wait
  3. Avoiding sleep in the script

Sources https://testing.googleblog.com/2009/06/my-selenium-tests-arent-stable.html https://sqa.stackexchange.com/questions/18307/random-selenium-webdriver-tests-inconsistently-fail-and-pass-on-ie-browser https://www.joecolantonio.com/2014/04/01/the-1-killer-of-selenium-script-performance-and-reliability/ https://sqa.stackexchange.com/questions/32135/fail-vs-error-in-automated-tests

jekram commented 6 years ago

what is the status here?

Smat26 commented 6 years ago

So I looked this up in a lot of detail.

I compared the scenarios described above with my own script.

  1. Assertion vs Failed Test. I went case by case to realise where this might choose to be a reason for inconsistency. There are places where it is more appropriate to assert for tests, and I have added those things to the test cases. This has been done.

  2. Explicit This was rather troublesome. explicit wait, wait indefinitely until certain element is on the page, only then it resumes testing. It is more desirable than sleeping, however i found it almost impossible to do this conditional wait on any specific element, because our pages are too dynamic, and it's hard to pin down, under what condition should we stop the wait. I had discussed this with Baqar for his insights to this. I have added a bigger implicit wait in hopes to curtail the affect of unsteady internet.

  3. Thread.sleep: I have removed it, with Implicit wait. So now it polls the DOM, to find whatever element it it looking for. Instead of having wait a constant time of 1 second between every step. This should make the tests run faster now.

jekram commented 6 years ago

@Smat26 Are we done and we should close this?