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

Adapt to latest ddmlib version #210

Merged
merged 1 commit into from
Nov 7, 2014
Merged

Conversation

roman-mazur
Copy link
Contributor

This change is a quick adaptation to changes in DDM lib used by Android Gradle plugin 0.14.x.
Closes #208.

That said, I do not have a strong leg to stand on what assumption failure really means. However, it seems to correspond to error in previous versions.
I didn't add ignored test handling since it requires additional changes in reports code.

I tested this with combination of spoon gradle plugin and Android plugin 0.14.1.

methodResult.markTestAsFailed(trace);
}

@Override public void testAssumptionFailure(TestIdentifier test, String trace) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumption failure comes from JUnit 4. It means that the parameters in which the test was executing render the test irrelevant. It's much more like a programmatically determined ignore and should be treated as such.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example would be:

@Test public void bluetoothSomething() {
  assumeThat(device.hasBluetooth());
  assertTrue(somethingWithBluetooth());
}

You would get an assumption failure when the test was run on a device without bluetooth so the test isn't relevant for that device.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But how can an assumption be made with Android's JUnit 3 runner?
Is there some new API that allows to write an Android test with an assumption or mark a test as ignored?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's been a JUnit 4 runner in AOSP for about 6 months now. https://android.googlesource.com/platform/frameworks/testing/+/master/androidtestlib/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Well, actually for more than 2 years :)
Do you think this quick change can be accepted (currently ignoring assumption failures just like ignored tests)?
Another question is what has happened with what was called errors previously? Are they all failures now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was only made public recently, having been worked on internally for much longer.

@roman-mazur
Copy link
Contributor Author

Updated to ignore assumption failures.

logDebug(debug, "assumption failure %s", trace);
}

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this should be on the same line as the method

This change is a quick adaptation to changes in DDM lib used by Android Gradle plugin 0.14.x.
Ignored tests and assumption failures are not represented in reports.
Closes square#208.
@roman-mazur
Copy link
Contributor Author

Code style is fixed.

JakeWharton added a commit that referenced this pull request Nov 7, 2014
Adapt to latest ddmlib version
@JakeWharton JakeWharton merged commit 7334a66 into square:master Nov 7, 2014
@JakeWharton
Copy link
Member

Thanks! I'll get this pushed out tomorrow (Friday).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest ddmlib API incompatibility
2 participants