Improving WebDriver's error messages - webdriver

We have webdriver tests written in Java that are run continuously and when errors occur, team members who are not familiar with WebDriver or Java are sometimes reviewing the errors. We're finding that it can be slow and difficult to understand what went wrong with the standard error messaging and are trying to think of ways outside of the box to augment the existing error messaging. We already have videos and screenshots of the tests.
I'm wondering if anyone has implemented anything that makes the error messaging in WebDriver more readable by "lay people"
Thanks!

I usually write custom exceptions to wrap the webdriver exceptions. Page objects throw these custom exceptions when elements are not found/visible/enabled etc. I try not to throw webdriver exceptions in my (Nunit) tests, this way test reports can also be published to non-techs like managers etc.

Related

How do I know what is the cause of external code being called in Visual Studio CPU profiler?

I did profiling of my asp.net web application when it randomly started using 99% of CPU to know what is going on. But what I get is some System.Collections.Generic.Dictionary<int,int>.FindEntry(int) called by some other external code are the most expensive one.
What can I do with this information? It should be somehow related to my code (or at least my actions), but profiler is showing me just that some external code are calling other external code (which I can neither look at, let alone change).
How do I know what is the cause of this? Is it even possible?
This is the other parts of call stack (from top to bottom, and the bottomest is FindEntry method), if it is somehow useful:
Yeah I got this same problem. I tried turning on native and external code debugging and that helped but it's still very confusing. It seems like VS profiler has a hard time tying external codes calls back to whatever ultimate started the call chain in your own code.

Debugging QJSEngine?

I have a project that provides a JS API for (long running) user scripts.
This project still uses the QtScript module which is kinda bugging me since the module is labeled deprecated for quite some time.
My problem is that i need the users to be able to debug their JS code, which is where QtScript and especially QScriptEngineDebugger is really handy.
Now i just read those 2 lines on the "What's New in Qt 5.7" help page.
Enabled all debug services to work with QJSEngine (instead of QQmlEngine), which allows non-QML JavaScript debugging or profiling.
Added support for debugging multiple QJSEngine instances at the same time.
Obviously that caught my eye, but searching through the rest of the help i couldn't find anything about debugging QJSEngine.
Can anyone tell me how to achieve something similar to QtScript and QScriptEngineDebugger with QJSEngine?

Implementing exception handling in ASP.NET 3.5

I would like to implement exception handling on a ASP.NET application. How do you suggest I implement it? Some requirements are:
User should see a friendly page when an exception occurs
Admin should get an email with exception details
I understand there are several ways of implementing exceptions (ex: Log messages in the event viewer)
What's the recommended approach?
The recommended approach really depends on what you need to do with the error information.
For simple apps, just setting up the web.config file to redirect to a friendly error page might be enough.
It's usually a good idea to record unhandled error information to a database, file, windows application log or web service by handling them with the Global.asax Application_Error event. You can also use the web.config to get your friendly page with that. Generally I wouldn't recommend using the windows error logs as they tend to be a bit obtuse, but there's nothing wrong with it.
For very detailed operational information, including warnings and info messages, tools like log4net are widely used. Usually you would go this route for products or enterprise level applications where your support teams need as much information as possible to diagnose the errors.
MSDN has a walkthrough of some of the basic error handling setups and what you can do with them.
I wrote an article on this that I think you'd really like
http://dotnetblogger.com/post/2008/12/03/ASPNET-Health-Monitor.aspx
As for the friendly page bit, I just use the built in exception handling in the web.config... since you are implementing the unknown exception stuff in the global.asax
You can also handle exceptions in try/catch blocks and add a note to it if you want. Then just bind the database to a nice gridview for admins to easily see the errors.
I have a nice reusable HttpModule that you can look at here. It can be used to easily deal with Exceptions that occur during normal user requests, and those that occur in background threads.

Debugging .aspx in WAP

In WAP, should you expect to get errors when debugging an .aspx during compile time? I'm not getting any errors when my .aspx has errors until runtime when using Web Application Projects. I never really thought about it, because I've always just used WAP. I'm asking the question for someone else and I don't see any information on an answer to this.
we do conditional rendering of custom controls so it's important for us to be able to debug errors during compile time in an .aspx page before it hits production.
If you have syntax errors these can get caught at compile time. However, if you have bugs in the logic of the program or the look of the page, that may not always be caught at compile time. For example, if you want to have a specific layout of a form this requires running the page in various browsers to confirm that there isn't a bug.
Tools like Resharper can help some but there isn't a silver bullet for this. It may be better to have tests like nUnit or WatiN to help catch errors if something doesn't work as expected in terms of finding bugs.

ASP.NET Logging - log4net or health monitoring?

I'm looking at a fresh asp.net site in 3.5 that has absolutely no error handling or logging. What are some good options for logging and handling errors? I've used Log4Net on the 1.1 framework but hear there are potentially better options in 3.5.
One option is ELMAH. I asked a question about it here: ASP.NET Error Handling.
Since then, I have implemented a slightly modified version of it and the logging plus e-mail is great and easy to integrate via the web.config file.
We use two options for our logging:-
ELMAH for unexpected exception handling
NLog for expected, manual (debug, info and error) information.
ELMAH is a great out-of-the-box plugin that automatically captures exceptions (from 404's (page not found) to 500 exception thrown) and has a built in web-ui to visualize these errors. So it's a really quick and effective way of grabbing unexpected errors that occur.
Now NLog compliments this by having our developers manually insert debugging information into the code at specific spots, so when we need to get information out of a non-locahost system, it's very easy. For example, we litter log.Debug(..) code in most of our methods to see what the local variables are or returned values, etc. For more important information, we then use log.Info(..) .. but use this a lot less. Finally, for serious errors which we have trapped and handle, we use log.Error(..) or log.Warn(..) .. generally inside some try/catch scopes. So on our test or live servers, we then turn on all logging states (eg. Debug and greater) if we need to grab LOTS of data, live... or just the general important information, such as Info states and greater. We always have Warn, Error and Fatal states always on. Debug state generates a LOT of data, so we use that only sparingly.
So to summarize, I suggest you use TWO approaches to your WebApp. Elmah for excellent unexpected error trapping and NLog for expected information and errors.
Finally, NLog is WAAAY easier to use/get working than Log4Net. It basically superceeds it, IMO.
If you are used to log4net, stick with what you know. It's easy, fast, and works well. I've used it for years in 1.1, 2.0, and now 3.5.
ASP.NET Health Monitoring actually does a pretty decent job right out of the box!
MSDN, How to: Send E-mail for Health Monitoring Notifications
Enterprise Library maybe has a learning curve but is a good project.
In Asp.Net follow david hayden's article Enterprise Library 2.0 Logging Application Block
Personally, I havent tried log4net but seen the specs and examples for winforms, but my organization coded our own logging mechanism that reports and logs errors that are caught in the global.asax that reports everything we need to know about the stack trace, session (if exists), form's NVC, version of the app, URL that originated the error with querystring, and HTTP headers. Though I noticed that not all errors get logged there; such as forms authentication expiration or application pool restart/shutdown or anything reported by IIS that was not thrown by the application executing.

Resources