General Recommendations

The following lists some recommendations to keep in mind when trying to find the cause of an error or warning message in an automated test:

  • Sometimes, you might be doing exactly what you need to do in your code or in the configuration of your test. So, the error might be caused by a misconfiguration or an issue with the tools that you are using. Check the documentation for your IDE, test framework, or programming language.
  • Google it, Bing it, or use your favorite search engine to find an answer. There is a high probability that you are not the first person to face a particular error or warning message; the internet is full of open forums of testers looking for help and sharing their knowledge with one another. The following are some tips for googling an error:
    • Copy and paste the error message, except for the parts that are specific to your project, such as the line numbers, class names, and so on.
    • A solution that helped one team solve an error might not help to solve yours, even if the issue seems the same. This is because every scenario is one of a kind. Analyze the specifics of the problem and the project and compare them to yours. You might have to skip one (or more) of their steps, or include an extra one. Do not expect to find a straightforward online solution for all your testing issues.
  • Double-check the browser and browser driver configuration. If you are running tests on Chrome, check that ChromeDriver is properly configured and is executable from your test code. In addition, verify that the browser version you are using is compatible with the browser driver. Browsers often get updated automatically, but browser drivers don't. For example, running tests with Chrome 67 and ChromeDriver 2.33 will likely cause some execution errors, since the two versions are not compatible.

To learn more about versions and their compatibility, go to https://chromedriver.storage.googleapis.com/index.html.
  • Keep your test dependencies up to date. Every few weeks, there is a new browser driver release, a Selenium release, or a browser release, each one improving upon its previous version, providing new functionalities and fixing bugs from old releases. Ensure that you are not using an old version of Selenium with a very recent version of ChromeDriver, for example, as they need to be constantly synchronized.
  • When you are positive that the problem is coming from your code and you've exhausted the online help, the only way to figure out exactly what is causing an error is to go through the code. Some tips are as follows:
    • Check the error line, method, or class indicated by the report to find possible causes. Run the test in debug mode and set breaking points around the troubling code line; sometimes, if you go step by step, your test will work without issues. This might indicate that an element of the web page is taking longer than expected to load (that is why it works in debug mode; you are going step by step, providing more time for the element to load), and you will have to set an explicit or implicit wait.
    • Most likely, the methods and classes in your project are interconnected. So, even if an exception is thrown in a particular line of code, the root of the problem might come from somewhere else. Run the test in debug mode and use breaking points around that specific line of code. This will help you to find variables or elements with null or wrong values, for example, which can cause a specific line of code to fail.
    • If you are using a version control system like Git, review the recent changes made to the code, to identify possible causes of the current failure. You can also revert the code to a previous working state and apply the changes one by one; likewise, you can analyze the code changes that might be breaking your test in detail.

You should now understand how to analyze a TestNG test report and how to find possible solutions to error and warning messages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.32.116