Skip to content

Commit

Permalink
Remove skipping logic and ignore a test entirely if not a snapshot te…
Browse files Browse the repository at this point in the history
…st (#253)

* Skip marking test as ignored for test discovery phase to prevent skipped tests from being handled during execution

* Test

* Tweak

* Lint
  • Loading branch information
rbro112 authored Sep 4, 2024
1 parent 412f008 commit d6c7872
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.emergetools.snapshots.sample

import android.util.Log
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.emergetools.snapshots.EmergeSnapshots
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class ExampleSkippedTest {

@get:Rule
val activityScenarioRule = ActivityScenarioRule(MainActivity::class.java)

@Test
fun basicActivityView() {
val scenario = activityScenarioRule.scenario
scenario.onActivity {
Log.d("ExampleSkippedTest", "basicActivityView")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ internal class SnapshotsRunner(
Log.d(TAG, "Running test class: ${testClass.simpleName}")
super.run(notifier)
} else {
// Note: We intentionally do not mark the test as ignored as we
// don't care to acknowledge the test to ensure it doesn't take test run time/get assigned to an emulator
Log.d(TAG, "Ignoring test class: ${testClass.simpleName}")
notifier.fireTestIgnored(description)
}
}

Expand Down

0 comments on commit d6c7872

Please sign in to comment.