Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error logging and reporting format #392

Closed
phsong-google opened this issue Jan 13, 2017 · 0 comments
Closed

Update error logging and reporting format #392

phsong-google opened this issue Jan 13, 2017 · 0 comments
Assignees

Comments

@phsong-google
Copy link
Contributor

phsong-google commented Jan 13, 2017

The current error logging in EarlGrey is organized as:

Reason: ...
Bundle ID:...
Stack trace:...
Exception Name:...
Reason:... (AGAIN!)
Complete Error:...
Screenshots:...
Window hierarchy:...

The problem with the outputs are:

  1. The details of the element's description are within the reason statement, making it very hard to decipher. For example, an element-not-match reason looks like:
.../EarlGrey/Tests/FunctionalTests/Sources/FTRAccessibilityTest.m:33: error: -[FTRAccessibilityTest testAccessibilityValues] : Exception: Assertion 'assertWithMatcher: matcherForSufficientlyVisible(>=0.750000)' was not found
  1. The reason statement appears twice.

  2. In the "Complete Error" statement, it is possible that there is error nested inside on another error. And currently, only the description for the outermost error is shown.

To improve the error output, the proposal is to update the error in the following order:

Exception Name:...
Exception Reason: ...
Exception with Action: ... [Details of the Exception in JSON format]
Exception Details: Error Trace: ... [Error Trace of the Exception in JSON format]
Bundle ID: ...
Screenshots:...
Window hierarchy:...

Advantages are:

  1. Details of the error will decoupled with the reason. For example, a swipe action error will have this description:
Exception Name: AssertionFailedException
Exception Reason: An action failed. Please refer to the error trace below.
Exception with Action: {
  "ActionName" : "Swipe Up for duration 0.1",
  "ElementMatcher" : "((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel(\"Window swipes start here\"))"
}
  1. Error trace will allow you to view error-inside-error with ease.
Exception Details: Error Trace: [
  {
    "Description" : "Cannot swipe on view (V), as it has no window and it isn't a window itself.",
    "Note" :     {
      "V" : "<UILabel: 0x7fe7cb608590; frame = (43 333; 234 55); text = 'Window swipes start here'; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x60000028f320>>"
    },
    "Domain" : "com.google.earlgrey.SyntheticEventInjectionErrorDomain",
    "Code" : "0",
    "File Name" : "GREYSwipeAction.m",
    "Function Name" : "-[GREYSwipeAction perform:error:]",
    "Line" : "111",
    "TestCase Class" : "FTRGestureTest",
    "TestCase Method" : "testSwipeOnWindow"
  }
]
  1. The organization of the output will be crispy...

  2. Recovery suggestions will be added to an exception if there is any.

@phsong-google phsong-google self-assigned this Jan 13, 2017
@khandpur khandpur changed the title Update to the logging mechanism Update EarlGrey's error logging format Jan 13, 2017
@khandpur khandpur changed the title Update EarlGrey's error logging format Update error logging and reporting format Jan 13, 2017
@wuhao5 wuhao5 closed this as completed Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants