Skip to content

Commit 84ec7a8

Browse files
committed
Remove double Timber logging in Espresso
1 parent 016739c commit 84ec7a8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • app/src/androidTest/kotlin/info/appdev/chartexample

app/src/androidTest/kotlin/info/appdev/chartexample/StartTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package info.appdev.chartexample
22

33
import android.graphics.Bitmap
4+
import android.util.Log
45
import androidx.compose.ui.test.assertIsDisplayed
56
import androidx.compose.ui.test.junit4.createEmptyComposeRule
67
import androidx.compose.ui.test.onNodeWithTag
@@ -57,12 +58,25 @@ class StartTest {
5758
@Before
5859
fun setUp() {
5960
Intents.init()
61+
Log.d("StartTest", "Timber tree count before setUp: ${Timber.treeCount}")
62+
63+
// Remove all existing trees to prevent double logging
64+
// Store them so we can restore after test if needed
65+
if (Timber.treeCount > 0) {
66+
// Uproot all existing trees to prevent double logging
67+
Timber.uprootAll()
68+
}
69+
70+
// Plant a single test tree
6071
Timber.plant(DebugFormatTree())
72+
Log.d("StartTest", "Timber tree count after setUp: ${Timber.treeCount}")
6173
}
6274

6375
@After
6476
fun cleanUp() {
6577
Intents.release()
78+
// Clean up test timber tree
79+
Timber.uprootAll()
6680
}
6781

6882
@Test

0 commit comments

Comments
 (0)