Test results that differ from running via command line versus IDE



  • I have just run a set of automated tests via the command line using Maven as my build tool and JUnit4 as my test execution framework. There was a report of two errors which were recorded in a text file as NoSuchElementException: no such element. I decided to run the same class from the IDE and received no errors.

    Has anyone experienced this? If so, can someone please explain what might be the cause to make such an event occur.

    Thanks in advance.



  • Three possibilities:

    1. The IDE inputs (e.g. arguments and environment variables) are not the same as the command line inputs. You can check that with print statements or logging.
    2. The libraries are not the same. I assume you know how to check this.
    3. You found a timing problem. To check this, first determine which element is erroring out, then try waiting before accessing that element.


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2