0

I created page object model framework using Selenium Web Driver,TestNG and ANT.

Problem: Single Test case is executed successfully but while executing them together some test cases fail.

Reason:

  1. Network issue.
  2. Browser is not able render DOM quickly which creates StaleElementException, NoSuchElementExeception etc.
  3. Server is taking time to respond to request

Work Around: In my framework I am re-running failed test cases automatically.

6
  • 2
    What is your question? It's not clear from your writing, you might want to reword it. Commented May 24, 2015 at 15:54
  • Do you mean your tests are failing when run all together? In a sequence or concurrently? Does any test depends on the results of another?
    – dzieciou
    Commented May 24, 2015 at 17:19
  • What is network issue?
    – dzieciou
    Commented May 24, 2015 at 17:21
  • Second reason: did you try to increase timeout? Wait for certain elements to load, before starting a test?
    – dzieciou
    Commented May 24, 2015 at 17:22
  • 1
    Finally, this workaround has some flaws: if the test if failing because of intermittent bug in the system, then by re-runing the test until it pass you may ignore this bug. How do you know when the test is failing because of the bug in the test or in the system?
    – dzieciou
    Commented May 24, 2015 at 17:25

2 Answers 2

1

You need to troubleshoot / evaluate below options

  1. Is your test machine having low configuration or in a different network ?
  2. If you run tests on machine which has Application installed is it faster ?
  3. Can you batch it and run tests ? instead of running it altogether ?
  4. Can you distribute the cases. Compile the the project as a jar. Deploy it in multiple machines. Run selected set of cases from each executable ? This way you have multiple test machines sharing the load
  5. Re-running failed test is good option, You many need to isolate / trouble shoot those failed tests. Can you split those cases (long running cases further)
  6. I have personally observed timeout issues when machines are in different domain. I have tried to map network drives locally, install app on the test machine, increase configuration of test machines

This mostly looks to be infrastructure issue, network issue. Alternatively you can try distributing cases across multiple machines. Instead of running 700 cases I would try building up in 10, 20, 50, 100 and start distributing them across multiple nodes.

2
  • What's low configuration?
    – dzieciou
    Commented May 25, 2015 at 17:14
  • 1
    your machine has 2GB RAM, Single Proc machine or 100% CPU usage before starting the run. These situations would lead to resource contention, slowing execution.
    – Siva
    Commented May 26, 2015 at 7:14
0

Browser is not able render DOM quickly which creates StaleElementException, NoSuchElementExeception etc.

These are not caused by the browser rendering slowly. This is caused by your code not waiting for the elements to appear. If this is a react app in the browser you need a lot of WebDriverWait(driver, XX).until(EC.something)

If you are launching all 700 requests at the same time,that's just poor/crazy design. Create a queue and N runners and pop a test of the queue everytime a runner finishes the previous test.

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.