title,body,link,tags,view_count,is_answered,score,answer_count
UI Testing with Hilt,"<p>I am trying to mock a view model in my UI Tests. It seems like I don't have it set up correctly, because the VM in the test activity is &quot;not initialized&quot;.</p>
<p>This is what I got:</p>
<ol>
<li>Hilt Module that provides my VM:</li>
</ol>
<pre class=""lang-kotlin prettyprint-override""><code>@Module
@InstallIn(SingletonComponent::class)
object ApplicationModule {
    @Provides
    fun provideMainViewModel(sharedPreferences: SharedPreferences): MainViewModel = MainViewModel(sharedPreferences)
}

</code></pre>
<ol start=""2"">
<li>Test Module to provide mocks:</li>
</ol>
<pre class=""lang-kotlin prettyprint-override""><code>@Module
@TestInstallIn(
    components = [SingletonComponent::class],
    replaces = [ApplicationModule::class]
)
object MockModule {
    @Provides
    fun provideMainViewModel(): MainViewModel = mockk(relaxed = true)
}
</code></pre>
<ol start=""3"">
<li>In my UI test:</li>
</ol>
<pre class=""lang-kotlin prettyprint-override""><code>@HiltAndroidTest
class ExampleInstrumentedTest {
    @Inject
    lateinit var viewModel: MainViewModel

    @get:Rule(order = 0)
    var hiltRule = HiltAndroidRule(this)

    @get:Rule(order = 1)
    val instantTaskExecutorRule = InstantTaskExecutorRule()

    private val showError = MutableLiveData&lt;String&gt;()

    @Before
    fun init() {
        hiltRule.inject()
        Intents.init()
        every { viewModel.showError } returns showError
    }

    @After
    fun cleanUp() {
        Intents.release()
        unmockkAll()
    }

    @Test
    fun testThis() {
        val activityScenario: ActivityScenario&lt;MainActivity&gt; = ActivityScenario.launch(MainActivity::class.java)
    }
</code></pre>
<p>However, when I run the test, the view model is not a mock!
What am I missing?</p>
",https://stackoverflow.com/questions/67208650/ui-testing-with-hilt,"['kotlin', 'ui-testing', 'dagger-hilt', 'mockk']",425,False,1,1
UI Testing in Swift Package,"<p>I am building a Swift Package library that provide some UI components, for both macOS and iOS.</p>
<p>I would like to be able to test this codebase and cover my code with unit test for both platforms.</p>
<p>Is there a way to manage that ?</p>
",https://stackoverflow.com/questions/66892946/ui-testing-in-swift-package,"['swift', 'swiftui', 'swift-package-manager']",906,True,5,1
UI testing Blazor Dekstop apps,"<p>I'm really interested in making the next project in MAUI with WebView hosting Blazor app.</p>
<p>I know that I can use <a href=""https://bunit.dev/"" rel=""nofollow noreferrer"">bUnit</a> to unit test components, but is there a solution to run full UI tests like in Cypress?</p>
<p>I mean literally running the app, and have something click around. Or is bUnit enough? Is it able to run MAUI app with all native services (like opening a file from disk with a native popup) or do I need to mock the edge services?</p>
<p>I came with an alternative which would be to setup a server side Blazor poject running the same app and just use Cypress, but I don't really like this idea.</p>
",https://stackoverflow.com/questions/67902464/ui-testing-blazor-dekstop-apps,"['blazor', 'ui-testing', 'blazor-desktop']",177,True,2,1
Android UI Testing launch Fragment,"<p>I've been trying to write a simple UI Test for a Login Dialog in my Android App, but I've come to have trouble even starting the Login Fragment. I've tried several methods starting with ActivityTestRule to declare the Activity the Fragment depends on to launching my fragment isolated, but nothing seems to work.
This is the error I'm getting, from which I'm not able to draw any conclusions about what's going wrong:</p>
<pre><code>E/TestRunner: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=de.smartwireless.smartconnect.debug/androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity (has extras) }
</code></pre>
<p>This is the initial code of my Testclass. It's not really populated because I want to make sure that the fragment launches correctly before I go on with the UI Testing itself:</p>
<pre><code>@RunWith(AndroidJUnit4::class)
class LoginTest {

    private lateinit var scenario: FragmentScenario&lt;LoginFragment&gt;

    @Before
    fun prepareLogin() {
        IdlingRegistry.getInstance().register(SemaphoreIdlingResource.semaphoreIdlingResource)
        scenario = launchFragmentInContainer&lt;LoginFragment&gt;()
        scenario.moveToState(Lifecycle.State.STARTED)
    }

    @Test
    fun loginSuccess() {}

    @After
    fun finish() {
        IdlingRegistry.getInstance().unregister(SemaphoreIdlingResource.semaphoreIdlingResource)
    }
}
</code></pre>
",https://stackoverflow.com/questions/67107825/android-ui-testing-launch-fragment,"['android', 'kotlin', 'android-fragments']",295,False,0,0
Xamarin UI testing - preinstalled apk,"<p>There is an apk installed on the emulator manually. I want to start testing this application. You cannot reinstall it using <code>Xamarin UI Tests</code>. <code>AppInitializer.cs</code> contains :</p>
<pre><code>string keyStore = @&quot;C:\...\Certificate\Mycompany.keystore&quot;;
return ConfigureApp
.Android
.InstalledApp(&quot;com.myapk.test&quot;)
.PreferIdeSettings()
.KeyStore(
       keyStore,
       &quot;passw&quot;, 
       &quot;passw&quot;,
       &quot;\&quot;alias\&quot;&quot;)
.EnableLocalScreenshots()
.StartApp();
</code></pre>
<p>When I run the test through Test Explorer, I catch the Exception:</p>
<pre><code>System.Exception : Failed to execute: C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\bin\jarsigner.exe -sigalg SHA1withRSA -digestalg SHA1 -signedjar &quot;C:\Users\user\AppData\Local\Temp\uitest\a-287A94...D0807\23248\SignedTestServer.apk&quot; -storepass passw -keypass passw -keystore &quot;C:\...\Certificate\Mycompany.keystore&quot; &quot;C:\Users\user\AppData\Local\Temp\uitest\a-287A...D0807\TestServer.apk&quot; &quot;&quot;alias&quot;&quot; - exit code: 1
Only one alias can be specified

Please type jarsigner -help for usage
</code></pre>
",https://stackoverflow.com/questions/68714753/xamarin-ui-testing-preinstalled-apk,"['xamarin', 'testing', 'xamarin.uitest']",78,False,0,1
ViewModel UI testing with JUnit 5,"<p>I am trying to add some unit tests to my app and I am finding some problems adding tests to my ViewModel's classes.</p>
<p>I have created a standard ViewModel class using the <code>androidx. lifecycle</code> library.</p>
<p>Inside these ViewModel classes, I launch a Coroutine to make an API call and retrieve some data.</p>
<p>For this, I have created a ViewModel extension function just to call a Use Case to finally make the API call.</p>
<pre><code>fun ViewModel.execute(useCase: suspend () -&gt; Unit) {
viewModelScope.launch { useCase() }
}
</code></pre>
<p>As you can see, I am using <code>viewModelScope</code> to avoid some boilerplate code, and it is working so fine.</p>
<p>Also, I configured the project to use JUnit5 and Mockito. Everything goes fine until I tried to create some tests for the ViewModel class.</p>
<p>As I am using LiveData, I have created an Extension, to be able to catch the value of the LiveData objects. Like this:</p>
<pre><code>import android.annotation.SuppressLint
import androidx.arch.core.executor.ArchTaskExecutor
import androidx.arch.core.executor.TaskExecutor
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.BeforeEachCallback
import org.junit.jupiter.api.extension.ExtensionContext

/**
 * JUnit5 extension to be able to test LiveData objects
 */
class InstantExecutorExtension : BeforeEachCallback, AfterEachCallback {

    /**
     * sets a delegate before each test that updates LiveData immediately on the calling thread
     */
    @SuppressLint(&quot;RestrictedApi&quot;)
    override fun beforeEach(context: ExtensionContext?) {
        ArchTaskExecutor.getInstance()
            .setDelegate(object : TaskExecutor() {
                override fun executeOnDiskIO(runnable: Runnable) = runnable.run()

                override fun postToMainThread(runnable: Runnable) = runnable.run()

                override fun isMainThread(): Boolean = true
            })
    }

    /**
     * Remove delegate after each test, to avoid influencing other tests
     */
    @SuppressLint(&quot;RestrictedApi&quot;)
    override fun afterEach(context: ExtensionContext?) {
        ArchTaskExecutor.getInstance().setDelegate(null)
    }

}
</code></pre>
<p>Okay, so having this, I have read some posts about how to set up tests to be able to test ViewModel classes that use Coroutines. A lot of them explain to create a Rule, to add a TestCoroutine, to be able to launch coroutines.</p>
<pre><code>import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.setMain
import org.junit.rules.TestWatcher
import org.junit.runner.Description

@ExperimentalCoroutinesApi
class CoroutineTestRule(private val dispatcher: TestCoroutineDispatcher = TestCoroutineDispatcher()) :
    TestWatcher() {

    override fun starting(description: Description?) {
        super.starting(description)
        Dispatchers.setMain(dispatcher)
    }

    override fun finished(description: Description?) {
        super.finished(description)
        Dispatchers.resetMain()
    }

}
</code></pre>
<p>And I just need to add the rule to my ViewModel tests file and I am ready to test ViewModel classes that use coroutines and LiveData, but, when I launch my tests. I am retrieving an exception that says the following:</p>
<pre><code>Exception in thread &quot;Test worker @coroutine#1&quot; java.lang.IllegalStateException: Module with the Main dispatcher had failed to initialize. For tests Dispatchers.setMain from kotlinx-coroutines-test module can be used
    at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.missing(MainDispatchers.kt:113)
    at kotlinx.coroutines.internal.MissingMainCoroutineDispatcher.isDispatchNeeded(MainDispatchers.kt:94)
    at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:319)
    at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
    at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
    at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
    at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
    at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
    at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
    at com.example.core.extensions.ViewModelExtensionKt.execute(ViewModelExtension.kt:8)
    at com.example.baseapplication.presentation.main.firstView.FirstViewModel.getSampleData(FirstViewModel.kt:21)
    at com.example.baseapplication.presentation.main.firstView.FirstViewModel.initialize(FirstViewModel.kt:17)
    at com.example.baseapplication.presentation.FirstViewModelTest$getSampleData should return sample data $1$1$1.invokeSuspend(FirstViewModelTest.kt:42)
    at com.example.baseapplication.presentation.FirstViewModelTest$getSampleData should return sample data $1$1$1.invoke(FirstViewModelTest.kt)
    at com.example.baseapplication.presentation.FirstViewModelTest$getSampleData should return sample data $1$1$1.invoke(FirstViewModelTest.kt)
    at kotlinx.coroutines.test.TestBuildersKt$runBlockingTest$deferred$1.invokeSuspend(TestBuilders.kt:50)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.test.TestCoroutineDispatcher.dispatch(TestCoroutineDispatcher.kt:50)
    at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:322)
    at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
    at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:25)
    at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:110)
    at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.async(Builders.common.kt:91)
    at kotlinx.coroutines.BuildersKt.async(Unknown Source)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.async$default(Builders.common.kt:82)
    at kotlinx.coroutines.BuildersKt.async$default(Unknown Source)
    at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(TestBuilders.kt:49)
    at kotlinx.coroutines.test.TestBuildersKt.runBlockingTest(TestBuilders.kt:80)
    at com.example.baseapplication.presentation.FirstViewModelTest.getSampleData_should_return_sample_data_$lambda-1$lambda-0(FirstViewModelTest.kt:39)
    at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$0(DynamicTestTestDescriptor.java:52)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.api.extension.InvocationInterceptor.interceptDynamicTest(InvocationInterceptor.java:161)
    at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.lambda$execute$1(DynamicTestTestDescriptor.java:58)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptorCall.lambda$ofVoid$0(InvocationInterceptorChain.java:78)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:57)
    at org.junit.jupiter.engine.descriptor.DynamicTestTestDescriptor.execute(DynamicTestTestDescriptor.java:31)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:212)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecutor.execute(NodeTestTask.java:192)
    at java.base/java.util.Optional.ifPresent(Optional.java:183)
    at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.lambda$invokeTestMethod$1(TestFactoryTestDescriptor.java:106)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor.invokeTestMethod(TestFactoryTestDescriptor.java:93)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy2.stop(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:135)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
    at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked. See http://g.co/androidstudio/not-mocked for details.
    at android.os.Looper.getMainLooper(Looper.java)
    at kotlinx.coroutines.android.AndroidDispatcherFactory.createDispatcher(HandlerDispatcher.kt:55)
    at kotlinx.coroutines.android.AndroidDispatcherFactory.createDispatcher(HandlerDispatcher.kt:52)
    at kotlinx.coroutines.internal.MainDispatchersKt.tryCreateDispatcher(MainDispatchers.kt:57)
    at kotlinx.coroutines.test.internal.TestMainDispatcher.getDelegate(MainTestDispatcher.kt:19)
    at kotlinx.coroutines.test.internal.TestMainDispatcher.getImmediate(MainTestDispatcher.kt:32)
    at androidx.lifecycle.ViewModelKt.getViewModelScope(ViewModel.kt:42)
    ... 117 more
</code></pre>
<p>I don't know if I am missing something or what, but I wasn't able to run the ViewModel tests and run them successfully.</p>
<p>I just was able to run tests successfully but it was setting the Dispatcher as Unconfined, but this is not what I want to do and also is not a recommended way.</p>
",https://stackoverflow.com/questions/69423060/viewmodel-ui-testing-with-junit-5,"['android', 'unit-testing', 'kotlin', 'junit5']",2848,True,6,1
Xcode UI Testing can&#39;t find elements,"<p>I'm trying UITesting on Xcode.
App show Alert when tap button, then open Modal when tap &quot;open&quot; button on alert.
UITesting can find that element, but can't find element after show modal.
If remove alert from app, can find element after show modal.
Why can't find element in that app? What I should do? Please help me</p>
<pre><code>struct ContentView: View {
    @State var showSheet = false
    @State var showAlert = false

    var body: some View {
        HStack{
            Button(action: {
                showAlert = true
            }, label: {
                Text(&quot;button&quot;)
            })
            .accessibility(identifier: &quot;button&quot;)
        }
        .sheet(isPresented: $showSheet, content: {
            Modal(showModal: $showSheet)
        })
        .alert(isPresented: $showAlert) { () -&gt; Alert in
            Alert(title: Text(&quot;title&quot;), message: Text(&quot;message&quot;), primaryButton: .default(Text(&quot;open&quot;), action: {
                showSheet = true
            }), secondaryButton: .cancel())
        }
    }
}

struct Modal: View{
    @Binding var showModal: Bool

    init(showModal: Binding&lt;Bool&gt;){
        self._showModal = showModal
    }

    var body: some View {
        return ZStack(alignment: .top) {
            Button {
                showModal.toggle()
            } label: {
                Text(&quot;back&quot;)
            }
            .accessibility(identifier: &quot;button2&quot;)
        }
        .accessibility(identifier: &quot;modal&quot;)
    }
}
</code></pre>
<pre><code>    func testExample() throws {
        let app = XCUIApplication()
        app.launch()

        app.buttons[&quot;button&quot;].tap()
        sleep(1)

        app.buttons[&quot;open&quot;].tap()
        sleep(1)

        let result = app.buttons[&quot;button2&quot;]
        XCTAssert(result.exists)
    }
</code></pre>
",https://stackoverflow.com/questions/68140853/xcode-ui-testing-cant-find-elements,"['ios', 'swift', 'swiftui', 'xctest']",939,True,2,1
Android ui testing fragment with Hilt,"<p>I want to write ui test  for my fragment. Now I am using hilt for dependency injection and navigation components .My ui test code is like this.</p>
<pre><code>@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
class WelcomeFragmentTest {

    @get:Rule
    val hiltRule = HiltAndroidRule(this)

    private val navController = TestNavHostController(ApplicationProvider.getApplicationContext())

    @Before
    fun setUp(){
        hiltRule.inject()
    }

    @Test
    fun `testFragmentinits`(){
        launchWelcomeFragment()

    }

    private fun launchWelcomeFragment() {
        launchFragmentInHiltContainer&lt;WelcomeFragment&gt; {
            navController.setGraph(R.navigation.nav_graph)
            navController.setCurrentDestination(R.id.welcomeFragment)
            this.viewLifecycleOwnerLiveData.observeForever { viewLifecycleOwner -&gt;
                if (viewLifecycleOwner != null) {
                    // The fragment’s view has just been created
                    Navigation.setViewNavController(this.requireView(), navController)
                }
            }
        }
    }


}
</code></pre>
<p>After runnig test i got this error</p>
<p><a href=""https://i.stack.imgur.com/YbAh5.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/YbAh5.png"" alt=""Error after runnig test"" /></a></p>
",https://stackoverflow.com/questions/69476505/android-ui-testing-fragment-with-hilt,"['android', 'android-espresso', 'dagger-hilt']",799,False,1,1
Kotlin espresso UI testing with RecyclerView,"<p>I used espresso before in java and scrolling RecyclerView or performing click on particular child of recyclerView was pretty easy. Something like this:</p>
<pre><code>onView(withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()))
</code></pre>
<p>But in kotlin I can not use RecyclerViewActions. Can someone show me how to perform scrolling and clicking on RecyclerView. Thanks!</p>
",https://stackoverflow.com/questions/66836749/kotlin-espresso-ui-testing-with-recyclerview,"['android', 'kotlin', 'android-espresso']",85,False,1,0
Fixtures (JSON file) for UI Testing,"<p>Has anybody used fixtures (json file) to load the data in postgres database and execute UI testing ?</p>
",https://stackoverflow.com/questions/68555108/fixtures-json-file-for-ui-testing,"['javascript', 'fixtures', 'ui-testing', 'jest-puppeteer']",132,True,0,1
UI Testing Viewpager with NavGraphViewModel using Espresso,"<p>I currently have an app which uses a One Activity-Many Fragment approach, and within this app is a fragment which shares significant data with its children, and so I have used navGraphViewModels scoped to a nested nav graph as so:</p>
<pre><code>private val viewModel by navGraphViewModels&lt;MySharedViewModel&gt;(R.id.nested_nav_graph)
</code></pre>
<p>The parent fragment contains a viewPager, and the fragments passed to that viewPager all share the same viewModel as the parent.
My issue with using this approach is that when it comes to UI testing involving navGraphViewModels using Espresso, I was getting the error &quot;View XXX does not have a NavController set.&quot; I managed to fix this for the <strong>parent</strong> fragment with the below:</p>
<pre><code>        val navController = TestNavHostController(ApplicationProvider.getApplicationContext())
        // This allows fragments to use by navGraphViewModels()
        navController.setViewModelStore(ViewModelStore())
        UiThreadStatement.runOnUiThread {
            navController.setGraph(R.navigation.nested_nav_graph)
        }
        val scenario =
            launchFragmentInContainer(themeResId = R.style.AppTheme) {
                MyFragment().also { fragment -&gt;
                    fragment.viewLifecycleOwnerLiveData.observeForever { viewLifecycleOwner -&gt;
                        if (viewLifecycleOwner != null) {
                            Navigation.setViewNavController(fragment.requireView(), navController)
                        }
                    }
                }
            }
        return navController
    }
</code></pre>
<p>However, as the parent fragment then loads its child fragments into the viewPager and these also require a NavController, my tests don't proceed past the @Before block. Any help regarding how to set the navController to the child fragment would be appreciated.</p>
",https://stackoverflow.com/questions/67521121/ui-testing-viewpager-with-navgraphviewmodel-using-espresso,"['android', 'android-fragments', 'android-viewpager', 'android-espresso', 'android-navigation']",177,False,6,0
iOS UI Testing cannot see the UILabel,"<p>I have a UI testing issue with some code I've got from another developer (Whose not with the project anymore). The code display a simple alert box at the top of the screen when there's an error and I cannot get my UI test to see the <code>UILabel</code> within it.</p>
<p>The structure of the box looks like this:</p>
<pre><code>UIView
   + UILabel
   + UIButton
</code></pre>
<p>And in the custom class for the <code>UIView</code> there is this code:</p>
<pre class=""lang-swift prettyprint-override""><code>// Original code
accessibilityIdentifier = &quot;AlertBar&quot; // Required for UI Testing.

// Bits I've added trying to make messageLabel visible to UI Test
isAccessibilityElement = true
accessibilityElements = [messageLabel]
messageLabel.accessibilityIdentifier = &quot;AlertBarMessage&quot;
messageLabel.isAccessibilityElement = true
}
</code></pre>
<p>If I breakpoint in the middle of my UI Test and dump the app into the log I can see the <code>UIView</code>:</p>
<pre><code>Attributes: Application, pid: 60317, label: 'The App'
Element subtree:
 →Application, 0x600001df8c40, pid: 60317, label: 'The App'
    Window (Main), 0x600001dfa060, {{0.0, 0.0}, {390.0, 844.0}}

    ... app ui logged here!

      Other, 0x600001dce220, {{4.0, 47.0}, {382.0, 107.7}}, identifier: 'AlertBar'
</code></pre>
<p>So it's clear that the alert is visible to XCTest, but nothing inside it. As you can tell from my added code I've been trying all sorts of things but so far I've not been able to make the <code>UILabel</code> (AlertBarMessage) visible.</p>
<p>What am I missing?</p>
",https://stackoverflow.com/questions/68915767/ios-ui-testing-cannot-see-the-uilabel,"['xctest', 'xcode-ui-testing']",645,True,2,1
Automated functional UI testing with GTK+2,"<p>I'm following <a href=""https://opensource.com/article/17/7/functional-testing"" rel=""nofollow noreferrer"">this tutorial</a> on how to write a functional test for GUI built from GTK+2 in C. From the tutorial, it seems that the test cases are actually running as a part of the main GUI program. Is there anyway that we could run the test cases as a separate program using just the provided <a href=""https://developer.gnome.org/gtk2/stable/gtk2-Testing.html#gtk-test-spin-button-click"" rel=""nofollow noreferrer"">testing module</a> provided by GTK?</p>
<p>EDIT: What I am trying to achieve here is to be able to test the functionality of the GUI program without modifying the original program as I am not allowed to. Is this goal really feasible with the testing module provided by GTK? I figured something like dogtail would have been better suited for the job but the system that I am working on is so old that getting dogtail up and running for it would be a difficult tasks.</p>
",https://stackoverflow.com/questions/65924231/automated-functional-ui-testing-with-gtk2,"['c', 'user-interface', 'automated-tests', 'gtk']",143,False,0,0
xcode ui testing Recoding fails to generate code,"<p>I created a new iOS SwiftUI app and added following ContenView</p>
<pre><code>struct ContentView: View {
    var body: some View {
        VStack {
            Text(&quot;Hello, world!&quot;)
                .padding()
            Button(&quot;Press Me&quot;, action: {
                return print(&quot;button pressed&quot;)
            })
        }
    }
}
</code></pre>
<p>I tried to add an UI Test, where I check if the button is pressed.</p>
<p>What ever I do, after I press the recording button in the test no code is generated within the test function.</p>
<p>Every example have no issue at this point.</p>
<p>The record button is not greyed out an working.</p>
<p>Any Ideas what I have missed?</p>
",https://stackoverflow.com/questions/67348223/xcode-ui-testing-recoding-fails-to-generate-code,"['ios', 'xcode', 'ios-simulator', 'xcode-ui-testing', 'xcode12.5']",313,True,2,2
Xamarin UI Testing on Visual Studio Community 2019,"<p>I've been trying for hours trying to get the Xamarin UI Testing project type to show up by installing various visual studio packages, as well as attempting to add the Xamarin.UITesting nuget package to my existing unit testing project. I've consulted dozens of guides on the subject and read bug reports and stack overflow questions.</p>
<p>I can't find it definitively stated anywhere, but I think I've finally decided that I need the enterprise version of Visual Studio. Can anyone just confirm that for me?</p>
",https://stackoverflow.com/questions/66844734/xamarin-ui-testing-on-visual-studio-community-2019,"['visual-studio', 'unit-testing', 'xamarin', 'testing', 'automated-tests']",41,True,0,1
Android UI testing - ActivityScenarioRule is significantly slower then ActivityScenario,"<p>I'm getting into Android UI testing, and I learnt two ways to start up activities: <code>ActivityScenario</code> in each test, and <code>ActivityScenarioRule</code> once, annotated with <code>@Rule</code>.</p>
<p>At first I used <code>ActivityScenario</code>, with success. Each test took <strong>around 2-4</strong> second to complete:</p>
<pre><code>@RunWith(AndroidJUnit4ClassRunner.class)
public class MyActivityTest {

    @Test
    public void test1() {
        ActivityScenario&lt;MyActivity&gt; scenario = ActivityScenario.launch(MyActivity.class);
        //do testing...
    }

    @Test
    public void test2() {
        ActivityScenario&lt;MyActivity&gt; scenario = ActivityScenario.launch(MyActivity.class);
        //do testing...
    }

    //more tests...
}
</code></pre>
<p>Then I decided to switch to an <code>ActivityScenarioRule</code>, since I have a decent amount of tests written, and with a rule, I don't need to create an <code>ActivityScenario</code> to each test:</p>
<pre><code>@RunWith(AndroidJUnit4ClassRunner.class)
public class MyActivityTest {

   @Rule //launch this activity before each test
   public ActivityScenarioRule&lt;MyActivity&gt; rule = new ActivityScenarioRule&lt;&gt;(MyActivity.class);

    @Test
    public void test1() {
        //do testing...
    }

    @Test
    public void test2() {
        //do testing...
    }

    //more tests...
}
</code></pre>
<p>If I run the tests with this rule, each test takes around <strong>40-50 seconds</strong> and most of it is spent on this screen:</p>
<p><a href=""https://i.stack.imgur.com/ZdF7U.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ZdF7U.png"" alt=""enter image description here"" /></a></p>
<p>Tests are run on an emulator. I don't know what this screen is and why it takes up so much time when using <code>ActivityScenarioRule</code>. When using <code>ActivityScenario</code> in each test, this screen does not show up and tests complete fast. Please help, what am I missing?</p>
",https://stackoverflow.com/questions/67935253/android-ui-testing-activityscenariorule-is-significantly-slower-then-activitys,"['android', 'android-espresso', 'android-testing', 'instrumented-test', 'androidx-test']",613,False,2,0
Karate UI Testing - Stop closing browser after each scenario,"<p>I have a case, suppose there are 5 validations in the first scenario and if 2nd validation fails then the remaining 3 validations are skipped.</p>
<p>In order to avoid this, I want to put each validation in a different Scenario so that all validations are verified. But I have observed that after each scenario the browser is getting closed.</p>
<p>Is there any way by which I can keep the browser instance open after the Scenario executes?</p>
<blockquote>
<p>My verifications are 1st verification checks all buttons and 2nd
checks all links on the page. In case if any of the buttons are not
matching then the link verification is skipped.</p>
</blockquote>
<pre><code>* match actualButton contains only expectedButton
* match actualLink contains only expectedLink 
</code></pre>
",https://stackoverflow.com/questions/67971844/karate-ui-testing-stop-closing-browser-after-each-scenario,"['automated-tests', 'ui-automation', 'karate']",23,False,1,0
Handling the answer from API in UI Testing Swift,"<p>I have weather app. It fetches the data from API. I enter needed city, then next screen opens and shows me the name of the city and temperature. I am writing UI test, which should open the app, handle an alert which asks to use location, then test should write the city name and check if this city exists in the screen. All works except checking the city name at the end. I thought maybe the problem is because it needs some time to get the answer from API, and tests doesn’t wait for it. Maybe I need to set timer to wait for answer. Or the problem is in smth else?
Here is my code and it fails at the last line.</p>
<pre><code>    func testExample() throws {
        
        let app = XCUIApplication()
        app.launchArguments = [&quot;enable-testing&quot;]
        app.launch()
        
        app/*@START_MENU_TOKEN@*/.staticTexts[&quot;My location&quot;]/*[[&quot;.buttons[\&quot;My location\&quot;].staticTexts[\&quot;My location\&quot;]&quot;,&quot;.staticTexts[\&quot;My location\&quot;]&quot;],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/.tap()
        addUIInterruptionMonitor(withDescription: &quot;Allow “APP” to access your location?&quot;) { (alert) -&gt; Bool in
            let button = alert.buttons[&quot;Only While Using the App&quot;]
            if button.exists {
                button.tap()
                return true // The alert was handled
            }

            return false // The alert was not handled
        }
        
        app.textFields[&quot;Enter your city&quot;].tap()
        app.textFields[&quot;Enter your city&quot;].typeText(&quot;Barcelona&quot;)
        
        app.buttons[&quot;Check weather&quot;].tap()
        
        XCTAssertTrue(app.staticTexts[&quot;Barcelona&quot;].exists)
       
    }
</code></pre>
",https://stackoverflow.com/questions/69484753/handling-the-answer-from-api-in-ui-testing-swift,"['ios', 'swift', 'xcode-ui-testing']",393,False,0,2
UI Testing of iOS 3rd Party applications - No Source Code,"<p>I'm working in the Aviation industry and part of my job is managing electronic flight bags (EFB). We rely on 3rd party applications such as <code>Ozrunways/Jepp FDPro</code> and therefore we don't have the source code or .ipa files to create UI tests through XCode.</p>
<p>There have been issues where updates to apps will get released with small bugs and we only find out via user reporting. I really don't wanna go down the road of creating a manual testing regime whereby each app is tested by humans pressing buttons on the device to ensure the UI/functionalities are the same.</p>
<p>Is there any way to automate this through the simulator or the device?</p>
<p>Note: I went down the appium path originally but realized without the .ipa file it's almost impossible.</p>
",https://stackoverflow.com/questions/67845005/ui-testing-of-ios-3rd-party-applications-no-source-code,"['ios', 'swift', 'xcode', 'appium-ios', 'xcuitest']",465,True,0,1
XCTest - UI Testing with XCUIElement using pinch gesture on custom coordinates?,"<p>Let's say I've an app with an UI which looks kind of like the image below:</p>
<p><a href=""https://i.stack.imgur.com/Rby5y.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/Rby5y.png"" alt=""UI to test"" /></a></p>
<p>Let's also say the blue view behaves like a map and the other colors are other interactable views.</p>
<p>I need to do a XCTest where I need to &quot;zoom out&quot; on that blue view which I tired with <a href=""https://developer.apple.com/documentation/xctest/xcuielement/1618669-pinchwithscale?language=objc"" rel=""nofollow noreferrer"">pinchWithScale</a>:</p>
<pre><code>[blueView pinchWithScale:0.5 velocity:-1];
</code></pre>
<p>Unfortunately that doesn't work because one of the red views or the violet view (which overlaps the blue view a tiny bit for shadow and corner reasons) gets triggered instead of a <code>pinch</code> gesture on the blue view.</p>
<p>I saw that I can get <a href=""https://developer.apple.com/documentation/xctest/xcuielement/1500960-coordinatewithnormalizedoffset?language=objc"" rel=""nofollow noreferrer"">coordinateWithNormalizedOffset</a> (similar like <a href=""https://stackoverflow.com/questions/31301798/replicate-pull-to-refresh-in-xctest-ui-testing"">here</a>) of a view by using the method:</p>
<pre><code>- (XCUICoordinate *)coordinateWithNormalizedOffset:(CGVector)normalizedOffset;
</code></pre>
<p>which would allow me to use not the whole blue view to perform a &quot;zoom out&quot; gesture by:</p>
<pre><code>XCUICoordinate* blueViewInset = [blueView coordinateWithNormalizedOffset:
                                 CGVectorMake(0.2f, 0.2f)];
</code></pre>
<p>but the <a href=""https://developer.apple.com/documentation/xctest/xcuicoordinate?language=objc"" rel=""nofollow noreferrer"">XCUICoordinate</a> object <code>blueViewInset</code> doesn't support pinch gestures.</p>
<p>Hence how can I perform a pinch gesture to &quot;zoom out&quot; on a XCUIElement with coordinates not at the border of the view?</p>
<p>I'm also wondering if there is a way to create an <strong>extension to XCUIElement</strong> with a <strong>custom pinch</strong> gesture? I would appreciate any hints on that too.</p>
",https://stackoverflow.com/questions/65635857/xctest-ui-testing-with-xcuielement-using-pinch-gesture-on-custom-coordinates,"['ios', 'objective-c', 'xctest']",353,True,2,1
"UI Testing, how to access passwords locally and in a devops pipeline?","<p>I want to have my UI Tests access different user accounts in our staging environment.</p>
<p>However, I don’t want to include the username and password in a config file in our git repository.</p>
<p>In our devops pipeline I’ve previously replaced tags with environmental variables in a config file as a pipelines task.</p>
<p>But I can’t do this locally as I don’t have a pipeline to run tasks. Even if I did I’d still need to get access to passwords.</p>
<p>I’m using a Mac for dev locally and our pipeline. Also C# / Xamarin.</p>
",https://stackoverflow.com/questions/66668032/ui-testing-how-to-access-passwords-locally-and-in-a-devops-pipeline,"['azure-devops', 'azure-pipelines', 'ui-testing']",624,True,1,3
How to check if new scene is created in Xcode UI Testing?,"<p>The app is a simple editor app and it supports multiple windows on iPad and Mac Catalyst.
A new window can be opened by New toolbar item or New menu on the Mac menubar.</p>
<p>I'm writing UI testing and not for sure how to check new scene is created.</p>
<pre><code>func testNewEditor() throws {
        
    let app = XCUIApplication()
    app.launch()
        
    #if targetEnvironment(macCatalyst)
    let menuBarsQuery = XCUIApplication().menuBars
    menuBarsQuery.menuBarItems[&quot;File&quot;].click()
    menuBarsQuery.menuItems[&quot;new_editor&quot;].click()
        
    // check new scene is created?
        
    #endif
}
</code></pre>
<p>Thanks in advance.</p>
",https://stackoverflow.com/questions/68902631/how-to-check-if-new-scene-is-created-in-xcode-ui-testing,"['swift', 'xcode', 'xcode-ui-testing', 'ui-testing']",52,False,0,1
selenium UI testing is not able to fill the pop up window to enter credentials,"<p>selenium UI testing is not able to fill the pop up window to enter credentials. There were suggestions to use autoit tool to fill the pop window. But looking if it can be achieved by Selenium itself. Please suggest</p>
",https://stackoverflow.com/questions/66219761/selenium-ui-testing-is-not-able-to-fill-the-pop-up-window-to-enter-credentials,['selenium'],22,False,-1,1
How to mock extension function or top level function in UI testing Before Android P?,"<p><strong>Is there any way to mock top level function or extension function in UI testing before Android P.</strong></p>
<p>In android UI test I have used mockk library but there is no support extension function mocking in UI test before Android P. Below is supported feature given by mockk(<a href=""https://mockk.io/ANDROID.html"" rel=""nofollow noreferrer"">https://mockk.io/ANDROID.html</a>).</p>
<p><a href=""https://i.stack.imgur.com/a364r.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/a364r.png"" alt=""enter image description here"" /></a></p>
<p>Here is top level function file and it's UI test that works very well above Android P version but not worked before P because mockk is not supported.</p>
<pre><code>@file:JvmName(&quot;Test&quot;)
package com.example.dexopener.mockk

fun isLogin(): Boolean {
    return false;
}
</code></pre>
<p>For above top level function Here in UI test mocking isLogin method that works very well after Android P</p>
<pre><code>@Test
fun test_top_level_function_is_able_to_mock(){
        mockkStatic(&quot;com.example.dexopener.mockk.Test&quot;)
        every { isLogin() } returns true
        assertTrue(isLogin())
}
</code></pre>
",https://stackoverflow.com/questions/68208710/how-to-mock-extension-function-or-top-level-function-in-ui-testing-before-androi,"['android', 'mockito', 'powermock', 'ui-testing', 'mockk']",194,False,0,0
What is the best way to await functions in UI testing in Android Studio without Thread.Sleep()?,"<p>I'm using Espresso to write some automated tests for an Android app that I've developed. All the tests are automated and are passing/failing according to what happens with the UI. I've ran the code through SonarQube to detect bad coding practices and it's informed me that Thread.Sleep() should not be used.</p>
<p>I'm mainly using Thread.sleep() in instances where I'm typing out a form and need to hide the keyboard to scroll down to tap the next form field etc. From my understanding, using something like awaitility is for big async functions like fetching data etc. but what should I use in my case where something is not being fetched but more so for just interacting with the UI?</p>
<p>Here is an example of a log in test that I have created that uses Thread.Sleep():</p>
<pre><code>        onView(withId(R.id.fieldEmail)).perform(typeText(&quot;shelley@gmail.com&quot;));
        Thread.sleep(SHORT_WAIT);
        onView(withId(R.id.fieldPassword)).perform(click());
        onView(withId(R.id.fieldPassword)).perform(typeText(&quot;password&quot;));
        Thread.sleep(SHORT_WAIT);
        onView(isRoot()).perform(pressBack());
        Thread.sleep(SHORT_WAIT);
        onView(withId(R.id.signIn)).perform(click());
        Thread.sleep(LONG_WAIT);
</code></pre>
",https://stackoverflow.com/questions/67166109/what-is-the-best-way-to-await-functions-in-ui-testing-in-android-studio-without,"['java', 'android-studio', 'user-interface', 'testing', 'android-espresso']",1083,True,1,1
"DevOps build pipeline for Xamarin.iOS, Do I need to create a release build for UI Testing?","<p>I'm trying to setup some Xamarin UI testing, initially for our iOS project. I've run into a lot of issues trying to setup a DevOps pipeline and I've learned a lot in the process.</p>
<p>However, I found <a href=""https://channel9.msdn.com/Shows/On-NET/User-Interface-Testing--DevOps-for-Mobile"" rel=""nofollow noreferrer"">this video</a> on the subject by James Montemagno, where at times 24.31 and 23.47 he mentions that you need to create a debug ipa which runs the <code>Xamarin.TestCloud.Agent</code>.</p>
<p>This is an additional build task after a release build, purely to run the build agent.</p>
<p>At the moment I'm only concered with running UI Tests not creating a release artefact.</p>
<p>I'm wondering if I actually need to run the release build task / drop at all ?</p>
<p>It's just so time consuming making small adjustments and waiting for the process to complete each time.</p>
",https://stackoverflow.com/questions/66581777/devops-build-pipeline-for-xamarin-ios-do-i-need-to-create-a-release-build-for-u,"['ios', 'xamarin', 'xamarin.forms', 'azure-devops', 'azure-pipelines']",62,True,0,1
"Espresso UI Testing, Cannot check loading state, How to test UI with live data and view model?","<p>Currently i am implementation UI test/ Instrumentation Test with Espresso, to test FragmentMovie at loading state, and success state. Due to multiple test library and other stuff,my test Instrumentation must contains hilt ijection.</p>
<p>UI testing scenario :</p>
<ol>
<li>When loading state, Check my loading progressbar and text loading is displayed</li>
<li>When succes state, hide loading, and show recycle view</li>
<li>Done</li>
</ol>
<h1>Problem</h1>
<p><code>Loading state</code> is skiped when running test. <code>@Test</code> will run after ViewModel <code>postValue</code> Success state. So, I can't test while loading state.</p>
<p>when i not write <code>onView(withId(R.id.progressBar)).check(matches(isDisplayed()))</code> the test is passed, but  i want to test while loading state.</p>
<p>Possible fix, add <code>delay(10000)</code> to my view model, that will extend duration of loading state, but, my test still waiting success state.</p>
<p>Currently i am not use IdlingResource, because that not fix my problem,</p>
<p>Actual scenario:</p>
<ol>
<li>Fragment Run,</li>
<li>ViewModel fetchdata,</li>
<li>ViewModel loading,</li>
<li>ViewModel success,</li>
<li>FragmentTest run,</li>
<li>viewAssert failed,</li>
</ol>
<p>Expected :</p>
<ol>
<li>Fragment Run,</li>
<li>ViewModel fetchdata,</li>
<li>ViewModel loading,</li>
<li>FragmentTest check progressbar,</li>
<li>ViewModel success,</li>
<li>FragmentTest check recycleView,</li>
<li>done</li>
</ol>
<p>Why? and How?</p>
<h1>Code</h1>
<p>Observer from fragmentMovie</p>
<pre class=""lang-kotlin prettyprint-override""><code>
 private val viewModel: MovieViewModel by viewModels()

   [...]

 viewModel.movie.observe(viewLifecycleOwner, {
            Log.d(TAG, &quot;viewModelgetMovie: ${it.status}&quot;)
            when (it.status) {
                Status.LOADING -&gt; {
                    Toast.makeText(requireContext(), &quot;loading..&quot;, Toast.LENGTH_SHORT).show()
                }
                Status.SUCCESS -&gt; {
                    binding.progressBar.visibility = View.GONE
                    binding.txLoading.visibility = View.GONE
                    if (it.data != null) {
                        list.addAll(it.data)
                        movieAdapter.notifyDataSetChanged()
                    }
                }
                Status.ERROR -&gt; {
                    binding.progressBar.visibility = View.VISIBLE
                    binding.txLoading.text = it.message
                    Toast.makeText(requireContext(), &quot;${it.message}&quot;, Toast.LENGTH_SHORT).show()
                }
            }
        })
</code></pre>
<p>viewmodel</p>
<pre class=""lang-kotlin prettyprint-override""><code>@HiltViewModel
class MovieViewModel @Inject constructor(
    private val repository: MovieRepository,
    private val dispatcher: CoroutineDispatcher
) : ViewModel() {

    // new code
    private val moviePost = MutableLiveData&lt;ResourceHelper&lt;ArrayList&lt;MovieData&gt;&gt;&gt;()

    val movie: LiveData&lt;ResourceHelper&lt;ArrayList&lt;MovieData&gt;&gt;&gt;
        get() = moviePost

    init {
        fetchMovie()
    }

    private fun fetchMovie() {
        viewModelScope.launch(dispatcher) {
            moviePost.postValue(ResourceHelper.loading(null))
            repository.getMovie(1).let { movie -&gt;
                moviePost.postValue(movie)
            }
        }
    }


}
</code></pre>
<p>MovieFragmentTest</p>
<pre class=""lang-kotlin prettyprint-override""><code>package com.unlink.moviecatalogue6.ui.movie

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.unlink.moviecatalogue6.MainActivity
import com.unlink.moviecatalogue6.R
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
@LargeTest
class MovieFragmentTest {
    @get:Rule(order = 0)
    var hiltRule = HiltAndroidRule(this)

    @get:Rule(order = 1)
    var activityRule = ActivityScenarioRule(MainActivity::class.java)

    @Before
    fun setUp() {
        hiltRule.inject()
    }

    @After
    fun tearDown() {

    }

    @Test
    fun happyPath() {
        onView(withId(R.id.progressBar)).check(matches(isDisplayed())) // error
        // how can i test on loading?
        onView(withId(R.id.recycleMovie)).check(matches(isDisplayed()))
    }
}
</code></pre>
<h1>Error</h1>
<pre><code>androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'is displayed on the screen to the user' doesn't match the selected view.
Expected: is displayed on the screen to the user
Got: &quot;ProgressBar{id=2131231016, res-name=progressBar, visibility=GONE, width=1080, height=44, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@a455ee2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}&quot;

</code></pre>
<p>The error shown because my progress bar has gone. Because my test check the progress bar after success state.</p>
<h1>Screenshoot</h1>
<blockquote>
<p>Loading state, but my test not run @Test</p>
</blockquote>
<p><a href=""https://i.stack.imgur.com/PjV0L.png"" rel=""nofollow noreferrer"">loading state</a></p>
<blockquote>
<p>Success state, then @Test start</p>
</blockquote>
<p><a href=""https://i.stack.imgur.com/uBBMD.png"" rel=""nofollow noreferrer"">success state</a></p>
<blockquote>
<p>that cause error view is gone</p>
</blockquote>
<p><a href=""https://i.stack.imgur.com/BsKeo.png"" rel=""nofollow noreferrer"">error</a></p>
<blockquote>
<p>Any response will very appreciated</p>
</blockquote>
",https://stackoverflow.com/questions/67619058/espresso-ui-testing-cannot-check-loading-state-how-to-test-ui-with-live-data-a,"['android', 'junit', 'android-espresso', 'ui-testing', 'dagger-hilt']",796,False,2,1
"Using Xcode UI testing, is it possible to get the value of a secureTextFields element without receiving dots (&quot;•••••&quot;)?","<p>I'm working on a project where the UI test has a password field. The password is initially hidden, and the test checks to see if the value of the secureTextField is &quot;••••••••&quot;.</p>
<pre><code>// This works    
let passwordValue = getValueOf(passwordTextField)
XCTAssertEqual(passwordSecureTextFieldValue, &quot;••••••••&quot;)
</code></pre>
<p>Next, the password is revealed by tapping an eye icon that shows the password to the user as normal text, not dots. From there, I'd like to assert that the value of of the secureTextField is &quot;password&quot;. Is there a property or strategy to do that?</p>
",https://stackoverflow.com/questions/68537098/using-xcode-ui-testing-is-it-possible-to-get-the-value-of-a-securetextfields-el,"['ios', 'swift', 'xcode', 'xcode-ui-testing']",160,False,1,0
Xcode UI test fails to edit multiple UITextFields,"<p>I have a UI with multiple <code>UITextField</code>s that I want to test by clearing their contents and typing new values. However, only the <strong>first</strong> field can be changed in a UI test; subsequent fields can be <em>cleared</em> (if their clear button is enabled), but they can't be typed into (using <code>XCUIElement.typeText()</code>), because the test <code>Failed to synthesize event: Neither element nor any descendant has keyboard focus.</code> How can I edit multiple text fields in a given UI test function?</p>
<p>I've followed the advice in a couple of different UI testing questions:</p>
<ul>
<li><a href=""https://stackoverflow.com/questions/36790781/xcode-ui-testing-how-to-type-text-into-custom-class-text-fields"">Xcode UI Testing How to type text into custom class text fields</a></li>
<li><a href=""https://stackoverflow.com/questions/32821880/ui-test-deleting-text-in-text-field"">UI Test deleting text in text field</a></li>
<li><a href=""https://stackoverflow.com/questions/44747562/ui-testing-multiple-uitextfields"">UI Testing Multiple UITextFields</a> - accessibility was disabled in one of the fields</li>
</ul>
<p>The UI:</p>
<p><a href=""https://i.stack.imgur.com/xnCaS.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/xnCaS.png"" alt=""App UI"" /></a></p>
<p>The <code>ViewController</code>:</p>
<pre><code>class ViewController: UIViewController {

    @IBOutlet weak var field1: UITextField!
    @IBOutlet weak var field2: UITextField!

    @IBAction func submit(_ sender: Any) {
        let actionVC = UIAlertController(title: &quot;You did it!&quot;,
                                         message: &quot;\(field1.text ?? &quot;&quot;), \(field2.text ?? &quot;&quot;)&quot;,
                                         preferredStyle: .alert)
        actionVC.addAction(UIAlertAction(title: &quot;Awesome!&quot;, style: .default, handler: nil))
        present(actionVC, animated: true, completion: nil)
    }

}
</code></pre>
<p>The test:</p>
<pre><code>class TextFieldTesterUITests: XCTestCase {

    func testReplaceTextInMultipleTextFields() throws {
        let app = XCUIApplication()
        app.launch()

        let field1TextField = app.textFields[&quot;Field 1&quot;]
        field1TextField.tap()
        app.buttons[&quot;Clear text&quot;].tap()
        field1TextField.typeText(&quot;Oh&quot;)

        let field2TextField = app.textFields[&quot;Field 2&quot;]
        field2TextField.tap()
        app.buttons[&quot;Clear text&quot;].tap() // &lt;-- 
        field2TextField.typeText(&quot;Susanna&quot;)

        app.staticTexts[&quot;Button&quot;].tap()

        app.alerts[&quot;You did it!&quot;].scrollViews.otherElements.buttons[&quot;Awesome!&quot;].tap()
    }

}
</code></pre>
<p>The error:</p>
<p><a href=""https://i.stack.imgur.com/WtdLg.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/WtdLg.png"" alt=""Error message"" /></a>
<a href=""https://github.com/PoikileCreations/TextFieldUITester"" rel=""nofollow noreferrer"">I've posted this demonstration on GitHub.</a></p>
",https://stackoverflow.com/questions/68729537/xcode-ui-test-fails-to-edit-multiple-uitextfields,"['ios', 'swift', 'xcode', 'uikit', 'xcode-ui-testing']",246,True,1,1
Fixtures (JSON file) for UI Testing,"<p>Has anybody used fixtures (json file) to load the data in postgres database and execute UI testing ?</p>
",https://stackoverflow.com/questions/68555108/fixtures-json-file-for-ui-testing,"['javascript', 'fixtures', 'ui-testing', 'jest-puppeteer']",132,True,0,1
How to add accessibilityIdentifier for UISearchBar?,"<p>I tried</p>
<pre><code>self.searchBar.accessibilityTraits = .searchField
self.searchBar.accessibilityIdentifier = &quot;mySearchBar&quot;
</code></pre>
<p>in <code>UISearchController</code> but it does not work, I need the accessibilityIdentifier to be visible in Appium for UI testing</p>
",https://stackoverflow.com/questions/66637975/how-to-add-accessibilityidentifier-for-uisearchbar,"['ios', 'swift', 'uikit', 'accessibility']",234,True,0,1
how I can use cypress.screenshot() to capture my application&#39;s favicon,"<p>For UI Testing purpose I would like to take a screenshot of my application's favicon , I am using <code>cy.screenshot('Application', { capture: 'fullPage' })</code> but it is not capturing the favicon</p>
",https://stackoverflow.com/questions/70008562/how-i-can-use-cypress-screenshot-to-capture-my-applications-favicon,['cypress'],289,False,1,2
xUnit: How run additional code in case of failure,"<p>I'm using xUnit for UI testing w/ Selenium. I like to take a screenshot in case of failure. Is it possible to do such final work before termination?</p>
",https://stackoverflow.com/questions/69834710/xunit-how-run-additional-code-in-case-of-failure,"['c#', 'xunit']",267,True,1,1
How to get the h1 tag from a website in WebDriverIO,"<p>I am using WebDriverIO to do UI testing. I am trying to get this h1 tag:
<a href=""https://i.stack.imgur.com/sObLL.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/sObLL.png"" alt=""enter image description here"" /></a></p>
<p>This is my attempt:</p>
<pre><code> it('should get the header of the intro text', () =&gt;{
        const h1 = $('#yui_3_17_2_1_1617935280900_2042');
        expect(h1).toHaveValue(&quot;Confidence AI Application: machine learning models provide a systemized approach to assess cash flow risk and opportunity.&quot;);
    });
</code></pre>
<p>The test fails:</p>
<pre><code>[chrome 89.0.4389.114 linux #0-1] ✖ should get the header of the intro text
[chrome 89.0.4389.114 linux #0-1]
[chrome 89.0.4389.114 linux #0-1] 1 passing (14.2s)
[chrome 89.0.4389.114 linux #0-1] 1 failing
[chrome 89.0.4389.114 linux #0-1]
[chrome 89.0.4389.114 linux #0-1] 1) should get the header of the intro text
[chrome 89.0.4389.114 linux #0-1] Expect $(`yui_3_17_2_1_1617935280900_2042`) to have property value

Expected: &quot;Confidence AI Application: machine learning models provide a systemized approach to assess cash flow risk and opportunity.&quot;
Received: undefined
[chrome 89.0.4389.114 linux #0-1] Error: Expect $(`yui_3_17_2_1_1617935280900_2042`) to have property value
</code></pre>
<p>How can I fix it?</p>
",https://stackoverflow.com/questions/67014549/how-to-get-the-h1-tag-from-a-website-in-webdriverio,"['javascript', 'unit-testing', 'e2e-testing', 'webdriver-io', 'ui-testing']",274,True,0,2
TouchGFX gui automated testing,"<p>Checking for feasibility of automated UI testing for TouchGFX. Is there a library that helps in identifying the application window handle and use it to choose UI elements and drive the operations in each window?</p>
",https://stackoverflow.com/questions/70022947/touchgfx-gui-automated-testing,"['c++', 'stm32', 'stm32cubeide', 'touchgfx']",260,True,1,1
UI Test for custom android datepicker Library,"<p>I'm using this library in my android project :</p>
<pre><code>implementation 'com.github.florent37:singledateandtimepicker:2.2.7'
</code></pre>
<p>but when I'm doing UI testing with Espresso but when use it like that :</p>
<pre><code>  onView(withClassName(Matchers.equalTo(SingleDateAndTimePicker::class.java.name))).perform(
            PickerActions.setDate(2021, 6, 30)
        )
</code></pre>
<p>or like that</p>
<pre><code>onView(withId(R.id.picker)).perform(PickerActions.setDate(2021, 7, 15))
</code></pre>
<p>it gives me this error</p>
<pre><code>androidx.test.espresso.PerformException: Error performing 'set date' on view 'with class name: &quot;com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker&quot;'.
</code></pre>
<p>or this error</p>
<pre><code>androidx.test.espresso.PerformException: Error performing 'set time' on view 'with id: com.test.testlist:id/picker'.
</code></pre>
<p>with this error details :</p>
<pre><code> Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:(is assignable from class: class android.widget.DatePicker and is displayed on the screen to the user)Target view: &quot;SingleDateAndTimePicker{id=2131230850, res-name=date_time_picker, visibility=VISIBLE, width=1038, height=604, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@666160a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=21.0, y=365.0, child-count=1}&quot;
</code></pre>
<p>any solution for that?</p>
",https://stackoverflow.com/questions/67279584/ui-test-for-custom-android-datepicker-library,"['android', 'android-espresso', 'ui-testing', 'android-datepicker']",244,False,3,1
selenium UI testing is not able to fill the pop up window to enter credentials,"<p>selenium UI testing is not able to fill the pop up window to enter credentials. There were suggestions to use autoit tool to fill the pop window. But looking if it can be achieved by Selenium itself. Please suggest</p>
",https://stackoverflow.com/questions/66219761/selenium-ui-testing-is-not-able-to-fill-the-pop-up-window-to-enter-credentials,['selenium'],22,False,-1,1
Azure GUIX automated testing,"<p>Can one implement automated UI testing for any UI designed using Azure GUIX? I came across an earlier post asking the same question.</p>
<p><a href=""https://stackoverflow.com/questions/67102338/azure-guix-automated-testing-specifically-for-languages"">Azure GUIX automated testing specifically for languages</a></p>
<p>I searched for Azure Test Harness but could not find much on it. Any suggestions?</p>
",https://stackoverflow.com/questions/70021090/azure-guix-automated-testing,"['automated-tests', 'azure-rtos', 'guix']",90,True,-1,1
General practice to organize a new End-to-end test in Cypress,"<p>Just starting a new UI testing project, and wonder if there is any best practice to <code>organize</code> the Cypress end-to-end test structure?   For example - 1) embedded inside the source (under integration/...) or 2) separate file folder for this project?</p>
<p>Looking for some general guidelines and best practice.  Thanks.</p>
",https://stackoverflow.com/questions/66540467/general-practice-to-organize-a-new-end-to-end-test-in-cypress,['cypress'],713,True,1,2
How to check if new scene is created in Xcode UI Testing?,"<p>The app is a simple editor app and it supports multiple windows on iPad and Mac Catalyst.
A new window can be opened by New toolbar item or New menu on the Mac menubar.</p>
<p>I'm writing UI testing and not for sure how to check new scene is created.</p>
<pre><code>func testNewEditor() throws {
        
    let app = XCUIApplication()
    app.launch()
        
    #if targetEnvironment(macCatalyst)
    let menuBarsQuery = XCUIApplication().menuBars
    menuBarsQuery.menuBarItems[&quot;File&quot;].click()
    menuBarsQuery.menuItems[&quot;new_editor&quot;].click()
        
    // check new scene is created?
        
    #endif
}
</code></pre>
<p>Thanks in advance.</p>
",https://stackoverflow.com/questions/68902631/how-to-check-if-new-scene-is-created-in-xcode-ui-testing,"['swift', 'xcode', 'xcode-ui-testing', 'ui-testing']",52,False,0,1
Can&#39;t import or use &quot;builder&quot; for RecyclerView view matching with Kakao Cup,"<p>Trying to do UI testing with Kakao cup and I'm frustrated on trying to get a matcher working with <code>RecyclerView</code></p>
<p><a href=""https://github.com/KakaoCup/Kakao#create-the-klistviewkrecyclerview"" rel=""nofollow noreferrer"">https://github.com/KakaoCup/Kakao#create-the-klistviewkrecyclerview</a></p>
<p>This is their example:</p>
<pre><code>val recycler = KRecyclerView { builder = { withId(R.id.recycler_view) } }
</code></pre>
<p>I'm trying to do the same thing:</p>
<pre><code>val homeRecyclerView: KRecyclerView = KRecyclerView {
    builder = {
        withId(R.id.home_page_recycler_view)
    }
}
</code></pre>
<p>But <code>builder</code> is highlighted in red and it doesn't want me to import anything. I don't know what I'm doing wrong.</p>
",https://stackoverflow.com/questions/70239863/cant-import-or-use-builder-for-recyclerview-view-matching-with-kakao-cup,"['android', 'android-espresso']",151,False,0,0
Espresso. Caused by: junit.framework.AssertionFailedError: &#39;with error: is &quot;...&quot; doesn&#39;t match the selected view,"<p>*Hello! I use Espresso for testing UI. I want to check that after user text a word and click on the button the textView get the correct output.</p>
<p>After ui -testing of  my programm:*</p>
<pre><code>@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
    private static final String STRING_INPUT_WORD = &quot;Foxminded cool 24/7&quot;;
    private static final String STRING_INPUT_WORD_CONVERTED = &quot;dednimxoF looc 24/7&quot;;
    private static final String STRING_IGNORED_SYMBOLS = &quot;0123456789&lt;([{\\^-=$!|]})?*+.&gt;&quot;;

    @Rule
    public ActivityScenarioRule&lt;MainActivity&gt; activityScenarioRule
            = new ActivityScenarioRule&lt;&gt;(MainActivity.class);

    @Test
    public void onCreate() {
        // Type text ignored and then press the button ADD
        onView(withId(R.id.editTextTextIgnoredСharacters))
                .perform(typeText(STRING_IGNORED_SYMBOLS))
                .perform(closeSoftKeyboard());
        onView(withId(R.id.buttonAddIgnoredСharacters));

        // Type text and then press the button CONVERT
        onView(withId(R.id.editTextInput))
                .perform(typeText(STRING_INPUT_WORD))
                .perform(closeSoftKeyboard());
        onView(withId(R.id.buttonConvert))
                .perform(click());

        // Check that the text was changed
        onView(withId(R.id.textViewAnagramOfWord))
                .check(matches(withText(STRING_INPUT_WORD_CONVERTED)));

    }

    @Test
    public void onSaveInstanceState() {
    }
}
</code></pre>
<p><em>I recieve this message:</em></p>
<pre><code>androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'with error: is &quot;dednimxoF looc 24/7&quot;' doesn't match the selected view.
Expected: with error: is &quot;dednimxoF looc 24/7&quot;
Got: &quot;MaterialTextView{id=2131231105, res-name=textViewAnagramOfWord, visibility=VISIBLE, width=601, height=85, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@7ddd14, tag=null, root-is-layout-requested=false, has-input-connection=false, x=240.0, y=477.0, text=dednimxoF looc 7/42, input-type=0, ime-target=false, has-links=false}&quot;
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:1566)
at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:16)
at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:36)
at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:103)
at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:31)
at com.example.anagram.MainActivityTest.onCreate(MainActivityTest.java:46)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:154)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1932)
Caused by: junit.framework.AssertionFailedError: 'with error: is &quot;dednimxoF looc 24/7&quot;' doesn't match the selected view.
Expected: with error: is &quot;dednimxoF looc 24/7&quot;
Got: &quot;MaterialTextView{id=2131231105, res-name=textViewAnagramOfWord, visibility=VISIBLE, width=601, height=85, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@7ddd14, tag=null, root-is-layout-requested=false, has-input-connection=false, x=240.0, y=477.0, text=dednimxoF looc 7/42, input-type=0, ime-target=false, has-links=false}&quot;
at androidx.test.espresso.matcher.ViewMatchers.assertThat(ViewMatchers.java:17)
at androidx.test.espresso.assertion.ViewAssertions$MatchesViewAssertion.check(ViewAssertions.java:15)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAssertion.check(ViewInteraction.java:10)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:11)
at androidx.test.espresso.ViewInteraction$2.call(ViewInteraction.java:2)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Tests ran to completion.
</code></pre>
<p><em>Also when it's running in the emulator I see that it work correct. I can't resolve this problem. Does anyone know what my mistake is?</em></p>
",https://stackoverflow.com/questions/68210951/espresso-caused-by-junit-framework-assertionfailederror-with-error-is,"['java', 'android', 'unit-testing', 'android-espresso']",511,True,0,1
Tkinter: how to set the widget property name to be tested in Windows Application Driver,"<p>I am trying to use the <a href=""https://github.com/microsoft/WinAppDriver/"" rel=""nofollow noreferrer"">Window Application Driver</a> to test the Tkinter UI widgets, together with <a href=""https://accessibilityinsights.io/"" rel=""nofollow noreferrer"">Accessibility Insights for Windows</a> inspector. To test the app, I need to set the property name, which doesn't exist in my inspector. What I've tried is to give <a href=""https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/naming-widgets.html"" rel=""nofollow noreferrer"">instance names</a> to the widgets, but no luck. Is there any way I can assign the property names for UI testing? Thanks.</p>
",https://stackoverflow.com/questions/68766432/tkinter-how-to-set-the-widget-property-name-to-be-tested-in-windows-application,['tkinter'],51,False,1,0
Karate : UI - Jenkins Integration,"<p>I have a doubt regarding Jenkins integration with Karate. We are using karate for ui testing. And we need to integrate it with Jenkins and should be running inside a docker container. The issue we are facing is - chrome is not getting invoked.Chrome is not starting only when we try to invoke test using mvn commands using entrypoint.sh. Can anyone help us on this ?</p>
",https://stackoverflow.com/questions/69476307/karate-ui-jenkins-integration,"['docker', 'jenkins', 'integration', 'karate', 'ui-testing']",17,False,1,0
adjustsFontForContentSizeCategory is breaking the UIButton,"<p>I'm having a button which is being configured with extension that looks like this:</p>
<pre><code>extension UIButton {
   func applyStyle(_ type: CustomButtonType) {
        titleLabel?.adjustsFontForContentSizeCategory = true
        switch type {
        case .primary:
            backgroundColor = K.Colors.callToActionPrimary
            layer.cornerRadius = 10
            setTitleColor(UIColor.white, for: .normal)
        
        case .secondary:
            backgroundColor = UIColor.systemBackground
            layer.cornerRadius = 10
            layer.borderColor = K.Colors.callToActionPrimaryBorder?.cgColor
            layer.borderWidth = 1
            setTitleColor(K.Colors.callToActionPrimary, for: .normal)
        
        case .tertiary:
            backgroundColor = UIColor.systemBackground
            layer.cornerRadius = 10
            setTitleColor(K.Colors.callToActionPrimary, for: .normal)            
        }
    }
}
</code></pre>
<p>The order of button setup looks like this:</p>
<pre><code>button1.applyStyle(.primary)
button1.setTitle(&quot;Some title&quot;, for: .normal)
</code></pre>
<p><a href=""https://i.stack.imgur.com/jQoP2.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/jQoP2.png"" alt=""enter image description here"" /></a></p>
<p>While this works fine for the normal flow, once I add a UI test the setTitleColor() seems to have broken (or executed at later point).</p>
<p>However if I comment out the line <code>titleLabel?.adjustsFontForContentSizeCategory = true</code> it works in the UI testing.
Why is it breaking?</p>
",https://stackoverflow.com/questions/67582214/adjustsfontforcontentsizecategory-is-breaking-the-uibutton,"['ios', 'uibutton', 'uikit', 'swift5']",152,False,0,1
XCUITest mock specific endpoints,"<p>I'm trying to achieve mocked responses for certain endpoints for UI testing in XCUITests. However all the available mock servers set the url at the start of the test and hence all the requests go through them.</p>
<p>How can I make only specific requests to go through the local mock server and rest of the requests to go through the default prod / stage endpoints?</p>
",https://stackoverflow.com/questions/67397895/xcuitest-mock-specific-endpoints,"['swift', 'mocking', 'xcuitest', 'ambassador', 'swifter']",194,False,0,1
username and password to url in python selenium,"<p><strong>Introduction</strong>:</p>
<p>i am doing UI testing with python and selenium and i am blocked when sign in page is asked as pop up window and i only seen best way is to pass the username and password to the url.. but my username contains &quot;@&quot; and &quot;*&quot; i even tried with encoded version of it still its not working</p>
<p><strong>Problem:</strong></p>
<pre><code>normal url - driver.get(&quot;https://firstname.lastname@test.com:testpass*11@test.company.com&quot;)
encoded -    driver.get(&quot;https://firstname.lastname%40test.com:testpass%2A11@test.company.com&quot;)
</code></pre>
<p>i used <strong>'%40'</strong> for <strong>'@'</strong> and <strong>'%2A'</strong> for <strong>'*'</strong> ,</p>
<p><strong>Error:</strong></p>
<p>Getting error like 404</p>
",https://stackoverflow.com/questions/70244848/username-and-password-to-url-in-python-selenium,"['python-3.x', 'selenium-webdriver', 'selenium-chromedriver', 'selenium-webdriver-python']",160,False,0,0
Performance Testing - Are there any automation tools for performance testing that renders webpages in browser?,"<p>All the performance testing tools I found do not use actual browsers for UI testing. Some of them will get the html of the webpage from the server and will parse it and we can verify the elements on them.</p>
<p>What I want is to find the time it takes to render the web pages and elements in actual browsers when multiple users are logged into the application. Any suggestions?</p>
",https://stackoverflow.com/questions/65622979/performance-testing-are-there-any-automation-tools-for-performance-testing-tha,"['performance-testing', 'ui-automation', 'browser-automation']",223,True,0,1
"XCUItest. When you try to tap on the enter button on the system keyboard, the test breaks and the main.m file opens","<p>I am writing <strong>UI</strong> tests for a ready-made ios application. I have a window in which you need to enter a valid link and tap on the Enter key to go to the next window. But the test stops after the command <strong>app.keyboards.buttons [&quot;continue&quot;].tap()</strong> and the main.m file opens which looks like this.
<a href=""https://i.stack.imgur.com/f1i3W.jpg"" rel=""nofollow noreferrer"">enter image description here</a></p>
<p>I am new to ui testing. Please tell me what could be the problem.</p>
",https://stackoverflow.com/questions/69266297/xcuitest-when-you-try-to-tap-on-the-enter-button-on-the-system-keyboard-the-te,"['ios', 'xctest', 'xcuitest']",910,False,1,0
What are the steps involved for svg button click and copy the url,"<p>Writing steps for UI testing using karate framework
so basically svg button, have to click then the URL in the new tab for further functionality processing
how to handle that ?</p>
<p>i tried below code</p>
<ul>
<li>def secure_url = mouse(&quot;#root &gt; section &gt; section &gt; main &gt; div &gt; div &gt; div.ant-table-wrapper &gt; div &gt; div &gt; div &gt; div &gt; div &gt; table &gt; tbody &gt; tr:nth-child(1) &gt; td:nth-child(7) &gt; span &gt; button &gt; svg&quot;).click()</li>
</ul>
<p>and verified the secure_url value using
print secure_url
it prints com.intuit.karate.driver.DriverMouse@664e5dee
but Expected is URL</p>
",https://stackoverflow.com/questions/66866959/what-are-the-steps-involved-for-svg-button-click-and-copy-the-url,"['automation', 'karate']",140,True,1,1
JS function for a number of elements onclick without using getElementById,"<p>.Net 5.0
Javascript</p>
<p>I have the below code to disable all elements on my UI when an image link <code>MouseClickIconRow1</code> or <code>MouseClickIconRow2</code> etc. is clicked.</p>
<p>However, I can't give all elements the same ID because my ID's are unique for UI testing.</p>
<p>I have tried to create a loop for <code>getElementsByName</code>, but I cant get it working. I have also been trying to pass in a unique element id as per below. I am pretty new to Javascript.</p>
<p><strong>HTML</strong></p>
<pre><code>&lt;img src=&quot;@Model.MouseClickIconThumbnailUrl&quot; id=&quot;MouseClickIconRow1&quot; name=&quot;IconClick&quot; onclick=&quot;DisableEnableLinks(this, true)&quot; width=&quot;20&quot; height=&quot;35&quot; alt=&quot;Mouse Click Here Image&quot;&gt;&lt;/a&gt;

&lt;img src=&quot;@Model.MouseClickIconThumbnailUrl&quot; id=&quot;MouseClickIconRow2&quot; name=&quot;IconClick&quot; onclick=&quot;DisableEnableLinks(this, true)&quot; width=&quot;20&quot; height=&quot;35&quot; alt=&quot;Mouse Click Here Image&quot;&gt;&lt;/a&gt;
</code></pre>
<p><strong>Javascript</strong></p>
<pre><code>function DisableEnableLinks(elem ,xHow) {
    document.getElementById(elem).onclick
        = function () {
            objLinks = document.links;
            for (i = 0; i &lt; objLinks.length; i++) {
                objLinks[i].disabled = xHow;
                //link with onclick
                if (objLinks[i].onclick &amp;&amp; xHow) {
                    objLinks[i].onclick =
                        new Function(&quot;return false;&quot; + objLinks[i].onclick.toString().getFuncBody());
                }
                //link without onclick
                else if (xHow) {
                    objLinks[i].onclick = function () { return false; }
                }
                //remove return false with link without onclick
                else if
                    (!xHow &amp;&amp; objLinks[i].onclick.toString().indexOf(&quot;function(){return false;}&quot;) != -1) {
                    objLinks[i].onclick = null;
                }
                //remove return false link with onclick
                else if (!xHow &amp;&amp; objLinks[i].onclick.toString().indexOf(&quot;return false;&quot;) != -1) {
                    strClick = objLinks[i].onclick.toString().getFuncBody().replace(&quot;return false;&quot;, &quot;&quot;)
                    objLinks[i].onclick = new Function(strClick);
                }
            }
        }
}
String.prototype.getFuncBody = function () {
    var str = this.toString();
    str = str.replace(/[^{]+{/, &quot;&quot;);
    str = str.substring(0, str.length - 1);
    str = str.replace(/\n/gi, &quot;&quot;);
    if (!str.match(/\(.*\)/gi)) str += &quot;)&quot;;
    return str;
}
</code></pre>
",https://stackoverflow.com/questions/68896446/js-function-for-a-number-of-elements-onclick-without-using-getelementbyid,"['javascript', 'asp.net', '.net']",51,True,0,3
IllegalStateException: FocusRequester is not initialized during Jetpack Compose testing,"<p>I have a screen with <code>TextFields</code>. I need the first <code>TextField</code> to be automatically focused when the screen is displayed.</p>
<p><strong>Minified Example code</strong></p>
<pre><code>@Composable
fun ScreenView(
    data: ScreenViewData,
) {
    val focusManager = LocalFocusManager.current
    val focusRequester = remember {
        FocusRequester()
    }

    LaunchedEffect(
        key1 = Unit,
    ) {
        focusRequester.requestFocus()
    }

    Scaffold() { innerPadding -&gt;
        Column {
            OutlinedTextField(
                modifier = Modifier.focusRequester(focusRequester),
            )
        }
    }
}
</code></pre>
<p>The code works without any issues.</p>
<p>But, in compose UI testing I am getting the following error.</p>
<blockquote>
<p>java.lang.IllegalStateException: <br>
FocusRequester is not initialized. Here are some possible fixes: <br></p>
<ol>
<li>Remember the FocusRequester: val focusRequester = remember { FocusRequester() } <br></li>
<li>Did you forget to add a Modifier.focusRequester() ? <br></li>
<li>Are you attempting to request focus during composition? Focus requests should be made in <br>
response to some event. Eg Modifier.clickable { focusRequester.requestFocus() } <br></li>
</ol>
</blockquote>
<p><strong>Test code</strong></p>
<pre><code>@ExperimentalAnimationApi
class ScreenViewTest {

    @get:Rule
    val composeTestRule = createComposeRule()

    @ExperimentalMaterialApi
    @Test
    fun ScreenViewElementsAreDisplayed() {
        composeTestRule.setContent {
            MyAppTheme {
                ScreenView(
                    data = ScreenViewData(),
                )
            }
        }

        // Test fails before reaching assert statements
    }
}
</code></pre>
",https://stackoverflow.com/questions/69962662/illegalstateexception-focusrequester-is-not-initialized-during-jetpack-compose,"['android', 'kotlin', 'android-jetpack-compose', 'android-jetpack-compose-testing']",1619,False,5,1
How to enable screen recording for DevOps? TestSettings issue,"<p>I'm trying to set up screen recording for my local environment, and for running on a Release in Microsoft DevOps Pipelines. I've been trying a few different approaches that might conflict, but any help is appreciated.</p>
<p>I'm stuck here:
I cannot find the option to &quot;Screen and Voice Record&quot; within Test Settings.</p>
<p><a href=""https://i.stack.imgur.com/WSx6x.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/WSx6x.png"" alt=""Location where I expected to find &quot;Screen and voice recorder&quot;"" /></a></p>
<p>This is my .runsettings file.</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;RunSettings&gt;
    &lt;DataCollectionRunSettings&gt;
        &lt;DataCollectors&gt;
            &lt;DataCollector uri=&quot;datacollector://microsoft/VideoRecorder/1.0&quot; assemblyQualifiedName=&quot;Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder.VideoRecorderDataCollector, Microsoft.VisualStudio.TestTools.DataCollection.VideoRecorder, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; friendlyName=&quot;Screen and Voice Recorder&quot;&gt;
                &lt;!--Video data collector was introduced in Visual Studio 2017 version 15.5 --&gt;
                &lt;Configuration&gt;
                    &lt;!-- Set &quot;sendRecordedMediaForPassedTestCase&quot; to &quot;false&quot; to add video attachments to failed tests only --&gt;
                    &lt;MediaRecorder sendRecordedMediaForPassedTestCase=&quot;false&quot;  xmlns=&quot;&quot;&gt;
                        &lt;ScreenCaptureVideo bitRate=&quot;512&quot; frameRate=&quot;2&quot; quality=&quot;20&quot; /&gt;
                    &lt;/MediaRecorder&gt;
                &lt;/Configuration&gt;
            &lt;/DataCollector&gt;
        &lt;/DataCollectors&gt;
    &lt;/DataCollectionRunSettings&gt;
&lt;/RunSettings&gt;
</code></pre>
<p>Resources I used:
<a href=""https://learn.microsoft.com/en-us/azure/devops/pipelines/test/ui-testing-considerations?view=azure-devops&amp;tabs=mstest#capture-screenshot"" rel=""nofollow noreferrer"">https://learn.microsoft.com/en-us/azure/devops/pipelines/test/ui-testing-considerations?view=azure-devops&amp;tabs=mstest#capture-screenshot</a></p>
<p><a href=""https://github.com/Microsoft/vstest/issues/1959"" rel=""nofollow noreferrer"">https://github.com/Microsoft/vstest/issues/1959</a></p>
",https://stackoverflow.com/questions/69108430/how-to-enable-screen-recording-for-devops-testsettings-issue,"['.net', 'selenium', 'devops', 'recording']",444,True,1,1
Mocking a final class using MockitoKotlin2,"<p>Hi I am using MockitoKotlin2 library for mocking and I am trying to mock a final class of retrofit how can I do that, does it support mocking final classes, what is the solution please.</p>
<p>Error</p>
<pre><code>org.mockito.exceptions.base.MockitoException:
Cannot mock/spy class retrofit2.Response
Mockito cannot mock/spy because :
- final or anonymous class
at com.xx.xxx.test.scenarios.SerOrderViewScenario.setup(SerOrderViewScenario.kt:147)
at com.xx.xxxx.test.BaseTest.scenario(BaseTest.java:75)
at com.xx.xxx.test.NoSerRequiredTests.testFragment_AStart(NoSerRequiredTests.java:34)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
at androidx.test.internal.runner.junit4.statement.RunAfters.evaluate(RunAfters.java:61)
at androidx.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:527)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:388)
at com.xx.xxx.test.runner.UnlockDeviceAndroidJUnitRunner.onStart(UnlockDeviceAndroidJUnitRunner.java:42)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2145)
</code></pre>
<p>Retrofit function I am trying to mock</p>
<pre><code>package retrofit2;

/** An HTTP response. */
public final class Response&lt;T&gt; {
  /** Create a synthetic successful response with {@code body} as the deserialized body. */
  public static &lt;T&gt; Response&lt;T&gt; success(@Nullable T body) {
    return success(body, new okhttp3.Response.Builder() //
        .code(200)
        .message(&quot;OK&quot;)
        .protocol(Protocol.HTTP_1_1)
        .request(new Request.Builder().url(&quot;http://localhost/&quot;).build())
        .build());
  }
</code></pre>
<p>this is not I am trying to mock in my scenario class for UI testing</p>
<pre><code>import com.nhaarman.mockitokotlin2.mock

val response: Response&lt;GenericResponse&gt; = mock()
</code></pre>
<p>I have read about adding <code>org.mockito:mockito-inline:2.13.0</code> but not sure as I am using mockitokotlin2</p>
<p><a href=""https://stackoverflow.com/questions/14292863/how-to-mock-a-final-class-with-mockito"">How to mock a final class with mockito</a></p>
<p>Any suggestions please</p>
<p>thanks in advance
R</p>
",https://stackoverflow.com/questions/65824387/mocking-a-final-class-using-mockitokotlin2,"['android', 'kotlin', 'mocking', 'mockito', 'retrofit']",467,False,1,1
Xamarin UI Testing on Visual Studio Community 2019,"<p>I've been trying for hours trying to get the Xamarin UI Testing project type to show up by installing various visual studio packages, as well as attempting to add the Xamarin.UITesting nuget package to my existing unit testing project. I've consulted dozens of guides on the subject and read bug reports and stack overflow questions.</p>
<p>I can't find it definitively stated anywhere, but I think I've finally decided that I need the enterprise version of Visual Studio. Can anyone just confirm that for me?</p>
",https://stackoverflow.com/questions/66844734/xamarin-ui-testing-on-visual-studio-community-2019,"['visual-studio', 'unit-testing', 'xamarin', 'testing', 'automated-tests']",41,True,0,1
Testing a Fragment Scenario with ViewBinding,"<p>I'm trying to test a fragment that uses viewBinding to show the views, and a viewModel to fetch that data.</p>
<p>I want to write a UI test to see if certain data is visible or not, but so fare I've had no luck and I'm hoping somebody can help me as I'm still very new to UI testing.</p>
<p>So far I tried mocking the viewModel, the liveData and the viewBinding, but to no success</p>
<p>Here are a few example classes of what I have tried to do</p>
<p>My ViewModel:</p>
<pre><code>   
    private val bike: MutableLiveData&lt;Bike&gt; = MutableLiveData()
  
    val getBike: LiveData&lt;BikeType&gt;
        get() = bikeType


    fun getBike() {
       
            BikeService().getBike(bikeId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe({
                    bike.postValue(it)
                }, {
                    Timber.e(it)
                }).let { disposeBag.add(it) }
        }
    }
 }
</code></pre>
<p>My Fragment</p>
<pre><code>class BikeFragment : AppAbstractBaseFragment&lt;Any&gt;(), BikeView,
    OnBackPressedListener {

    var mBinding: FragmentBikeBinding? = null
    var viewModel: BikeViewModel? = null

    var cancellable: Boolean = false


    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        mBinding = FragmentBikeBinding.inflate(inflater, container, false)
        return mBinding?.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        if (viewModel == null) {
            viewModel = ViewModelProvider(this).get(BikeViewModel::class.java)
        }
        mBinding?.apply {
            this.view = this@BikeDashboardFragment
            
            viewModel?.getBike?.observe(viewLifecycleOwner, { newBike -&gt;
                bike = newBike

            })
          
        }
      
        viewModel?.getBike()
    }
</code></pre>
<p>The Test</p>
<pre><code>class BikeTest {

    @get:Rule
    val screenshotTestRule = ScreenshotTestRule()

    @Rule
    @JvmField
    val dataBindingIdlingResourceRule = DataBindingIdlingResourceRule()

    @Rule
    @JvmField
    var instantExecutor = InstantTaskExecutorRule()

    private var scenario: FragmentScenario&lt;BikeFragment&gt;? = null
    private var bikeData = mockk&lt;MutableLiveData&lt;Bike&gt;&gt;()

    private var viewModel = mockk&lt;BikeViewModel&gt;(relaxed = true)
    private val lifecycleOwner: LifecycleOwner = mockk()
    private var fakeBike =
        Bike(id = 1, cancellable = true, linkable = true, ownerName = &quot;Joske&quot;)

    var context: Context? = null


    @Before
    fun setUp() {
        val app = ApplicationProvider.getApplicationContext&lt;BaseApplication&gt;()
        context = app.applicationContext

    }

    @Test
    fun loadBikeSeeTheRightBikeData() {
        scenario = launchFragmentInContainer(
            themeResId = R.style.Theme_Brand
        )
        dataBindingIdlingResourceRule.monitorFragment(scenario!!)
        scenario?.onFragment {
            it.mBinding?.bike = fakeBike
            onView(withId(R.id.ownerNameTextView)).check(matches(withText(&quot;Klaartje&quot;)))
        }
    }

}
</code></pre>
",https://stackoverflow.com/questions/68938438/testing-a-fragment-scenario-with-viewbinding,"['android', 'android-espresso', 'android-testing', 'android-fragmentscenario']",760,False,2,0
"UiTest not recording on Xcode 12, iOS 14.5","<p>I'm working on a small test Xcode project that I'm using to better understand and improve application testing practices. I didn't have any problem with the core functionalities tests, however I'm stuck on UI testing: when I try to record UI interactions, nothing happens. The recording button works properly and the application is correctly built and launched, but it seems like no input is catch. Is anyone experiencing the same issue or know what a possible workaround could be? Xcode version is 12.5 (12E262) and the simulator is running iOS 14.5.</p>
<p><a href=""https://i.stack.imgur.com/HyLb4.png"" rel=""nofollow noreferrer"">The functions stays empty</a></p>
",https://stackoverflow.com/questions/67548818/uitest-not-recording-on-xcode-12-ios-14-5,"['ios', 'swift', 'xcode', 'testing', 'simulator']",642,True,1,2
Returning Conditional Responses from MockedWebService in Swift,"<p>I am implementing UI Testing and need to mock a service so I don't call the service again and again and remove the dependency on the network call. So, I created a Mock called MockWebservice. It is implemented below:</p>
<pre><code>class MockedWebservice: NetworkService {
    
    func login(username: String, password: String, completion: @escaping (Result&lt;LoginResponse?, NetworkError&gt;) -&gt; Void) {
        
            completion(.success(LoginResponse(success: true)))
       
    }
}
</code></pre>
<p>It works but as you can see it always returns success: true. How can I make this MockedWebservice return a different response. The MockWebservice is injected into the main app using the launchEnvironment for unit test. Here is the code in the actual SwiftUI App which creates a real web service or a mocked version.</p>
<pre><code>class NetworkServiceFactory {
    
    static func create() -&gt; NetworkService {
        
        let environment = ProcessInfo.processInfo.environment[&quot;ENV&quot;]
        
        if let environment = environment {
            if environment == &quot;TEST&quot; {
                return MockedWebservice()
            } else {
                return Webservice()
            }
        } else {
            return Webservice()
        }
        
    }
    
}
</code></pre>
",https://stackoverflow.com/questions/69532330/returning-conditional-responses-from-mockedwebservice-in-swift,"['ios', 'swift']",34,True,0,1
Struggling to build with Detox,"<p>I am looking to setup automated end to end UI testing for React Native App and its my first time doing it using detox.</p>
<p>I followed exact steps as mentioned in this article:
<a href=""https://varunon9.medium.com/e2e-testing-of-react-native-app-android-using-detox-a-step-by-step-guide-bfb520c1a9ac"" rel=""nofollow noreferrer"">https://varunon9.medium.com/e2e-testing-of-react-native-app-android-using-detox-a-step-by-step-guide-bfb520c1a9ac</a></p>
<p>But every time I try to run build command i.e: detox build -c android.emu.debug. I get the following error:</p>
<p>[Here is the console log from when I run the command]
[1]: <a href=""https://i.stack.imgur.com/zbLlO.png"" rel=""nofollow noreferrer"">https://i.stack.imgur.com/zbLlO.png</a></p>
<p>Any help would be greatly appreciated</p>
",https://stackoverflow.com/questions/65929194/struggling-to-build-with-detox,"['android', 'react-native', 'jestjs', 'automated-tests', 'detox']",375,True,0,1
@BeforeAll not functioning as intended in JUnit5,"<p>I'm running UI testing on Android devices using Appium. We recently migrated to JUnit5 and I'm attempting to utilize the <code>@BeforeAll</code> class to make sure the app is in a good state before we continue to the next class.
Currently, the tooltip in Android studio is indicating that the function is never used. In the log I'm seeing a <code>junitException</code> saying that the method must be static. I haven't implemented <code>@TestInstance</code> yet, I'd like to be able to use <code>beforeAll</code> without it for now. I'm just confused why it isn't working since my <code>@beforeEach</code> and <code>@afterEach</code> are both working. The error and code are below.</p>
<pre><code>org.junit.platform.commons.JUnitException: @BeforeAll method 'public final void com.bypass.automation.BaseTest.healthcheck()' must be static unless the test class is annotated with @TestInstance(Lifecycle.PER_CLASS).
</code></pre>
<pre><code>open class BaseTest {

    lateinit var driver: AndroidDriver&lt;MobileElement&gt;
    private val capabilities = DesiredCapabilities().apply {
        setCapability(APPIUM_VERSION, &quot;1.19.1&quot;)
        setCapability(PLATFORM_NAME, &quot;Android&quot;)
        setCapability(DEVICE_NAME, &quot;Android&quot;)
        setCapability(&quot;appPackage&quot;, &quot;com.ourpackage&quot;)
        setCapability(&quot;appActivity&quot;, &quot;com.ourpackage.PassthroughHomeActivity&quot;)
        setCapability(&quot;automationName&quot;, &quot;uiautomator2&quot;)
        setCapability(&quot;skipDeviceInitialization&quot;, true)
        setCapability(&quot;noReset&quot;, true)
        setCapability(&quot;full-reset&quot;, false)
        setCapability(&quot;enableMultiWindows&quot;, false)
        setCapability(&quot;unlockType&quot;, &quot;pin&quot;)
        setCapability(&quot;unlockKey&quot;, &quot;0000&quot;)
        setCapability(&quot;newCommandTimeout&quot;, &quot;120&quot;)
    }


    @BeforeAll
    fun healthcheck() {
        val currentActivity = driver.currentActivity()
        println(&quot;Current activity is $currentActivity&quot;)
        if (currentActivity.contains(&quot;StationSecurePayActivity&quot;)) {
            println(&quot;Exiting Station Pay&quot;)
                CreditCardEntryView(driver).clickBackButton()
                }
        when {
            currentActivity.contains(&quot;kiosk&quot;) -&gt; {
                Thread.sleep(2000)
                println(&quot;Exiting Kiosk&quot;)
                KioskView(driver).exitKiosk()
                println(&quot;Logging out&quot;)
                LogInProviderUtil(driver).logOut()
            }
            currentActivity != &quot;.LoginActivity&quot; -&gt; {
                println(&quot;Logging out&quot;)
                LogInProviderUtil(driver).logOut()
            }
            currentActivity.contains(&quot;.LoginActivity&quot;) -&gt; {
                println(&quot;Session was properly logged out. No action taken.&quot;)
            }
        }
    }

    @BeforeEach
    fun setup() {
        driver = AndroidDriver(URL(&quot;http://127.0.0.1:4750/wd/hub&quot;), capabilities)
        driver.manage()?.timeouts()?.implicitlyWait(30, SECONDS)
        if (LogInProviderUtil(driver).isLoggedIn()){
            LogInProviderUtil(driver).logOut()
        }
    }

    @AfterEach
    fun teardown() {
        if (LogInProviderUtil(driver).isLoggedIn()){
            LogInProviderUtil(driver).logOut()
            driver.quit()
        }
    else {
            driver.quit()
        }
    }

}
</code></pre>
",https://stackoverflow.com/questions/65740396/beforeall-not-functioning-as-intended-in-junit5,"['android', 'kotlin', 'appium', 'junit5', 'ui-testing']",2568,True,1,2
How to mock extension function or top level function in UI testing Before Android P?,"<p><strong>Is there any way to mock top level function or extension function in UI testing before Android P.</strong></p>
<p>In android UI test I have used mockk library but there is no support extension function mocking in UI test before Android P. Below is supported feature given by mockk(<a href=""https://mockk.io/ANDROID.html"" rel=""nofollow noreferrer"">https://mockk.io/ANDROID.html</a>).</p>
<p><a href=""https://i.stack.imgur.com/a364r.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/a364r.png"" alt=""enter image description here"" /></a></p>
<p>Here is top level function file and it's UI test that works very well above Android P version but not worked before P because mockk is not supported.</p>
<pre><code>@file:JvmName(&quot;Test&quot;)
package com.example.dexopener.mockk

fun isLogin(): Boolean {
    return false;
}
</code></pre>
<p>For above top level function Here in UI test mocking isLogin method that works very well after Android P</p>
<pre><code>@Test
fun test_top_level_function_is_able_to_mock(){
        mockkStatic(&quot;com.example.dexopener.mockk.Test&quot;)
        every { isLogin() } returns true
        assertTrue(isLogin())
}
</code></pre>
",https://stackoverflow.com/questions/68208710/how-to-mock-extension-function-or-top-level-function-in-ui-testing-before-androi,"['android', 'mockito', 'powermock', 'ui-testing', 'mockk']",194,False,0,0
Android UI Testing launch Fragment,"<p>I've been trying to write a simple UI Test for a Login Dialog in my Android App, but I've come to have trouble even starting the Login Fragment. I've tried several methods starting with ActivityTestRule to declare the Activity the Fragment depends on to launching my fragment isolated, but nothing seems to work.
This is the error I'm getting, from which I'm not able to draw any conclusions about what's going wrong:</p>
<pre><code>E/TestRunner: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=de.smartwireless.smartconnect.debug/androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity (has extras) }
</code></pre>
<p>This is the initial code of my Testclass. It's not really populated because I want to make sure that the fragment launches correctly before I go on with the UI Testing itself:</p>
<pre><code>@RunWith(AndroidJUnit4::class)
class LoginTest {

    private lateinit var scenario: FragmentScenario&lt;LoginFragment&gt;

    @Before
    fun prepareLogin() {
        IdlingRegistry.getInstance().register(SemaphoreIdlingResource.semaphoreIdlingResource)
        scenario = launchFragmentInContainer&lt;LoginFragment&gt;()
        scenario.moveToState(Lifecycle.State.STARTED)
    }

    @Test
    fun loginSuccess() {}

    @After
    fun finish() {
        IdlingRegistry.getInstance().unregister(SemaphoreIdlingResource.semaphoreIdlingResource)
    }
}
</code></pre>
",https://stackoverflow.com/questions/67107825/android-ui-testing-launch-fragment,"['android', 'kotlin', 'android-fragments']",295,False,0,0
XCTestCase - how to delete app in setup method,"<p>I am writing unit tests for my Swift application and I would like to delete the app in between each test case for certain suites. I already have a script action set up that uninstalls the app before the whole suite runs. But I have not found a way to be able to delete the app off the simulator in between each <code>test</code> invocation. Is there a way to do this?</p>
<p>What I want is:</p>
<pre class=""lang-swift prettyprint-override""><code>import XCTest
@testable import My_App

class MyTests: XCTestCase {

  override func setUpWithError throws () {
    magic(&quot;xcrun simctl uninstall booted ${PRODUCT_BUNDLE_IDENTIFIER}&quot;)
  }
  
  func testTheThings() {
    // test runs with a completely fresh slate...
  }
}
</code></pre>
<p>Please note that this is <strong>unit testing</strong> and not UI testing - so I don't think I can have the test delete the app from the Springboard, which is what I otherwise do in my UI tests to give each test a clean slate.</p>
",https://stackoverflow.com/questions/69147623/xctestcase-how-to-delete-app-in-setup-method,"['swift', 'xctest']",107,False,2,0
Selenium Microsoft Login “Your browser is a bit unusual…” Message,"<p>I'm trying to do some UI testing with Selenium and NUnit in C# but need to login through Microsoft first. After entering my information with selenium, when I try to click Sign-In I get a popup saying:</p>
<p>&quot;Your browser is a bit unusual... Try disabling ad blockers and other extensions, enabling javascript or using a different web browser.&quot;</p>
<p>My best guess is that <a href=""https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver"">it is detecting that I'm using selenium</a>, but I'm not sure as I can't find anyone else with a similar message. Is this what is happening? If so, is the solution described in the link my best option or is there another way to login to Microsoft?</p>
<p>Here is a rough example of my code:</p>
<pre><code>[TestFixture]
public class FileUploadTests
{
    IWebDriver webDriver;

    [OneTimeSetUp]
    public void StartChrome()
    {
        var options = new ChromeOptions();
        options.AddArgument(&quot;--enable-javascript&quot;);
        options.AddArguments(&quot;--incognito&quot;);
        options.AddArgument(&quot;--profile-directory=Default&quot;);
        options.AddArgument(&quot;--disable-plugins-discovery&quot;);
        options.AddArgument(&quot;--profile-directory=Default&quot;);
        options.AddArgument(&quot;.&quot;);
        webDriver = new ChromeDriver(options);
        webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
    }

    [Test]
    public void Login()
    {
        webDriver.Navigate().GoToUrl(&quot;https://localhost:xxxxx/&quot;);
        webDriver.FindElement(By.Id(&quot;LoginButton&quot;)).Click();
        webDriver.FindElement(By.Id(&quot;i0116&quot;)).Clear();
        webDriver.FindElement(By.Id(&quot;i0116&quot;)).SendKeys(&quot;username&quot;);
        webDriver.FindElement(By.Id(&quot;i0116&quot;)).SendKeys(Keys.Enter);
        webDriver.FindElement(By.Id(&quot;password&quot;)).Clear();
        webDriver.FindElement(By.Id(&quot;password&quot;)).SendKeys(&quot;password&quot;);
        System.Threading.Thread.Sleep(500);
        webDriver.FindElement(By.Id(&quot;password&quot;)).SendKeys(Keys.Enter);
        webDriver.FindElement(By.Id(&quot;submitBtn&quot;)).Click();
    }

    [OneTimeTearDown]
    public void CloseTest()
    {
        webDriver.Close();
        webDriver.Dispose();
        webDriver.Quit();
    }
}
</code></pre>
",https://stackoverflow.com/questions/69258854/selenium-microsoft-login-your-browser-is-a-bit-unusual-message,"['c#', 'selenium', 'google-chrome', 'selenium-webdriver', 'selenium-chromedriver']",717,True,0,1
What&#39;s a good alternative to setting XCUIDevice.shared.orientation for changing the orientation during XCTests in Xcode 13?,"<p>What's a good alternative to setting XCUIDevice.shared.orientation for changing the orientation during XCTests in Xcode 13?</p>
<p>Many of our app's existing snapshot tests set the device orientation using:</p>
<pre><code>XCUIDevice.shared.orientation = orientation.deviceOrientation
</code></pre>
<p>However in Xcode 13, these tests fail due to the following exception being thrown when this method is called:</p>
<blockquote>
<p><strong>Failed to set device orientation: Not authorized for performing UI testing actions.</strong>
Exception _XCTestCaseInterruptionException * 0x60000082b060 0x000060000082b060</p>
</blockquote>
<p>Googling this error led me to find <a href=""https://github.com/flutter/flutter/issues/84162"" rel=""nofollow noreferrer"">this Flutter issue</a> where they state:</p>
<blockquote>
<p>I guess Xcode 13 will limit the use of XCUIDevice to XCUITests.</p>
</blockquote>
<p>Our snapshot tests are not XCUITests, though, so what options do we have to force a particular device rotation so that we can snapshot the way the view would look in landscape and portrait?</p>
",https://stackoverflow.com/questions/69228440/whats-a-good-alternative-to-setting-xcuidevice-shared-orientation-for-changing,"['ios', 'xcode', 'ios15', 'xcode13']",872,True,2,3
Is it possible to run UNIT TEST with Cypress standalone version similar to how Jasmine does it? (in browser),"<p>Cypress allows for GUI testing in browser as well as Unit Testing using the NodeJS installation version.
But I was wondering if the standalone version, aside for UI testing, it also allows for Unit testing.
I don't seem to find any information in regards.</p>
<p>I am working on a website project that uses <strong>plain HTML + JS</strong>, meaning that there is <strong>no NodeJS involved</strong> nor anything similar.
I need to write some Unit tests for it.</p>
<p>If I was to use Jasmine, that provides a simple inline script linking such as <code>&lt;script type=&quot;text/javascript&quot; src=&quot;lib/jasmine-{#.#.#}/jasmine.js&quot;&gt;&lt;/script&gt;</code>.</p>
<p>But I'm not sure how it is done in Cypress, or if it is even possible.
It would be handy to be able to do Unit test and UI test with the same testing library.</p>
",https://stackoverflow.com/questions/67152773/is-it-possible-to-run-unit-test-with-cypress-standalone-version-similar-to-how-j,"['unit-testing', 'jasmine', 'cypress']",247,False,1,0
CreatedAtAction method returns &quot; No route matches the supplied values.&quot;,"<p>I have a http post method  for whose testing I have written the test below :</p>
<pre><code>public async Task TestAdd_NewLicenseType()
{
    using(var context = new LicenseGenContext(ContextOptions))
    {
        var controller = new LicenseTypeController(context);
        var newLiceneType = new LicenseType()
        {
            LicenseTypeId = Guid.NewGuid(),
            LicenseTypeName = &quot;TypeOne&quot;,
            LicenseTypeDescription = &quot;License for StandAlone players&quot;
        };

        var result = await controller.AddAsync(newLiceneType);

        Assert.IsAssignableFrom&lt;CreatedAtActionResult&gt;(result);
    }

}
</code></pre>
<p>The Http post is written in the controller as below :</p>
<pre><code>[HttpPost]
[Route(&quot;AddLicenseType&quot;)]
public async Task&lt;ActionResult&gt; AddAsync(LicenseType newLicenseType)
{
    
    if (!ModelState.IsValid)
    {
        return new Microsoft.AspNetCore.Mvc.BadRequestObjectResult(ModelState);
    }

    var result = await _context.LicenseTypes.AddAsync(newLicenseType);
    _context.SaveChanges();

    return CreatedAtAction(&quot;FindById&quot;, new { id = newLicenseType.LicenseTypeId }, newLicenseType);

}
</code></pre>
<p>I have created an HttpGet method and named it <em>FindById</em> which is referred to in the post method :</p>
<pre><code>[HttpGet(&quot;{id}&quot;, Name =&quot;FindById&quot;)]
//[ActionName(&quot;FindById&quot;)]
private async Task&lt;ActionResult&lt;LicenseType&gt;&gt; FindById(Guid id )
{
    var licenseType = await _context.LicenseTypes.FirstOrDefaultAsync(e =&gt; e.LicenseTypeId == id);

    if (licenseType == null)
    {
        return NotFound();
    }

    else
    {
        return licenseType;
    }
}
</code></pre>
<p>The test passes and when I call this API with the right parameters, I can see a new entry in the database. However the Swagger UI testing tool gives me the below error</p>
<pre><code>System.InvalidOperationException: No route matches the supplied values.
   at Microsoft.AspNetCore.Mvc.CreatedAtActionResult.OnFormatting(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor.ExecuteAsyncCore(ActionContext context, ObjectResult result, Type objectType, Object value)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor.ExecuteAsync(ActionContext context, ObjectResult result)
   at Microsoft.AspNetCore.Mvc.ObjectResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultAsync(IActionResult result)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResultFilterAsync[TFilter,TFilterAsync]()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeFilterPipelineAsync&gt;g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.&lt;Invoke&gt;g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
</code></pre>
<p>I have read a few of the similar issues on StackOverflow but none of the solutions (removing Async from end of the method name, adding <em>SuppressAsyncSuffixInActionNames</em> option in my startup file )work for me.</p>
<p>Can someone please tell me if there is a problem with the current implementation?</p>
",https://stackoverflow.com/questions/69831362/createdataction-method-returns-no-route-matches-the-supplied-values,"['asp.net-core-webapi', 'tdd', 'xunit', 'asp.net-core-5.0']",279,False,1,0
How to make a unit test for the Google Sign In delegate functions?,"<p>I am trying to implement Google Sign In to my project. And I created an interface adapter as the gateway between the Google Sign In and the app.</p>
<pre><code>import GoogleSignIn
import RxSwift

class GoogleSignInAdapter: NSObject {
    struct SignInDTO {
        let idToken: String
        let fullName: String
        let email: String
    }

    private(set) lazy var signInSuccessful = signInSuccessfulRelay.asSignal()
    private let signInSuccessfulRelay = PublishRelay&lt;SignInDTO&gt;()

    private(set) lazy var signInFailed = signInFailedRelay.asSignal()
    private let signInFailedRelay = PublishRelay&lt;Error&gt;()

    init() {
        GIDSignIn.sharedInstance()?.clientID = &quot;******&quot;
        GIDSignIn.sharedInstance()?.delegate = self
    }
}

extension GoogleSignInAdapter: GIDSignInDelegate {
    func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
        if let error = error {
            signInFailedRelay.accept(error)
        } else {
            let idToken = user.authentication.idToken
            let fullName = user.profile.name
            let email = user.profile.email
            let result = SignInDTO(idToken: idToken, fullName: fullName, email: email)
            signInSuccessfulRelay.accept(result)
        }
        
    }
    
    func sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) {
        
    }
}
</code></pre>
<p>I am still having trouble to mock and test this adapter so I can trigger the <code>signInSuccessfulRelay</code> and <code>signInFailedRelay</code> with their respective params because the only way to do it is by triggering the delegate itself. But the only way that I can get it to trigger is by using the <code>GIDSignInButton</code> which is a derivative of <code>UIView</code>. That means I have to introduce a part of the view (which is more suited for UI testing instead of unit testing) into the unit test. Can anybody tell me how to make the tests for this class?</p>
",https://stackoverflow.com/questions/66252796/how-to-make-a-unit-test-for-the-google-sign-in-delegate-functions,"['ios', 'swift', 'unit-testing', 'google-signin']",209,False,1,0
"DevOps build pipeline, for Xamarin.iOS Could not find any available provisioning profiles","<p>I'm trying to setup a DevOps build pipeline (eventually for UI Testing) initially for Xamarin.iOS. We have other issues with AppCenter.</p>
<p>I've used the default Xamarin iOS template and am working through the issues.</p>
<p>We're using a mac vm / image.</p>
<p>We decided to use a Debug version of our app as this would provide more useful information from any UI Tests errors. So eventually we can test our build on Simulators in AppCenter.</p>
<p>However, I'm getting this error. I've ensured that I've included a entitlements.plist which has <code>APS Environment</code> set to <code>development</code>. I'm just unsure why it would need a provisioning profile.</p>
<p>I'm not actually sure what AppCenter would require from the build, perhaps it only works with ipa files ? And that therefore requires a profile ???</p>
<pre><code>(_DetectSigningIdentity target) -&gt; 
  /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.Shared.targets(239,3): 
error : Could not find any available provisioning profiles for ourapp.iOS on iOS. 
[/Users/runner/work/1/s/ourapp/iOS/ourapp.iOS.csproj]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.Shared.targets(239,3): 
error : [/Users/runner/work/1/s/ourapp/iOS/ourapp.iOS.csproj]
</code></pre>
",https://stackoverflow.com/questions/66569728/devops-build-pipeline-for-xamarin-ios-could-not-find-any-available-provisioning,"['ios', 'xamarin', 'xamarin.forms', 'azure-devops', 'azure-pipelines']",555,True,0,1
"DevOps build pipeline for Xamarin.iOS, Do I need to create a release build for UI Testing?","<p>I'm trying to setup some Xamarin UI testing, initially for our iOS project. I've run into a lot of issues trying to setup a DevOps pipeline and I've learned a lot in the process.</p>
<p>However, I found <a href=""https://channel9.msdn.com/Shows/On-NET/User-Interface-Testing--DevOps-for-Mobile"" rel=""nofollow noreferrer"">this video</a> on the subject by James Montemagno, where at times 24.31 and 23.47 he mentions that you need to create a debug ipa which runs the <code>Xamarin.TestCloud.Agent</code>.</p>
<p>This is an additional build task after a release build, purely to run the build agent.</p>
<p>At the moment I'm only concered with running UI Tests not creating a release artefact.</p>
<p>I'm wondering if I actually need to run the release build task / drop at all ?</p>
<p>It's just so time consuming making small adjustments and waiting for the process to complete each time.</p>
",https://stackoverflow.com/questions/66581777/devops-build-pipeline-for-xamarin-ios-do-i-need-to-create-a-release-build-for-u,"['ios', 'xamarin', 'xamarin.forms', 'azure-devops', 'azure-pipelines']",62,True,0,1
Android UI testing - ActivityScenarioRule is significantly slower then ActivityScenario,"<p>I'm getting into Android UI testing, and I learnt two ways to start up activities: <code>ActivityScenario</code> in each test, and <code>ActivityScenarioRule</code> once, annotated with <code>@Rule</code>.</p>
<p>At first I used <code>ActivityScenario</code>, with success. Each test took <strong>around 2-4</strong> second to complete:</p>
<pre><code>@RunWith(AndroidJUnit4ClassRunner.class)
public class MyActivityTest {

    @Test
    public void test1() {
        ActivityScenario&lt;MyActivity&gt; scenario = ActivityScenario.launch(MyActivity.class);
        //do testing...
    }

    @Test
    public void test2() {
        ActivityScenario&lt;MyActivity&gt; scenario = ActivityScenario.launch(MyActivity.class);
        //do testing...
    }

    //more tests...
}
</code></pre>
<p>Then I decided to switch to an <code>ActivityScenarioRule</code>, since I have a decent amount of tests written, and with a rule, I don't need to create an <code>ActivityScenario</code> to each test:</p>
<pre><code>@RunWith(AndroidJUnit4ClassRunner.class)
public class MyActivityTest {

   @Rule //launch this activity before each test
   public ActivityScenarioRule&lt;MyActivity&gt; rule = new ActivityScenarioRule&lt;&gt;(MyActivity.class);

    @Test
    public void test1() {
        //do testing...
    }

    @Test
    public void test2() {
        //do testing...
    }

    //more tests...
}
</code></pre>
<p>If I run the tests with this rule, each test takes around <strong>40-50 seconds</strong> and most of it is spent on this screen:</p>
<p><a href=""https://i.stack.imgur.com/ZdF7U.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/ZdF7U.png"" alt=""enter image description here"" /></a></p>
<p>Tests are run on an emulator. I don't know what this screen is and why it takes up so much time when using <code>ActivityScenarioRule</code>. When using <code>ActivityScenario</code> in each test, this screen does not show up and tests complete fast. Please help, what am I missing?</p>
",https://stackoverflow.com/questions/67935253/android-ui-testing-activityscenariorule-is-significantly-slower-then-activitys,"['android', 'android-espresso', 'android-testing', 'instrumented-test', 'androidx-test']",613,False,2,0
iOS UI Testing cannot see the UILabel,"<p>I have a UI testing issue with some code I've got from another developer (Whose not with the project anymore). The code display a simple alert box at the top of the screen when there's an error and I cannot get my UI test to see the <code>UILabel</code> within it.</p>
<p>The structure of the box looks like this:</p>
<pre><code>UIView
   + UILabel
   + UIButton
</code></pre>
<p>And in the custom class for the <code>UIView</code> there is this code:</p>
<pre class=""lang-swift prettyprint-override""><code>// Original code
accessibilityIdentifier = &quot;AlertBar&quot; // Required for UI Testing.

// Bits I've added trying to make messageLabel visible to UI Test
isAccessibilityElement = true
accessibilityElements = [messageLabel]
messageLabel.accessibilityIdentifier = &quot;AlertBarMessage&quot;
messageLabel.isAccessibilityElement = true
}
</code></pre>
<p>If I breakpoint in the middle of my UI Test and dump the app into the log I can see the <code>UIView</code>:</p>
<pre><code>Attributes: Application, pid: 60317, label: 'The App'
Element subtree:
 →Application, 0x600001df8c40, pid: 60317, label: 'The App'
    Window (Main), 0x600001dfa060, {{0.0, 0.0}, {390.0, 844.0}}

    ... app ui logged here!

      Other, 0x600001dce220, {{4.0, 47.0}, {382.0, 107.7}}, identifier: 'AlertBar'
</code></pre>
<p>So it's clear that the alert is visible to XCTest, but nothing inside it. As you can tell from my added code I've been trying all sorts of things but so far I've not been able to make the <code>UILabel</code> (AlertBarMessage) visible.</p>
<p>What am I missing?</p>
",https://stackoverflow.com/questions/68915767/ios-ui-testing-cannot-see-the-uilabel,"['xctest', 'xcode-ui-testing']",645,True,2,1
How to add a required protocol property to an extension?,"<p>I'm trying to make a class conform to a protocol by extending that class. In my case I'd like to conform <code>SKNode</code> to <code>UIAccessibilityIdentification</code>.</p>
<p><code>UIAccessibilityIdentification</code> has only one requirement, that is the property <code>accessibilityIdentifier</code>, which is an optional string. XCode automatically suggests me the following stub with a setter and getter.</p>
<pre><code>public var accessibilityIdentifier: String? {
    get {
        //code
    }
    set(accessibilityIdentifier) {
        //code
    }
}
</code></pre>
<p><strong>My question:</strong></p>
<p>How do I implement the getter and setter correctly to make it work? (Subclassing is not an option as I need to use this on several built-in subclasses of <code>SKNode</code>)</p>
<p>At the moment I'm using the following setup which assigns the <code>accessibilityLabel</code> of the <code>SKNode</code> superclass to the <code>accessibilityIdentifier</code> and it works fine for the moment as I'm only UI testing and I don't use voiceover for the user yet. However this might change in the future. So a proper, direct implementation would be better.</p>
<p><strong>My current extension:</strong></p>
<pre><code>import SpriteKit

extension SKNode: UIAccessibilityIdentification {
    
    public var accessibilityIdentifier: String? {
        get {
            super.accessibilityLabel
        }
        set {
            super.accessibilityLabel = newValue
        }
    }
}
</code></pre>
",https://stackoverflow.com/questions/66109867/how-to-add-a-required-protocol-property-to-an-extension,"['swift', 'getter-setter', 'swift-protocols', 'uiaccessibility', 'class-extensions']",146,False,0,0
Write test cases to test enum-based analytics system dynamically using XCTest,"<p>I just started writing tests using XCTest, I have to write test cases to test if the right analytics event is passed, the analytics system has enum based events something like this.</p>
<pre><code>enum AnalyticsEvent {
    case loginScreenViewed
    case loginAttempted
    case loginFailed(reason: LoginFailureReason)
}
</code></pre>
<p><strong>Analytics Engine</strong></p>
<pre><code>protocol AnalyticsEngine: class {
    func sendAnalyticsEvent(named name: String, metadata: [String : String])
}
</code></pre>
<p><strong>Implementation</strong></p>
<pre><code>class AnalyticsManager {
    private let engine: AnalyticsEngine

    init(engine: AnalyticsEngine) {
        self.engine = engine
    }

    func log(_ event: AnalyticsEvent) {
        engine.sendAnalyticsEvent(named: event.name, metadata: event.metadata)
    }
}
</code></pre>
<pre><code>class someViewModel{
    private let analytics: AnalyticsManager!

    func viewLoaded() {
        analytics.screenView(name: .loginScreenViewed)
    }
}
</code></pre>
<pre><code>class someViewController {
    private var viewModel : someViewModel?
    
    func viewDidLoad(){
       //fires an event
       viewModel.viewDidLoad() 
    } 
</code></pre>
<p>I checked a few articles which mentioned I have a mock class and store the event fired in an event queue array and assert the event against the array.</p>
<p>A basic assertion would be as follows (here eventQueue is an array where we are storing our mock events)</p>
<pre><code>let event = try XCTUnwrap(analytics.eventQueue.first)
XCTAssertEqual(event.key,AnalyticsEvent.loginScreenViewed)
</code></pre>
<p>I would like to understand is there a way to standardize this kind of assertion, how do I dynamically check which analytics event the mock event has to be asserted against and if the respective properties are set for the event and also how to go about UI testing for the same.</p>
",https://stackoverflow.com/questions/68302209/write-test-cases-to-test-enum-based-analytics-system-dynamically-using-xctest,"['swift', 'unit-testing', 'analytics', 'xctest', 'ui-testing']",539,False,0,1
bundling a small task to make all dependencies available in puppeteer?,"<p>I have been personally using puppeteer for a lot of deployment and UI testing tasks.</p>
<p>But the issue I face now is that the more supporting code I have the harder to make it available directly in the browser.</p>
<p>What I usually do is that I place all the code I will use in the browser in a single file, encode the whole module as text, make it available to the browser and use a dynamic import in the browser. You see where I am getting, hopefully...</p>
<p>If I try to add 3rd party libs then this whole setup falls apart because I can't make all dependencies available in a single file.</p>
<p>Question is: Anyone has used any patterns for that? Is bundling an option here? any examples? Thanks a lot...</p>
",https://stackoverflow.com/questions/68757696/bundling-a-small-task-to-make-all-dependencies-available-in-puppeteer,"['javascript', 'webpack', 'babeljs', 'puppeteer']",84,True,0,1
UI Testing Viewpager with NavGraphViewModel using Espresso,"<p>I currently have an app which uses a One Activity-Many Fragment approach, and within this app is a fragment which shares significant data with its children, and so I have used navGraphViewModels scoped to a nested nav graph as so:</p>
<pre><code>private val viewModel by navGraphViewModels&lt;MySharedViewModel&gt;(R.id.nested_nav_graph)
</code></pre>
<p>The parent fragment contains a viewPager, and the fragments passed to that viewPager all share the same viewModel as the parent.
My issue with using this approach is that when it comes to UI testing involving navGraphViewModels using Espresso, I was getting the error &quot;View XXX does not have a NavController set.&quot; I managed to fix this for the <strong>parent</strong> fragment with the below:</p>
<pre><code>        val navController = TestNavHostController(ApplicationProvider.getApplicationContext())
        // This allows fragments to use by navGraphViewModels()
        navController.setViewModelStore(ViewModelStore())
        UiThreadStatement.runOnUiThread {
            navController.setGraph(R.navigation.nested_nav_graph)
        }
        val scenario =
            launchFragmentInContainer(themeResId = R.style.AppTheme) {
                MyFragment().also { fragment -&gt;
                    fragment.viewLifecycleOwnerLiveData.observeForever { viewLifecycleOwner -&gt;
                        if (viewLifecycleOwner != null) {
                            Navigation.setViewNavController(fragment.requireView(), navController)
                        }
                    }
                }
            }
        return navController
    }
</code></pre>
<p>However, as the parent fragment then loads its child fragments into the viewPager and these also require a NavController, my tests don't proceed past the @Before block. Any help regarding how to set the navController to the child fragment would be appreciated.</p>
",https://stackoverflow.com/questions/67521121/ui-testing-viewpager-with-navgraphviewmodel-using-espresso,"['android', 'android-fragments', 'android-viewpager', 'android-espresso', 'android-navigation']",177,False,6,0
How do you create a global configuration for Playwright .NET?,"<p>I am planning to use Playwright .NET to perform automated UI testing in a C# dotnet project.  The issue is that I would like to have global configuration that can be set rather than needing to define the same settings repeatedly in the context of each test, but I cannot seem to find any working examples.</p>
<p>The documentation at <a href=""https://playwright.dev/dotnet/docs/test-configuration/"" rel=""nofollow noreferrer"">playwright.dev</a> implies that I should be able to simply include a &quot;playwright.config.js&quot; file at the root of the project, but no clear definition of what the content of that file should be. I have experimented with the example provided for Playwright Node.js, using:</p>
<pre><code>import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
    use: {
        // Browser options
        headless: false,
        slowMo: 50,

        // Context options
        viewport: { width: 1280, height: 720 },
        ignoreHTTPSErrors: true,

        // Artifacts
        screenshot: 'only-on-failure',
        //video: 'retry-with-video',
  },
  outputDir: &quot;C:\\stuff\\screenshots&quot;,
  preserverOutput: 'always',
  quiet: false,

};
export default config;
</code></pre>
<p>However, these settings do not seem to be applied and there is no indication that the playwright.config.js file is either loading or failing.</p>
<p>Any help or a simple example to get me pointed in the right direction would be much appreciated.</p>
",https://stackoverflow.com/questions/68169501/how-do-you-create-a-global-configuration-for-playwright-net,"['c#', '.net', 'configuration', 'playwright', 'playwright-sharp']",1967,True,1,1
How to do basic testing in a SwiftUI project?,"<p>I have this super basic app which changes the colour of a circle when you press a button:</p>
<pre><code>struct ContentView: View {
    @State private var color: Color = .red
    
    var body: some View {
        VStack {
            Circle()
                .frame(width: 100, height: 100)
                .foregroundColor(color)
            
            Button(&quot;Press me&quot;) {
                color = color == .red ? .blue : .red
            }
        }
    }
}
</code></pre>
<p>All I want to do is write a test which checks if the button appropriately changes the colour of the circle.</p>
<p>I only just read about all the unit testing and UI testing capabilities of Xcode but am unsure how to go about this. From the resources I've read online they all recommend either Snapshot Testing or using a package called <code>ViewInspector</code>. However I just want to play around with the inbuilt capabilities of Xcode and am not looking for any rigorous testing frameworks or methods. Could someone tell me how Apple recommends to test SwiftUI Views? If there's no official/recommended way can someone tell me how to write a unit/UI test to check if the circle's colour changed appropriately.</p>
<p>Thanks in advance!</p>
",https://stackoverflow.com/questions/68291370/how-to-do-basic-testing-in-a-swiftui-project,"['ios', 'swift', 'testing', 'swiftui', 'xctest']",723,True,0,1
call test intent before activity&#39;s onCreate() - Espresso,"<p>I am calling intent to open the gallery in Activity's onCreate()</p>
<p>this method is called in onCreate()</p>
<pre><code> @SuppressLint(&quot;IntentReset&quot;)
    private void requestForPickImage() {
        Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        i.setType(&quot;image/*&quot;);
        startActivityForResult(i, SELECT_PICTURE_REQUEST_CODE);
        Log.e(&quot;---&quot;, &quot;test_selectImageForOcr: 2&quot; );
    }
</code></pre>
<p>this is my Test Class</p>
<pre><code>@RunWith(AndroidJUnit4.class)
@LargeTest
public class F_SelectImageForOcrActivityUnitTest {

    @Rule
    public GrantPermissionRule permissionRule =
            GrantPermissionRule.grant(android.Manifest.permission.READ_EXTERNAL_STORAGE,
                    android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
    @Rule
    public IntentsTestRule&lt;SelectImageToOcrActivity&gt; mActivity =
            new IntentsTestRule&lt;SelectImageToOcrActivity&gt;(SelectImageToOcrActivity.class, true, true) {
                @Override
                protected void beforeActivityLaunched() {
                    super.beforeActivityLaunched();
                    Intents.init();
                    Log.e(&quot;---&quot;, &quot;test_selectImageForOcr: before1&quot;);
                    test_selectImageForOcr();
                    Log.e(&quot;---&quot;, &quot;test_selectImageForOcr: before2&quot;);
                }

                @Override
                protected void afterActivityFinished() {
                    Log.e(&quot;---&quot;, &quot;test_selectImageForOcr: 3&quot;);
                    intended(expectedIntent);
                    Log.e(&quot;---&quot;, &quot;test_selectImageForOcr: 4&quot;);
                    Intents.release();
                    super.afterActivityFinished();
                }
            };
    private Matcher&lt;Intent&gt; expectedIntent;

    @Before
    public void init() {

    }

    public void test_selectImageForOcr() {
        expectedIntent = AllOf.allOf(
                hasAction(Intent.ACTION_PICK),
                hasData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI),
                hasType(&quot;image/*&quot;)
        );

        ActivityResult picker = createPicker();
        Log.e(&quot;---&quot;, &quot;test_selectImageForOcr: 1&quot;);
        intending(expectedIntent).respondWith(picker);
    }

    @Test
    public void testStart() {
        Espresso.onView(ViewMatchers.withId(R.id.btn_scan)).check(matches(isDisplayed())).perform(ViewActions.click());
    }

    private ActivityResult createPicker() {
        Resources resources = ApplicationProvider.getApplicationContext().getResources();
        Uri imageUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + &quot;://&quot; +
                resources.getResourcePackageName(R.mipmap.ic_launcher) + '/' +
                resources.getResourceTypeName(R.mipmap.ic_launcher) + '/' +
                resources.getResourceEntryName(R.mipmap.ic_launcher));

        Intent resultData = new Intent();
        resultData.setData(imageUri);
        resultData.setType(&quot;image/*&quot;);

        return new ActivityResult(
                Activity.RESULT_OK, resultData);

    }
}
</code></pre>
<p>here is the log I get in logCat</p>
<pre><code>E/---: test_selectImageForOcr: before1
E/---: test_selectImageForOcr: 1
E/---: test_selectImageForOcr: before2
E/---: test_selectImageForOcr: 2
E/---: test_selectImageForOcr: 3
</code></pre>
<p>I would like to launch an activity because I have another UI testing in this activity after picking an image. So keep <code>launchActivity</code> to true</p>
<p>But I am getting this exception</p>
<pre><code>junit.framework.AssertionFailedError: Wanted to match 1 intents. Actually matched 0 intents.

IntentMatcher: (has action: is &quot;android.intent.action.PICK&quot; and has data: is &lt;content://media/external/images/media&gt; and has type: is &quot;image/*&quot;)

Matched intents:[]

Recorded intents:
-Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.my.app/com.my.app.camera.SelectImageToOcrActivity } handling packages:[[com.my.app]])
-Intent { act=android.intent.action.PICK typ=image/* } handling packages:[[com.google.android.apps.photos]])
    at junit.framework.Assert.fail(Assert.java:50)
    at androidx.test.espresso.intent.VerificationModes$Times.verify(VerificationModes.java:80)
    at androidx.test.espresso.intent.Intents.internalIntended(Intents.java:348)
    at androidx.test.espresso.intent.Intents$3.run(Intents.java:206)
    at androidx.test.espresso.intent.Intents$PropogatingRunnable.run(Intents.java:226)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2223)
    at android.os.Handler.handleCallback(Handler.java:907)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7478)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
</code></pre>
<p>What I tried:</p>
<ol>
<li>I tried to make it a separate test</li>
<li>I tried to call <code>test_selectImageForOcr</code> in <code>@Before</code> method but getting the same error</li>
</ol>
<p>Also, I need to close the image picker after test success. Any help is appreciated.</p>
<hr />
<p><strong>Edit</strong></p>
<p>I found why this is happening</p>
<p>when i set <code>setType(&quot;image/*&quot;);</code> in the intent that time I am getting this issue. if I remove this type than the test get passed and also image picker get closed. Is there any solution on this issue?</p>
",https://stackoverflow.com/questions/65595417/call-test-intent-before-activitys-oncreate-espresso,"['android', 'android-intent', 'android-espresso', 'android-intent-chooser']",153,True,0,1
java:package org.openqa.selenium.html5 does not exist,"<p>I'm using selenium for UI testing in java.
I have a module cloned from git hub which is being used in my project.
In spite of having the latest jar dependencies in my build.gradle file(intelliJ), I'm encountering</p>
<blockquote>
<p>package org.openqa.selenium.html5 not found error</p>
</blockquote>
<p>Only during <strong>runtime</strong>.</p>
<p>The selenium dependency  does not complain at compile time, but during run time I am having errors that say</p>
<blockquote>
<p>java:package org.openqa.selenium.logging does not exist</p>
<p>java:package org.openqa.selenium.remote does not exist</p>
<p>java:package org.openqa.selenium.support.ui does not exist</p>
<p>java:package org.openqa.selenium does not exist</p>
</blockquote>
<p>I try clearing my gradle cache and re-installing the jars with the latest versions, and yet it's still the same issue.</p>
<p>These are the dependencies I have for selenium in my project:</p>
<pre><code>implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0-alpha-2'
   
implementation group: 'org.seleniumhq.selenium', name: 'selenium-server', version: '4.0.0-alpha-2'
   
implementation group: 'org.seleniumhq.selenium', name: 'selenium-api', version: '4.0.0-alpha-2'
   
implementation group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '4.0.0-alpha-2'
   
implementation group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '4.0.0-alpha-2'
   
implementation group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: '4.0.0-alpha-2'
</code></pre>
<p>I also tried with different versions of selenium, but nothing works.
Any solutions that I could try to fix this issue.
Or am I missing something?</p>
",https://stackoverflow.com/questions/68115900/javapackage-org-openqa-selenium-html5-does-not-exist,"['java', 'selenium', 'selenium-webdriver', 'automated-tests']",263,False,0,0
How do I keep the browser open on a failed test using Selenium+Nightwatch+Chromedriver?,"<p>I'm using Nightwatch, Selenium, and Chrome Driver to conduct automated UI testing.  Sometimes there are test failures on any number of remote environments.  To debug the failures locally, I would like to keep the browser open on test failure.</p>
<p>I used to be able to do this using config settings in nightwatch.json and nightwatch.conf.js, but I lost my config settings cheat-sheet in a hard drive failure, and despite my best efforts on google I can't seem to find the right combination again.</p>
<p>If I remember correctly, it wasn't any kind of <code>keepBrowserOpen: true</code> type flag.  If memory serves, it was some type of timeout set to a silly high number combined with something else like detachDriver.  I've checked the Selenium documentation with specific focus on the <a href=""https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Options.html"" rel=""nofollow noreferrer"">Chrome Driver Options</a>, and the list of <a href=""https://peter.sh/experiments/chromium-command-line-switches/"" rel=""nofollow noreferrer"">Chrome Driver options</a>, but I haven't found any working combinations.</p>
<p>What am I missing?</p>
<p>Here is my nightwatch.json</p>
<pre><code>{
    &quot;output_folder&quot;: &quot;tests/automation/reports&quot;,
    &quot;end_session_on_fail&quot;: false,
    &quot;test_settings&quot;: {
        &quot;default&quot;: {
            &quot;selenium_port&quot;: 4444,
            &quot;screenshots&quot;: {
                &quot;enabled&quot;: true,
                &quot;path&quot;: &quot;tests/automation/reports/screenshots&quot;
            },
            &quot;javascriptEnabled&quot;: true,
            &quot;acceptSslCerts&quot;: true,
            &quot;acceptInsecureCerts&quot;: true,
            &quot;globals&quot;: {
                &quot;waitForConditionTimeout&quot;: 10000
            }
        },
        &quot;chrome&quot;: {
            &quot;extends&quot;: &quot;default&quot;,
            &quot;desiredCapabilities&quot;: {
                &quot;browserName&quot;: &quot;chrome&quot;,
                &quot;javascriptEnabled&quot;: true,
                &quot;acceptSslCerts&quot;: true,
                &quot;acceptInsecureCerts&quot;: true,
                &quot;chromeOptions&quot;: {
                    &quot;args&quot;: [
                        &quot;--no-sandbox&quot;,
                        &quot;--disable-gpu&quot;
                    ]
                }
            }
        }
    }
}
</code></pre>
<p>And my nightwatch.conf.js</p>
<pre><code>const geckoDriver = require('geckodriver');
const chromeDriver = require('chromedriver');
const seleniumServer = require('selenium-server');

module.exports = (function (settings) {
    settings.selenium = {
        start_process: true,
        server_path: seleniumServer.path,
        log_path: 'tests/automation/reports/',
        host: 'localhost',
        port: 4444,
        cli_args: {
            'webdriver.chrome.driver': chromeDriver.path,
            'webdriver.gecko.driver': geckoDriver.path,
            'webdriver.edge.driver': 'C:\\windows\\system32\\MicrosoftWebDriver.exe',
            'webdriver.port': '4444'
        }
    };

    return settings;
})(require('./nightwatch.json'));
</code></pre>
<p>Selenium Version is 2.35.1</p>
",https://stackoverflow.com/questions/67492302/how-do-i-keep-the-browser-open-on-a-failed-test-using-seleniumnightwatchchrome,"['selenium', 'selenium-webdriver', 'selenium-chromedriver', 'nightwatch.js']",478,True,0,1
How do I create a BaseTest class for pytest,"<p>I am trying to create a class that will be inherited by all my other test classes. I seem to have a misunderstanding on how to go about it because when I try and run pytest it cant find my tests and throws an Empty suite error.</p>
<p>This is what I have now. Note this is for web ui testing using Selenium</p>
<p>base_test.py:</p>
<pre><code>@pytest.mark.usefixtures('chrome_driver_init')
class BaseTest:
        def __init__(self):
                self.login_page = LoginPage(self.driver)
                self.home_page = HomePage(self.driver)
                self.details_page = DetailsPage(self.driver)
</code></pre>
<p>I just want this to create instances of my Web Page Objects to be used by my Test Classes</p>
<p>test_login.py</p>
<pre><code>class TestLogin(BaseTest):
    def test_login(self):
        self.login_page.login()
        assert 'Login Succesfull' in self.home_page.welcome_text()
</code></pre>
<p><code>welcome_text()</code> is a simple method that finds a web element and returns its text</p>
<p>and finally just to be through my conftest.py:</p>
<pre><code>@pytest.fixture()
def chrome_driver_init(request):
    driver = webdriver.Chrome(options=opts, executable_path=ChromeDriverManager(path=TEST_PATH).install())
    request.cls.driver = driver
    driver.get(URL)
    driver.maximize_window()
    yield
    driver.quit()
</code></pre>
<p>I have a feelin that my BaseTest needs to inherit some pytest class and call <code>super().__init__()</code> but I cant find any documentaion or answers on the web to what that class would be.</p>
<p>Any ideas on how to implement this?</p>
<p>EDIT: As MrBean Suggested, I added self. to my page objects in BaseTest. Still get the same result though</p>
",https://stackoverflow.com/questions/68776978/how-do-i-create-a-basetest-class-for-pytest,"['python', 'selenium', 'selenium-webdriver', 'automated-tests', 'pytest']",1969,True,0,2
Android: How to perform click action on EditTextPreference using Espresso,"<p>I am new at UI testing, especially using Espresso. In my use case, i need to check the if the app accepts the input text on a <code>EditTextPreference</code> that's inside a <code>PreferenceScreen</code> fragment, but before doing so i need to perform a click so that the edit dialog appears and then enter the text.</p>
<p>This is how the preference fragment has the edit widgets:</p>
<pre><code>&lt;PreferenceScreen xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;

    &lt;EditTextPreference
        android:key=&quot;@string/pref_stream_target_key&quot;
        android:title=&quot;@string/pref_stream_target_label&quot;
        app:useSimpleSummaryProvider=&quot;true&quot; /&gt;

    &lt;EditTextPreference
        android:key=&quot;@string/pref_stream_resolution_key&quot;
        android:title=&quot;@string/pref_stream_resolution_label&quot;
        app:useSimpleSummaryProvider=&quot;true&quot; /&gt;

    &lt;EditTextPreference
        android:key=&quot;@string/pref_stream_bitrate_key&quot;
        android:title=&quot;@string/pref_stream_bitrate_label&quot;
        app:useSimpleSummaryProvider=&quot;true&quot; /&gt;

    &lt;EditTextPreference
        android:key=&quot;@string/pref_stream_framerate_key&quot;
        android:title=&quot;@string/pref_stream_framerate_label&quot;
        app:useSimpleSummaryProvider=&quot;true&quot; /&gt;

    &lt;EditTextPreference
        android:key=&quot;@string/pref_stream_peerlatency_key&quot;
        android:title=&quot;@string/pref_stream_peerlatency_label&quot;
        app:useSimpleSummaryProvider=&quot;true&quot; /&gt;

&lt;/PreferenceScreen&gt;
</code></pre>
<p>And this is how i've tried to perform the click</p>
<pre><code>with(launchFragmentInContainer&lt;StreamSettingsFragment&gt;()) {
    onFragment { fragment -&gt;
        Espresso.onData(PreferenceMatchers.withTitle(R.string.pref_stream_target_label))
            .perform(ViewActions.click())
    }
}
</code></pre>
<p>I am not sure if the action of making the click is necessary in order to check the logic behind the change listener that's in the <code>EditTextPreference</code>.</p>
<p>Running the test with this will just keep the app running and do nothing. Is there something i am missing?</p>
<p><strong>EDIT:</strong> The solution for making espresso work without doing nothing was to take the code out of the <code>onFragment</code> block, however i am still not able to perform an action to the <code>EditTextPreference</code> widget.</p>
<p>This is the error being thrown:</p>
<pre><code>androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: is assignable from class &lt;class android.widget.AdapterView&gt;

View Hierarchy:
+&gt;DecorView{id=-1, visibility=VISIBLE, width=1080, height=2218, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) ty=BASE_APPLICATION hwFlags=#10 isEmuiStyle=0 statusBarColor=#ff000000 navigationBarColor=#fffcfcfc wanim=0x1030001
  fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} 
|
+-&gt;ActionBarOverlayLayout{id=16908903, res-name=decor_content_parent, visibility=VISIBLE, width=1080, height=2218, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@aa563f7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} 
|
+--&gt;FrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=1080, height=1966, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=com.android.internal.widget.ActionBarOverlayLayout$LayoutParams@4eb0264, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=252.0, child-count=1} 
|
+---&gt;LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1966, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@2f83982, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} 
|
+----&gt;FrameLayout{id=16908351, res-name=list_container, visibility=VISIBLE, width=1080, height=1966, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@1c24893, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} 
|
+-----&gt;RecyclerView{id=2131296596, res-name=recycler_view, visibility=VISIBLE, width=1080, height=1966, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@687e0d0, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=5} 
|
+------&gt;LinearLayout{id=0, visibility=VISIBLE, width=1080, height=241, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@2746bce, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} 
|
+-------&gt;LinearLayout{id=2131296469, res-name=icon_frame, visibility=INVISIBLE, width=168, height=24, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@3bedaef, tag=null, root-is-layout-requested=false, has-input-connection=false, x=18.0, y=108.0, child-count=1} 
|
+--------&gt;PreferenceImageView{id=16908294, res-name=icon, visibility=INVISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@2d239fc, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=12.0} 
|
+-------&gt;RelativeLayout{id=-1, visibility=VISIBLE, width=876, height=241, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@615a885, tag=null, root-is-layout-requested=false, has-input-connection=false, x=186.0, y=0.0, child-count=2} 
|
+--------&gt;TextView{id=16908310, res-name=title, visibility=VISIBLE, width=400, height=88, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@c6f76da, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=48.0, text=Stream target, input-type=0, ime-target=false, has-links=false} 
|
+--------&gt;TextView{id=16908304, res-name=summary, visibility=VISIBLE, width=136, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@848370b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=136.0, text=Not set, input-type=0, ime-target=false, has-links=false} 
|
+-------&gt;LinearLayout{id=16908312, res-name=widget_frame, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@506f9e8, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+------&gt;LinearLayout{id=0, visibility=VISIBLE, width=1080, height=241, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@ade26a6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=241.0, child-count=3} 
|
+-------&gt;LinearLayout{id=2131296469, res-name=icon_frame, visibility=INVISIBLE, width=168, height=24, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@ac138e7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=18.0, y=108.0, child-count=1} 
|
+--------&gt;PreferenceImageView{id=16908294, res-name=icon, visibility=INVISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@d45cc94, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=12.0} 
|
+-------&gt;RelativeLayout{id=-1, visibility=VISIBLE, width=876, height=241, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@985633d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=186.0, y=0.0, child-count=2} 
|
+--------&gt;TextView{id=16908310, res-name=title, visibility=VISIBLE, width=539, height=88, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@360732, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=48.0, text=Stream Resolution, input-type=0, ime-target=false, has-links=false} 
|
+--------&gt;TextView{id=16908304, res-name=summary, visibility=VISIBLE, width=136, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@fde7c83, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=136.0, text=Not set, input-type=0, ime-target=false, has-links=false} 
|
+-------&gt;LinearLayout{id=16908312, res-name=widget_frame, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@bfd1e00, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+------&gt;LinearLayout{id=0, visibility=VISIBLE, width=1080, height=241, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@eb9647e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=482.0, child-count=3} 
|
+-------&gt;LinearLayout{id=2131296469, res-name=icon_frame, visibility=INVISIBLE, width=168, height=24, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@9025ddf, tag=null, root-is-layout-requested=false, has-input-connection=false, x=18.0, y=108.0, child-count=1} 
|
+--------&gt;PreferenceImageView{id=16908294, res-name=icon, visibility=INVISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@8161a2c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=12.0} 
|
+-------&gt;RelativeLayout{id=-1, visibility=VISIBLE, width=876, height=241, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@76abcf5, tag=null, root-is-layout-requested=false, has-input-connection=false, x=186.0, y=0.0, child-count=2} 
|
+--------&gt;TextView{id=16908310, res-name=title, visibility=VISIBLE, width=420, height=88, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@8834a8a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=48.0, text=Stream Bitrate, input-type=0, ime-target=false, has-links=false} 
|
+--------&gt;TextView{id=16908304, res-name=summary, visibility=VISIBLE, width=136, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@158f8fb, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=136.0, text=Not set, input-type=0, ime-target=false, has-links=false} 
|
+-------&gt;LinearLayout{id=16908312, res-name=widget_frame, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@be0ad18, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+------&gt;LinearLayout{id=0, visibility=VISIBLE, width=1080, height=241, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@4538556, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=723.0, child-count=3} 
|
+-------&gt;LinearLayout{id=2131296469, res-name=icon_frame, visibility=INVISIBLE, width=168, height=24, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@b429d7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=18.0, y=108.0, child-count=1} 
|
+--------&gt;PreferenceImageView{id=16908294, res-name=icon, visibility=INVISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4bf82c4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=12.0} 
|
+-------&gt;RelativeLayout{id=-1, visibility=VISIBLE, width=876, height=241, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@6fa95ad, tag=null, root-is-layout-requested=false, has-input-connection=false, x=186.0, y=0.0, child-count=2} 
|
+--------&gt;TextView{id=16908310, res-name=title, visibility=VISIBLE, width=514, height=88, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@31aa0e2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=48.0, text=Stream framerate, input-type=0, ime-target=false, has-links=false} 
|
+--------&gt;TextView{id=16908304, res-name=summary, visibility=VISIBLE, width=136, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@278c73, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=136.0, text=Not set, input-type=0, ime-target=false, has-links=false} 
|
+-------&gt;LinearLayout{id=16908312, res-name=widget_frame, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@1940730, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+------&gt;LinearLayout{id=0, visibility=VISIBLE, width=1080, height=241, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@245e92e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=964.0, child-count=3} 
|
+-------&gt;LinearLayout{id=2131296469, res-name=icon_frame, visibility=INVISIBLE, width=168, height=24, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@c647ccf, tag=null, root-is-layout-requested=false, has-input-connection=false, x=18.0, y=108.0, child-count=1} 
|
+--------&gt;PreferenceImageView{id=16908294, res-name=icon, visibility=INVISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@bea665c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=12.0} 
|
+-------&gt;RelativeLayout{id=-1, visibility=VISIBLE, width=876, height=241, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@525cd65, tag=null, root-is-layout-requested=false, has-input-connection=false, x=186.0, y=0.0, child-count=2} 
|
+--------&gt;TextView{id=16908310, res-name=title, visibility=VISIBLE, width=761, height=88, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@6cb6a3a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=48.0, text=Stream peer latency (SRT), input-type=0, ime-target=false, has-links=false} 
|
+--------&gt;TextView{id=16908304, res-name=summary, visibility=VISIBLE, width=136, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@1d616eb, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=136.0, text=Not set, input-type=0, ime-target=false, has-links=false} 
|
+-------&gt;LinearLayout{id=16908312, res-name=widget_frame, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@7e58c48, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+----&gt;TextView{id=16908292, res-name=empty, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@52adae1, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=, input-type=0, ime-target=false, has-links=false} 
|
+--&gt;ActionBarContainer{id=16908719, res-name=action_bar_container, visibility=VISIBLE, width=1080, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=com.android.internal.widget.ActionBarOverlayLayout$LayoutParams@e7d36c7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=108.0, child-count=2} 
|
+---&gt;ActionBarView{id=16908718, res-name=action_bar, visibility=VISIBLE, width=1080, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@6eb24f4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} 
|
+----&gt;LinearLayout{id=-1, visibility=VISIBLE, width=620, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=false, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.app.ActionBar$LayoutParams@19441d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=24.0, y=0.0, child-count=2} 
|
+-----&gt;HomeView{id=-1, visibility=VISIBLE, width=120, height=144, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@8f10692, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} 
|
+------&gt;ImageView{id=16909572, res-name=up, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@58c7863, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
+------&gt;ImageView{id=16908332, res-name=home, visibility=VISIBLE, width=96, height=96, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@90f9c60, tag=null, root-is-layout-requested=false, has-input-connection=false, x=12.0, y=24.0} 
|
+-----&gt;LinearLayout{id=-1, visibility=VISIBLE, width=500, height=73, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@414f9de, tag=null, root-is-layout-requested=false, has-input-connection=false, x=120.0, y=35.0, child-count=2} 
|
+------&gt;TextView{id=16908722, res-name=action_bar_title, visibility=VISIBLE, width=476, height=73, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@c437bf, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Genius Live Camera, input-type=0, ime-target=false, has-links=false} 
|
+------&gt;TextView{id=16908721, res-name=action_bar_subtitle, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@9421e8c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=, input-type=0, ime-target=false, has-links=false} 
|
+----&gt;ActionMenuView{id=-1, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@2bdd9d5, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1080.0, y=72.0, child-count=0} 
|
+---&gt;ActionBarContextView{id=16908723, res-name=action_context_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@2f2d5ea, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+--&gt;ActionBarContainer{id=16909433, res-name=split_action_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=com.android.internal.widget.ActionBarOverlayLayout$LayoutParams@b8e90db, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
    at dalvik.system.VMStack.getThreadStackTrace(Native Method)
    at java.lang.Thread.getStackTrace(Thread.java:1730)
    at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:12)
    at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:7)
    at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:8)
    at androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:11)
    at androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:4)
    at androidx.test.espresso.DataInteraction$DisplayDataMatcher$1.apply(DataInteraction.java:1)
    at androidx.test.espresso.DataInteraction$DisplayDataMatcher$1.apply(DataInteraction.java:2)
    at androidx.test.espresso.DataInteraction$DisplayDataMatcher.&lt;init&gt;(DataInteraction.java:7)
    at androidx.test.espresso.DataInteraction$DisplayDataMatcher.&lt;init&gt;(DataInteraction.java:13)
    at androidx.test.espresso.DataInteraction$DisplayDataMatcher.displayDataMatcher(DataInteraction.java:1)
    at androidx.test.espresso.DataInteraction.makeTargetMatcher(DataInteraction.java:2)
    at androidx.test.espresso.DataInteraction.perform(DataInteraction.java:1)
    at com.domain.division.app.fragment.StreamSettingsFragmentTest.validTarget(StreamSettingsFragmentTest.kt:27)
</code></pre>
",https://stackoverflow.com/questions/70102760/android-how-to-perform-click-action-on-edittextpreference-using-espresso,"['android', 'testing', 'android-espresso', 'android-instrumentation']",411,True,0,1
How to conduct User Interface Testing and Instrumented Unit Testing on an Android Service with visible layout - specifically a floating widget?,"<p>Basically the question.</p>
<p>I'm currently trying to test a floating widget service that looks like the Messenger Bubble head. I have read the documentation on Expresso UI testing, however, the case I'm dealing with is a bit complicated.</p>
<p>Considering that the floating widget is an Android Service, it is not an Activity and hence cannot use ActivityScenario to test. While so, as the service utilizes a view, I need to conduct UI test on it. How do I test the floating widget using Expresso? I have imported and added all required dependencies to the gradle files, the problem is now the direction to test.</p>
<p>To specify further, what I wish to test include:</p>
<ol>
<li>The floating widget service view is visible on the user screen</li>
<li>Clicking the floating widget will open another expanded view for the user to choose different buttons on. Thereon I will test the button clicking.</li>
<li>Test whether the floating widget service destroys itself (via stopService) on calling it</li>
<li>Other minor test (movement, touch, click, background, auto-alignment)</li>
</ol>
",https://stackoverflow.com/questions/68422655/how-to-conduct-user-interface-testing-and-instrumented-unit-testing-on-an-androi,"['android-studio', 'user-interface', 'junit', 'android-testing', 'expresso']",39,False,1,0
Long live for a selenium script?,"<p>Let's say I have a webpage that I need to have some selenium script to automate the UI testing. This page has a list of sections, in the order of &quot;Section A&quot;, &quot;Section B&quot;, &quot;Section C&quot;, etc. Here is my piece of code to automate the steps on &quot;Section B&quot; area testing.</p>
<pre><code>  by = By.CSS_SELECTOR
  dropdown_in_SectionB = &quot;#app &gt; div.app &gt; div &gt; div &gt; div.content &gt; div:nth-child(2) &gt; div &gt; div:nth-child(7) &gt; ...&quot;
  WebDriverWait(self.driver, 20).until(EC.presence_of_element_located((by, target))).click()
</code></pre>
<p>Unfortunately, I can not find a XPATH value for this &quot;drowdown_in_SectionB&quot; area, and I have to use css_selector value here. And it works ok for this second.</p>
<p>But later on, this page has been updated, the updated page now contains &quot;Section A&quot;, &quot;SectionX&quot;, &quot;Section B&quot;, &quot;Section C&quot;, in such order. And my above script is broken, as the css_selector value of drowpdown_in_Section becomes:</p>
<pre><code>  dropdown_in_SectionB = #app &gt; div.app &gt; div &gt; div &gt; div.content &gt; div:nth-child(2) &gt; div &gt; div:nth-child(8) &gt; ...&quot;
</code></pre>
<p>So I have to update the script to have it back to working, which is annoyed.</p>
<p>My question is how may I find a way that the script is smart enough to locate the location in its &quot;css_selector&quot; value, however the change is ?</p>
<p>If it was of XPATH value, I can easily have it solved, as I have other clues to trace the dropdown area in Section, but how this can be done in case of css_selector value ???</p>
<p>Thanks,</p>
<p>Jack</p>
",https://stackoverflow.com/questions/70310244/long-live-for-a-selenium-script,"['selenium', 'selenium-webdriver']",36,False,0,0
E2E Test Automation workflow with GitLab CI/CD,"<p>I am to build a test automation system for E2E testing for a company. The product is React/Node.JS based runs in a cloud (Docker &amp; Kubernetes). The code is stored in GitLab repositories for which there are CI/CD pipelines setup for test/lint/deployment.</p>
<p>I plan to use Jest for test orchestration and Selenium / Appium for the UI testing (FRW being in TypeScript), while creating a generator to test our proprietary backend interface.
My code is in a similar repository and will be containerized and uploaded to the test environment.</p>
<p>In my former workplaces we used TeamCity and similar tools to manage test sessions but I do not seem to be able to find the perfect link between our already set up GitLab CI/CD and the E2E testing framework.</p>
<p>I know it could be implemented as part of the pipeline, but for me it seems lacking (which can also be because of my inexperience)</p>
<p>Could you advise some tools/methods for handling test session management for system testing in such an environment?
(with a GUI where I can see the progress of all sessions, being able to manage them, run / rerun / run on certain platforms only, etc)</p>
",https://stackoverflow.com/questions/65657061/e2e-test-automation-workflow-with-gitlab-ci-cd,"['testing', 'automated-tests', 'gitlab-ci', 'e2e-testing', 'system-testing']",518,False,2,0
"Espresso UI Testing, Cannot check loading state, How to test UI with live data and view model?","<p>Currently i am implementation UI test/ Instrumentation Test with Espresso, to test FragmentMovie at loading state, and success state. Due to multiple test library and other stuff,my test Instrumentation must contains hilt ijection.</p>
<p>UI testing scenario :</p>
<ol>
<li>When loading state, Check my loading progressbar and text loading is displayed</li>
<li>When succes state, hide loading, and show recycle view</li>
<li>Done</li>
</ol>
<h1>Problem</h1>
<p><code>Loading state</code> is skiped when running test. <code>@Test</code> will run after ViewModel <code>postValue</code> Success state. So, I can't test while loading state.</p>
<p>when i not write <code>onView(withId(R.id.progressBar)).check(matches(isDisplayed()))</code> the test is passed, but  i want to test while loading state.</p>
<p>Possible fix, add <code>delay(10000)</code> to my view model, that will extend duration of loading state, but, my test still waiting success state.</p>
<p>Currently i am not use IdlingResource, because that not fix my problem,</p>
<p>Actual scenario:</p>
<ol>
<li>Fragment Run,</li>
<li>ViewModel fetchdata,</li>
<li>ViewModel loading,</li>
<li>ViewModel success,</li>
<li>FragmentTest run,</li>
<li>viewAssert failed,</li>
</ol>
<p>Expected :</p>
<ol>
<li>Fragment Run,</li>
<li>ViewModel fetchdata,</li>
<li>ViewModel loading,</li>
<li>FragmentTest check progressbar,</li>
<li>ViewModel success,</li>
<li>FragmentTest check recycleView,</li>
<li>done</li>
</ol>
<p>Why? and How?</p>
<h1>Code</h1>
<p>Observer from fragmentMovie</p>
<pre class=""lang-kotlin prettyprint-override""><code>
 private val viewModel: MovieViewModel by viewModels()

   [...]

 viewModel.movie.observe(viewLifecycleOwner, {
            Log.d(TAG, &quot;viewModelgetMovie: ${it.status}&quot;)
            when (it.status) {
                Status.LOADING -&gt; {
                    Toast.makeText(requireContext(), &quot;loading..&quot;, Toast.LENGTH_SHORT).show()
                }
                Status.SUCCESS -&gt; {
                    binding.progressBar.visibility = View.GONE
                    binding.txLoading.visibility = View.GONE
                    if (it.data != null) {
                        list.addAll(it.data)
                        movieAdapter.notifyDataSetChanged()
                    }
                }
                Status.ERROR -&gt; {
                    binding.progressBar.visibility = View.VISIBLE
                    binding.txLoading.text = it.message
                    Toast.makeText(requireContext(), &quot;${it.message}&quot;, Toast.LENGTH_SHORT).show()
                }
            }
        })
</code></pre>
<p>viewmodel</p>
<pre class=""lang-kotlin prettyprint-override""><code>@HiltViewModel
class MovieViewModel @Inject constructor(
    private val repository: MovieRepository,
    private val dispatcher: CoroutineDispatcher
) : ViewModel() {

    // new code
    private val moviePost = MutableLiveData&lt;ResourceHelper&lt;ArrayList&lt;MovieData&gt;&gt;&gt;()

    val movie: LiveData&lt;ResourceHelper&lt;ArrayList&lt;MovieData&gt;&gt;&gt;
        get() = moviePost

    init {
        fetchMovie()
    }

    private fun fetchMovie() {
        viewModelScope.launch(dispatcher) {
            moviePost.postValue(ResourceHelper.loading(null))
            repository.getMovie(1).let { movie -&gt;
                moviePost.postValue(movie)
            }
        }
    }


}
</code></pre>
<p>MovieFragmentTest</p>
<pre class=""lang-kotlin prettyprint-override""><code>package com.unlink.moviecatalogue6.ui.movie

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.unlink.moviecatalogue6.MainActivity
import com.unlink.moviecatalogue6.R
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@HiltAndroidTest
@RunWith(AndroidJUnit4::class)
@LargeTest
class MovieFragmentTest {
    @get:Rule(order = 0)
    var hiltRule = HiltAndroidRule(this)

    @get:Rule(order = 1)
    var activityRule = ActivityScenarioRule(MainActivity::class.java)

    @Before
    fun setUp() {
        hiltRule.inject()
    }

    @After
    fun tearDown() {

    }

    @Test
    fun happyPath() {
        onView(withId(R.id.progressBar)).check(matches(isDisplayed())) // error
        // how can i test on loading?
        onView(withId(R.id.recycleMovie)).check(matches(isDisplayed()))
    }
}
</code></pre>
<h1>Error</h1>
<pre><code>androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'is displayed on the screen to the user' doesn't match the selected view.
Expected: is displayed on the screen to the user
Got: &quot;ProgressBar{id=2131231016, res-name=progressBar, visibility=GONE, width=1080, height=44, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@a455ee2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}&quot;

</code></pre>
<p>The error shown because my progress bar has gone. Because my test check the progress bar after success state.</p>
<h1>Screenshoot</h1>
<blockquote>
<p>Loading state, but my test not run @Test</p>
</blockquote>
<p><a href=""https://i.stack.imgur.com/PjV0L.png"" rel=""nofollow noreferrer"">loading state</a></p>
<blockquote>
<p>Success state, then @Test start</p>
</blockquote>
<p><a href=""https://i.stack.imgur.com/uBBMD.png"" rel=""nofollow noreferrer"">success state</a></p>
<blockquote>
<p>that cause error view is gone</p>
</blockquote>
<p><a href=""https://i.stack.imgur.com/BsKeo.png"" rel=""nofollow noreferrer"">error</a></p>
<blockquote>
<p>Any response will very appreciated</p>
</blockquote>
",https://stackoverflow.com/questions/67619058/espresso-ui-testing-cannot-check-loading-state-how-to-test-ui-with-live-data-a,"['android', 'junit', 'android-espresso', 'ui-testing', 'dagger-hilt']",796,False,2,1
"Activity never becomes requested state &quot;[DESTROYED, RESUMED, STARTED, CREATED]&quot; (last lifecycle transition = &quot;PRE_ON_CREATE&quot;)","<p>This is not a duplicate question.<br />
I have already looked at similar questions. I have added the questions I have referred to at the last.</p>
<p>My problem is that the test executes, but I have to open the app manually for every test.</p>
<p><a href=""https://i.stack.imgur.com/R4xRw.png"" rel=""noreferrer""><img src=""https://i.stack.imgur.com/R4xRw.png"" alt=""screenshot"" /></a></p>
<p>You can see that I had been waiting for 18 seconds before opening the app. It waits till I open the app manually or it shows this error after a timeout.</p>
<blockquote>
<p>Activity never becomes requested state &quot;[DESTROYED, RESUMED, STARTED, CREATED]&quot; (last lifecycle transition = &quot;PRE_ON_CREATE&quot;)</p>
</blockquote>
<p>From <a href=""https://stackoverflow.com/questions/64458330/android-instrumented-test-throws-exception-activity-never-becomes-requested-sta"">this post</a>, I assume the issue is with the device as I am using <code>Redmi Note 5</code>.<br />
I have <code>disabled animations</code> as well as the <code>MIUI optimization</code> option.</p>
<p>Any help is appreciated to run the tests on Xiaomi devices automatically.</p>
<p>No point in running automated UI tests manually.</p>
<p><strong>Update 1</strong><br />
It executes only for launcher / main activity.<br />
It is not working for other activities.</p>
<p><strong>Update 2</strong><br />
I also happen to have a Redmi 4. The tests work on that device as expected without any code changes.</p>
<p><strong>Referred SO questions</strong></p>
<ul>
<li><a href=""https://stackoverflow.com/q/53598321/9636037"">AndroidX.Test ActivityScenario: java.lang.AssertionError: Activity never becomes requested state &quot;[RESUMED]&quot; (last lifecycle transition = &quot;STOPPED&quot;)</a></li>
<li><a href=""https://stackoverflow.com/questions/61477001/android-device-doesnt-launch-activities-on-the-screen-while-espresso-testing"">Android device doesn&#39;t launch activities on the screen while espresso testing</a></li>
<li><a href=""https://stackoverflow.com/questions/62083769/activity-never-becomes-requested-state-in-ui-testing"">Activity never becomes requested state in UI Testing</a></li>
<li><a href=""https://stackoverflow.com/questions/62952309/java-lang-assertionerror-activity-never-becomes-requested-state"">java.lang.AssertionError: Activity never becomes requested state</a></li>
<li><a href=""https://stackoverflow.com/questions/64458330/android-instrumented-test-throws-exception-activity-never-becomes-requested-sta"">Android instrumented test throws exception: Activity never becomes requested state &quot;[RESUMED, DESTROYED, STARTED, CREATED]&quot;</a></li>
<li><a href=""https://stackoverflow.com/questions/67537197/how-do-i-fix-this-error-java-lang-assertionerror-activity-never-becomes-request"">How do I fix this error java.lang.AssertionError: Activity never becomes requested state &quot;[DESTROYED]&quot; (last lifecycle transition = &quot;RESUMED&quot;)</a></li>
</ul>
<p><strong>And related issues,</strong></p>
<ul>
<li><a href=""https://github.com/android/android-test/issues/143"" rel=""noreferrer"">https://github.com/android/android-test/issues/143</a></li>
<li><a href=""https://github.com/android/android-test/issues/496"" rel=""noreferrer"">https://github.com/android/android-test/issues/496</a></li>
</ul>
<p>Adding code snippets and dependencies for anyone who wants to have a look,</p>
<p><strong>Test code</strong></p>
<pre><code>import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4ClassRunner::class)
class MainActivityTest {
    @Test
    fun test_isActivityInView() {
        val activityScenario = ActivityScenario.launch(MainActivity::class.java)
        onView(withId(R.id.layout_activity_main)).check(matches(isDisplayed()))
    }
}
</code></pre>
<p><strong>Dependencies</strong></p>
<pre><code>testImplementation &quot;junit:junit:4.13.2&quot;
androidTestImplementation &quot;androidx.test:core:1.4.0&quot;
androidTestImplementation &quot;androidx.test:runner:1.4.0&quot;
androidTestImplementation &quot;androidx.test:rules:1.4.0&quot;
androidTestImplementation &quot;androidx.test.ext:junit-ktx:1.1.3&quot;
androidTestImplementation &quot;androidx.test.espresso:espresso-core:3.4.0&quot;
</code></pre>
",https://stackoverflow.com/questions/68534534/activity-never-becomes-requested-state-destroyed-resumed-started-created,"['android', 'android-espresso', 'xiaomi']",5776,True,13,6
Chromedriver missing in specflow + selenium .NET Core project,"<p>I have a test automation project I am working on that requires UI testing in the browser. For this project I have setup a <strong>.NET Core 3.1</strong> project with the following packages:</p>
<pre><code>&lt;PackageReference Include=&quot;FluentAssertions&quot; Version=&quot;5.10.3&quot; /&gt;
&lt;PackageReference Include=&quot;Microsoft.Extensions.Configuration.Json&quot; Version=&quot;3.1.8&quot; /&gt;
&lt;PackageReference Include=&quot;Microsoft.NET.Test.Sdk&quot; Version=&quot;16.8.3&quot; /&gt;
&lt;PackageReference Include=&quot;Microsoft.TestPlatform.TestHost&quot; Version=&quot;16.8.3&quot; /&gt;
&lt;PackageReference Include=&quot;Selenium.WebDriver&quot; Version=&quot;3.141.0&quot; /&gt;
&lt;PackageReference Include=&quot;Selenium.WebDriver.ChromeDriver&quot; Version=&quot;87.0.4280.8800&quot; /&gt;
&lt;PackageReference Include=&quot;Selenium.WebDriver.GeckoDriver&quot; Version=&quot;0.27.0&quot; /&gt;
&lt;PackageReference Include=&quot;Selenium.WebDriver.IEDriver&quot; Version=&quot;3.150.1.2&quot; /&gt;
&lt;PackageReference Include=&quot;SpecFlow&quot; Version=&quot;3.5.14&quot; /&gt;
&lt;PackageReference Include=&quot;SpecFlow.Tools.MsBuild.Generation&quot; Version=&quot;3.5.14&quot; /&gt;
&lt;PackageReference Include=&quot;SpecRun.SpecFlow&quot; Version=&quot;3.5.22&quot; /&gt;
</code></pre>
<p>When I try to run any of my tests I get the following error:</p>
<blockquote>
<p>The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at <a href=""http://chromedriver.storage.googleapis.com/index.html"" rel=""nofollow noreferrer"">http://chromedriver.storage.googleapis.com/index.html</a>.</p>
</blockquote>
<p>However the chromedriver is included in the Selenium.WebDriver.ChromeDriver package. It should be copied to the bin folder during the build process, so I checked the folder and it is present.</p>
<p>So I figured the current directory is not the bin folder but some other folder, so I changed my code and passed the current directory as an argument to the chromedriver like so:</p>
<pre><code>...
var driver new ChromeDriver(System.IO.Directory.GetCurrentDirectory());
...
</code></pre>
<p>Now I get the following error:</p>
<blockquote>
<p>The file C:\path\to\project\TestResults\chromedriver.exe does not exist. The driver can be downloaded at <a href=""http://chromedriver.storage.googleapis.com/index.html"" rel=""nofollow noreferrer"">http://chromedriver.storage.googleapis.com/index.html</a></p>
</blockquote>
<p>Which indicates that the current directory is not the bin folder but the output folder of my test results.</p>
<p>How do I change this behaviour so that it will automatically look in the correct folder?</p>
<p><strong>BTW</strong>: I have found <a href=""https://stackoverflow.com/questions/9088367/chromedriver-does-not-exist-in-selenium-webdriver-c-sharp-test-script"">the following solution</a> to a similar problem. However this solution relies on hardcoding the path, either the full path/ driver version or platform/configuration. This is not an option as it is my intent to use the same code on different environments.</p>
",https://stackoverflow.com/questions/65791497/chromedriver-missing-in-specflow-selenium-net-core-project,"['selenium', 'asp.net-core', 'selenium-webdriver', 'selenium-chromedriver', 'specflow']",730,True,1,1
UI5 Custom Middleware often cannot parse JSON bodies when accessed via Karma testing suite,"<p>Ok, this is a very specific problem I have been struggling with for over a week now. I am developing a SAP UI5 application where UI testing is done via Opa5/QUnit. Serving the application directly via npm does work without problems, however, using Karma (targeting a headless approach) two problems have surfaced which seem to be caused by the used custom Middleware:</p>
<ul>
<li><code>res.status()</code> / <code>res.header()</code> do not work (only native node methods like <code>res.setHeader()</code>)</li>
<li>Using a body parser (no matter wheter <code>express.json()</code> or deprecated <code>bodyparser.json()</code>), the parser middleware seems to be working forever until the browser request fails after exact 20 or 40 seconds (Chrome only shows the &quot;Stalled&quot; timebar). This happens very often, but not always.</li>
</ul>
<p>While there is a workaround for the first issue (but still - would be interesting to know why this happens only with Karma) I can't find a solution for the failing requests. I tried changing the browser Karma uses, changing from HTML to script mode, including several plugins and also analyzed packets via Wireshark because browsers show no difference at all between normal and Karma execution.</p>
<p>Through Wireshark I found out that the Karma browser keeps closing Websockets after requests are done while the normal browser doesn't (even when application is served via Karma). Also, in rare cases of working POST JSON requests, content length or processing time do not seem to have an effect.</p>
<p>karma.conf.js:</p>
<pre><code>module.exports = function(config) {
  &quot;use strict&quot;;
  config.set({

    frameworks: ['ui5'],
    reporters: [&quot;progress&quot;],

    browsers: [&quot;Chrome_without_security&quot;],

    ui5: {
      mode: &quot;html&quot;,
      testpage: &quot;webapp/test/integration/opaTests.qunit.html&quot;,
      configPath: &quot;ui5-testing.yaml&quot;,
    },

    customLaunchers: {
      Chrome_without_security: {
         base: 'Chrome',
         flags: ['--disable-web-security', '--no-sandbox']
      }
    },

    singleRun: true,
    browserNoActivityTimeout: 400000,
    //logLevel: config.LOG_DEBUG,
  });
};
</code></pre>
<p>ui5-testing.yaml:</p>
<pre><code>specVersion: '2.1'
metadata:
  name: grunt-build
type: application
framework:
  name: SAPUI5
  version: &quot;1.84.0&quot;
  libraries:
    - name: sap.m
    - name: sap.ui.core
    - name: sap.ui.layout
    - name: sap.ui.support
      development: true
    - name: sap.ui.table
    - name: sap.ui.unified
    #- name: sap.ui.model
    - name: sap.ushell
      development: true
    - name: themelib_sap_fiori_3
      optional: true
    - name: themelib_sap_belize
      optional: true
    #- name: themelib_sap_bluecrystal
    #  optional: true
    - name: sap.f
    - name: sap.tnt
resources:
  configuration:
    paths:
      webapp: /webapp
server:
  customMiddleware:
    - name: proxy
      beforeMiddleware: serveResources
      configuration:
        testing: true
---
specVersion: '2.1'
kind: extension
type: server-middleware
metadata:
  name: proxy
middleware:
  path: lib/middleware/proxy.js
</code></pre>
<p>proxy.js:</p>
<pre><code>const express = require('express')
module.exports = function ({
    resources,
    middlewareUtil,
    options
}) {
    require('dotenv').config();
    const axios = require('axios')
    var admin = require('firebase-admin');
    const app = express();

    ...

    app.use(express.json());
    app.use((req, res, next) =&gt; { // Most POST Requests with application/json header do not enter this!
        ...
    }
    return app;
};
</code></pre>
<p>Requesting method (example):</p>
<pre><code>upsert: function (aElements, iTimeout) {
            let that = this;
            return new Promise((resolve, reject) =&gt; {
                let sBody = JSON.stringify(aElements);

                let xhr = new XMLHttpRequest();

                xhr.open('POST', UPSERT_URL, true);
                xhr.onload = function (oResponse) {
                    that.proceedResponse(oResponse, this)
                        .then(() =&gt; resolve())
                        .catch(iStatus =&gt; reject(iStatus));
                };
                xhr.onerror = function (oError) {
                    reject(oError);
                };
                xhr.ontimeout = function (oError) {
                    console.error(`The request for ${UPSERT_URL} timed out.`);
                    reject(oError);
                };

                xhr.timeout = iTimeout;
                xhr.setRequestHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);
                xhr.send(sBody);
            });
        },
</code></pre>
<p>Normal call: <code>ui5 serve -p 8080 -o /test/integration/opaTests.qunit.html --config ui5-testing.yaml</code></p>
<p>Karma call: <code>karma start</code></p>
<p>Maybe someone is able to help me here, thank you very much!</p>
",https://stackoverflow.com/questions/68638582/ui5-custom-middleware-often-cannot-parse-json-bodies-when-accessed-via-karma-tes,"['javascript', 'node.js', 'express', 'karma-runner', 'ui5-tooling']",220,False,2,0
How to get standard xUnit v2 XML file with test results,"<p>I've created a C# xUnit Test Project through Visual Studio 2019 and using Selenium for UI testing.  This 'xUnit Test Project' appears to create a .netcore app.</p>
<p>Packages installed (most recent versions of each):</p>
<ul>
<li>xunit (2.4.1)</li>
<li>xunit.runner.visualstudio (2.4.3)</li>
</ul>
<p>When running tests through Visual Studio, I get the output in Test Explorer fine, but I don't get any XML output.  I've tried running via command line and specifying '--logger' but this is giving me an XML (trx, renamed as xml) file that looks totally different to the standard xUnit v2 XML structure I was expecting.</p>
<p>I'd like to get the standard xUnit v2 XML output so that, down the line, I can import this into other CI or test management tools e.g. Jenkins, xray, etc, or write a custom XSL-T stylesheet for more advanced HTML output.</p>
<p>I tried installing 'xunit.runner.console' but 'xunit.console.exe' refused to run.  There could be security policies on my work laptop at play here for exe files, as the xunit.console.exe seemed to be located elsewhere, nowhere near my project files (MVC projects I've created in the past had packages with the project, .netcore seems to put them somewhere else?)</p>
<p>Running:</p>
<pre><code>dotnet test --logger &quot;trx;LogFileName=TestOutputResults.xml&quot;
</code></pre>
<p>or</p>
<pre><code>dotnet test --filter FullyQualifiedName~XUnitTestProject1.TestClass1.Test1 --logger &quot;trx;LogFileName=TestOutputResults.xml&quot;
</code></pre>
<p>results in the following formatted XML file structure:</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;TestRun id=&quot;&quot; name=&quot;&quot; runUser=&quot;&quot; xmlns=&quot;http://microsoft.com/schemas/VisualStudio/TeamTest/2010&quot;&gt;
  &lt;Times creation=&quot;&quot; queuing=&quot;&quot; start=&quot;&quot; finish=&quot;&quot; /&gt;
  &lt;TestSettings name=&quot;default&quot; id=&quot;&quot;&gt;
    &lt;Deployment runDeploymentRoot=&quot;&quot; /&gt;
  &lt;/TestSettings&gt;
  &lt;Results&gt;
    &lt;UnitTestResult executionId=&quot;&quot; testId=&quot;&quot; testName=&quot;&quot; computerName=&quot;&quot; duration=&quot;&quot; startTime=&quot;&quot; endTime=&quot;&quot; testType=&quot;&quot; outcome=&quot;Passed&quot; testListId=&quot;&quot; relativeResultsDirectory=&quot;&quot;&gt;
      &lt;Output&gt;
        &lt;StdOut&gt;Info: Randomly generated test data&lt;/StdOut&gt;
      &lt;/Output&gt;
    &lt;/UnitTestResult&gt;
  &lt;/Results&gt;
  &lt;TestDefinitions&gt;
    &lt;UnitTest name=&quot;&quot; storage=&quot;&quot; id=&quot;&quot;&gt;
      &lt;Execution id=&quot;&quot; /&gt;
      &lt;TestMethod codeBase=&quot;&quot; adapterTypeName=&quot;&quot; className=&quot;&quot; name=&quot;&quot; /&gt;
    &lt;/UnitTest&gt;
  &lt;/TestDefinitions&gt;
  &lt;TestEntries&gt;
    &lt;TestEntry testId=&quot;&quot; executionId=&quot;&quot; testListId=&quot;&quot; /&gt;
  &lt;/TestEntries&gt;
  &lt;TestLists&gt;
    &lt;TestList name=&quot;Results Not in a List&quot; id=&quot;&quot; /&gt;
    &lt;TestList name=&quot;All Loaded Results&quot; id=&quot;&quot; /&gt;
  &lt;/TestLists&gt;
  &lt;ResultSummary outcome=&quot;Completed&quot;&gt;
    &lt;Counters total=&quot;1&quot; executed=&quot;1&quot; passed=&quot;1&quot; failed=&quot;0&quot; error=&quot;0&quot; timeout=&quot;0&quot; aborted=&quot;0&quot; inconclusive=&quot;0&quot; passedButRunAborted=&quot;0&quot; notRunnable=&quot;0&quot; notExecuted=&quot;0&quot; disconnected=&quot;0&quot; warning=&quot;0&quot; completed=&quot;0&quot; inProgress=&quot;0&quot; pending=&quot;0&quot; /&gt;
    &lt;Output&gt;
      &lt;StdOut&gt;&lt;/StdOut&gt;
    &lt;/Output&gt;
  &lt;/ResultSummary&gt;
&lt;/TestRun&gt;
</code></pre>
<p>but the standard xUnit v2 format from what I can find online (<a href=""https://xunit.net/docs/format-xml-v2"" rel=""nofollow noreferrer"">https://xunit.net/docs/format-xml-v2</a> &amp; <a href=""https://docs.getxray.app/display/XRAY/Taking+advantage+of+xUnit+XML+reports"" rel=""nofollow noreferrer"">https://docs.getxray.app/display/XRAY/Taking+advantage+of+xUnit+XML+reports</a>) is:</p>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;assemblies timestamp=&quot;07/31/2018 14:58:48&quot;&gt;
    &lt;assembly name=&quot;C:\Users\smsf\Documents\Visual Studio 2015\Projects\xUnitDemo\xUnitDemo\bin\Debug\xUnitDemo.DLL&quot; environment=&quot;64-bit .NET 4.0.30319.42000 [collection-per-class, parallel (1 threads)]&quot; test-framework=&quot;xUnit.net 2.3.1.3858&quot; run-date=&quot;2018-07-31&quot; run-time=&quot;14:58:47&quot; config-file=&quot;C:\Users\smsf\Documents\Visual Studio 2015\Projects\xUnitDemo\packages\xunit.runner.console.2.4.0\tools\net452\xunit.console.exe.Config&quot; total=&quot;15&quot; passed=&quot;14&quot; failed=&quot;1&quot; skipped=&quot;0&quot; time=&quot;0.257&quot; errors=&quot;0&quot;&gt;
        &lt;errors /&gt;
        &lt;collection total=&quot;2&quot; passed=&quot;1&quot; failed=&quot;1&quot; skipped=&quot;0&quot; name=&quot;Test collection for xUnitDemo.SimpleTests&quot; time=&quot;0.070&quot;&gt;
            &lt;test name=&quot;xUnitDemo.SimpleTests.PassingTest&quot; type=&quot;xUnitDemo.SimpleTests&quot; method=&quot;PassingTest&quot; time=&quot;0.0636741&quot; result=&quot;Pass&quot;&gt;
                &lt;traits&gt;
                    &lt;trait name=&quot;test&quot; value=&quot;CALC-2&quot; /&gt;
                    &lt;trait name=&quot;requirement&quot; value=&quot;CALC-1&quot; /&gt;
                    &lt;trait name=&quot;labels&quot; value=&quot;core UI&quot; /&gt;
                &lt;/traits&gt;
            &lt;/test&gt;
            &lt;test name=&quot;xUnitDemo.SimpleTests.FailingTest&quot; type=&quot;xUnitDemo.SimpleTests&quot; method=&quot;FailingTest&quot; time=&quot;0.0059474&quot; result=&quot;Fail&quot;&gt;
                &lt;failure exception-type=&quot;Xunit.Sdk.EqualException&quot;&gt;
                   &lt;message&gt;&lt;![CDATA[Assert.Equal() Failure\r\nExpected: 5\r\nActual: 4]]&gt;&lt;/message&gt;
                    &lt;stack-trace&gt;&lt;![CDATA[ at xUnitDemo.SimpleTests.FailingTest() in C:\Users\smsf\documents\visual studio 2015\Projects\xUnitDemo\xUnitDemo\SimpleTests.cs:line 30]]&gt;&lt;/stack-trace&gt;
                &lt;/failure&gt;
            &lt;/test&gt;
        &lt;/collection&gt;
    &lt;/assembly&gt;
&lt;/assemblies&gt;
</code></pre>
<p>Could anyone explain what I've done wrong, or if I'm being stupid and missed doing something obvious please?</p>
<p>What do I need to do / what command do I need to run to generate standard xUnit v2 XML files with my test results?</p>
<p>I've spent a few days using Google, DuckDuckGo, looking through xunit.net and the github code, to try and figure this out and can't find anything, it's driving me crazy.</p>
<p>Many thanks in advance.</p>
",https://stackoverflow.com/questions/68928327/how-to-get-standard-xunit-v2-xml-file-with-test-results,"['c#', 'xml', 'xunit.net']",2796,True,2,2
Setting CurrentUICulture for program started in automated tests,"<p>I am currently looking to setting the CurrentUICulture for automated (graybox) UI-tests of a C# (WPF) application. The UI-testing is performed with SpecFlow for the test-cases and FlaUI for UI-automation within the steps. Hence this is not about how I can set the <code>CurrentUICulture</code> from within the application, but from the outside.</p>
<p>Unfortunately the state of my research led me to the point to assume, that it's bleakly impossible to set the UI culture of a C# application I'm starting, but I hoped for a faint chance, that someone knows some way to achieve this.</p>
<p>I've read some answers here that state that we could set the <code>CurrentUICulture</code> in a PowerShell console and the language (or locale) would be propagated to things started from this PowerShell session, but this seems to hold true for cmdlets only, not for applications started from that PowerShell session, which arguably makes sense. I confirmed that this holds true for applications started with <code>Process.Start</code>, from another application the <code>CurrentUICulture</code> has been set for. Since <code>FlaUI</code> seems to use <code>Process.Start</code>, too (FlaUIs <code>Application.Launch</code> takes a <code>ProcessStartInfo</code>, object which lets me think that it uses <code>Process.Start</code>, but I have not confirmed this), I assume that the behavior will be the same. Furthermore there is no possibility to pass a locale to <code>Process.Start</code> directly.</p>
<p>I even tried setting <code>Thread.CurrentUICulture</code> and <code>CultureInfo.DefaultThreadCurrentUICulture</code> in the program that is calling the program to test, but to no avail neither.</p>
<p>I know that setting the Windows UI language globally requires a restart for the changes to become effective, which rules this out for automated testing. Even setting up another user and running the program as this user does not seem to help. The culture settings (<code>CultureInfo.CurrentCulture</code>) for that user are passed to the software, but the language (<code>CultureInfo.CurrentUICulture</code>) is not.</p>
<p>The <code>CurrentCulture</code> can be set within the session and I <em>could</em> use this to determine which language to use, but this feels like a hack I would like to avoid. Is there any other way to set the language for the program to run?</p>
",https://stackoverflow.com/questions/67278054/setting-currentuiculture-for-program-started-in-automated-tests,"['c#', 'localization', 'automated-tests']",101,False,1,0
How do I initialize my json response in another class that depends on a search input in flutter?,"<p>this is my first question here on stackoverflow.</p>
<p>I'm working on my first real app after attending a few CS classes at University and some courses on Udemy. So I'm lacking a lot of software engineering knowledge.</p>
<p>My goal: I want to build a search for stocks by using an external API endpoint. For that, I have created 4 dart files to handle the searchscreen with inputs (My UI), networking, parsing, and basically returning the data.</p>
<p>My NetworkAPI class to handle all sorts of network requests looks like this. I'm trying to use the jsonDecode already here and returning that. This class waits for an URL that will be put together in another class (financeData):</p>
<pre><code>class NetworkAPI {
  final String url;
  NetworkAPI(this.url);

  Future getData() async {
    http.Response response = await http.get(url);

    if (response.statusCode == 200) {
      String data = response.body;
      return jsonDecode(data);
    } else {
      print(response.statusCode);
    }
  }
}
</code></pre>
<p>This is basically the Json I want to parse. If I understood the theory correctly it's a map with a list of objects.</p>
<pre><code>          {
                &quot;bestMatches&quot;: [
                    {
                        &quot;1. symbol&quot;: &quot;TESO&quot;,
                        &quot;2. name&quot;: &quot;Tesco Corporation USA&quot;,
                        &quot;3. type&quot;: &quot;Equity&quot;,
                        &quot;4. region&quot;: &quot;United States&quot;,
                        &quot;5. marketOpen&quot;: &quot;09:30&quot;,
                        &quot;6. marketClose&quot;: &quot;16:00&quot;,
                        &quot;7. timezone&quot;: &quot;UTC-04&quot;,
                        &quot;8. currency&quot;: &quot;USD&quot;,
                        &quot;9. matchScore&quot;: &quot;0.8889&quot;
                    }
                    {....}
                ]
            }
</code></pre>
<p>To parse this, I saw some really good explanations here on stack overflow. I'm basically trying to retrieve the information I'm interested in.</p>
<pre><code>class SearchOutput {

  final List&lt;BestMatch&gt; bestMatches;
  SearchOutput({this.bestMatches});

  factory SearchOutput.fromJson(Map&lt;String, dynamic&gt; parsedJson){

   var list = parsedJson['bestMatches'] as List;
   print(list.runtimeType);

   List&lt;BestMatch&gt; searchResultList = list.map((i) =&gt; BestMatch.fromJson(i)).toList();

    return SearchOutput(
        bestMatches: searchResultList,
    );
  }

}

class BestMatch {
  String symbol;
  String name;
  String type;
  String region;
  String currency;

  BestMatch({
    this.symbol,
    this.name,
    this.type,
    this.region,
    this.currency,
  });

  factory BestMatch.fromJson(Map&lt;String, dynamic&gt; parsedJson){
    return BestMatch(
      symbol: parsedJson[&quot;1. symbol&quot;],
      name: parsedJson[&quot;2. name&quot;],
      type: parsedJson[&quot;3. type&quot;],
      region: parsedJson[&quot;4. region&quot;],
      currency: parsedJson[&quot;8. currency&quot;],
    );
  }
}
</code></pre>
<p>Now I created a class with a method that should return all my data and format it into a list. The URL still needs an searchInput, which will be handed over from a TextField Widget in the UI.</p>
<pre><code>const apiKey = 'demo';
const alphaVantageSearchUrl =
    'https://www.alphavantage.co/query?function=SYMBOL_SEARCH';

class FinanceData {

  Future&lt;dynamic&gt; getSearchData(String searchInput) async {
    var url = '$alphaVantageSearchUrl&amp;keywords=$searchInput&amp;apikey=$apiKey';
    NetworkAPI networkAPI = NetworkAPI(url);
    var searchData = await networkAPI.getData();
    SearchOutput searchOutput = new SearchOutput.fromJson(searchData);
    return searchOutput;
  }
}
</code></pre>
<p>Testing with some print statements seems to fullfill my goal of being able to access the data. For example printing out the name of the second object out of my response.</p>
<pre><code> print(searchOutput.bestMatches[1].name);
</code></pre>
<p>The last file is my UI where we have a TextField, that I push to the financeData class in order to build the URL. Currently, my goal would be, to be able to show just the name of any given object in my response in the UI. I have no idea how to initialize my financeDate and how to use the return from my finaceData class in the UI. (I took some design styles out of the code snippet).</p>
<pre><code>class SearchScreenWatchlist extends StatefulWidget {
  @override
  _SearchScreenWatchlistState createState() =&gt; _SearchScreenWatchlistState();
}

class _SearchScreenWatchlistState extends State&lt;SearchScreenWatchlist&gt; {
  String searchInput;
  FinanceData financeData = FinanceData(); 
  
  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: &lt;Widget&gt;[
          Container(
            child: TextField(
              onChanged: (value) {
                searchInput = value;
              },
            ),
          ),
          TextButton(
              onPressed: () {
                financeData.getSearchData(searchInput);
                setState(() {
                });
              },
              child: Text('Search')),
          Text(('Search Results for: $searchInput')),
          Container(child: Text('**SHOW HERE THE NAME**')),
        ],
      ),
    );
  }
}
</code></pre>
<p>It would be my goal to show in the last container the name on any given object from my response for example RESPONSE.name[1]. Later on I will try to iterate throw all the objects and show a list of all names of the response.</p>
<p>Thanks a lot! I really appreciate your help!</p>
",https://stackoverflow.com/questions/66665055/how-do-i-initialize-my-json-response-in-another-class-that-depends-on-a-search-i,"['json', 'flutter', 'dart']",633,True,0,1
