Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions runner/android_junit_runner/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

* Make perfetto trace sections for tests more identifiable by prefixing with "test:" and using fully qualified class name. (b/204992764)

* Add logs at the start and end of RunBefore and RunAfters sections to help bug understanding. (b/445754263)

**Breaking Changes**

**API Changes**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package androidx.test.internal.runner.junit4.statement;

import android.util.Log;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.junit.runners.model.FrameworkMethod;
Expand All @@ -32,6 +33,8 @@ public class RunAfters extends UiThreadStatement {

private final List<FrameworkMethod> afters;

private static final String TAG = "RunAfters";

/**
* Run all non-overridden {@code @After} methods on this class and superclasses before running
* {@code next}; all After methods are always executed: exceptions thrown by previous steps are
Expand Down Expand Up @@ -62,6 +65,7 @@ public void evaluate() throws Throwable {
} catch (Throwable e) {
errors.add(e);
} finally {
Log.d(TAG, "start");
for (final FrameworkMethod each : afters) {
if (shouldRunOnUiThread(each)) {
runOnUiThread(
Expand All @@ -83,6 +87,7 @@ public void run() {
}
}
}
Log.d(TAG, "end");
}
MultipleFailureException.assertEmpty(errors);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package androidx.test.internal.runner.junit4.statement;

import android.util.Log;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.runners.model.FrameworkMethod;
Expand All @@ -31,6 +32,8 @@ public class RunBefores extends UiThreadStatement {

private final List<FrameworkMethod> befores;

private static final String TAG = "RunBefores";

/**
* Run all non-overridden {@code @Before} methods on this class and superclasses before running
* {@code next}; if any throws an Exception, stop execution and pass the exception on.
Expand All @@ -52,6 +55,7 @@ public RunBefores(

@Override
public void evaluate() throws Throwable {
Log.d(TAG, "start");
final AtomicReference<Throwable> exceptionRef = new AtomicReference<>();
for (final FrameworkMethod before : befores) {
if (shouldRunOnUiThread(before)) {
Expand All @@ -77,6 +81,7 @@ public void run() {
}
}

Log.d(TAG, "end");
next.evaluate();
}
}
Loading