testing

Selenium unable to login to Django LiveServerTestCase

我的未来我决定 提交于 2020-03-25 03:28:46
问题 I'm struggling to get Selenium working with my Django project. I can (finally) get it to get pages during testing, but I'm unable to get it to login for some reason. This is my (very simple) test case: import pytest from django.conf import settings from django.contrib.auth import get_user_model from django.test.client import Client from pytest_django.live_server_helper import LiveServer from selenium.webdriver import Remote from users.tests.factories import UserFactory pytestmark = pytest

How to launch all Karate features setting up which browser to use as an external maven variable

て烟熏妆下的殇ゞ 提交于 2020-03-23 11:59:20
问题 I was trying to find a way to launch all features in Karate testing through maven using an external variable to set up the browser (with a local webdriver or using a Selenium grid). So something like: mvn test -Dbrowser=chrome (or firefox, safari, etc) or using a Selenium grid: mvn test -Dbrowser=chrome (or firefox, safari, etc) -Dgrid="grid url" With Cucumber and Java this was quite simple using a singleton for setting up a global webdriver that was then used in all tests. In this way I

Fragment Unit Testing: launchFragment throws ClassCastException

半城伤御伤魂 提交于 2020-03-23 11:55:04
问题 I'm trying to call methods within my Fragment class in my unit test but I keep getting the error java.lang.ClassCastException: androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity cannot be cast to com.nu.rms.inspections.ui.activity.InspectionActivity I'm following Google's docs. I'm confused why the empty fragment activity is having a cast attempted to become my InspectionActivity (the parent activity the fragment resides in), perhaps this is expected? What can I do to

Angular 7 testing retryWhen with mock http requests fails to actually retry

做~自己de王妃 提交于 2020-03-20 16:03:05
问题 I have the following interceptor that tries to use a OAuth refresh_token whenever any 401 (error) response is obtained. Basically a refresh token is obtained on the first 401 request and after it is obtained, the code waits 2,5 seconds. In most cases the second request will not trigger an error, but if it does (token couldn't be refreshed or whatever), the user is redirect to the login page. export class RefreshAuthenticationInterceptor implements HttpInterceptor { constructor( private router

Running instrumented Android test produces “Unknown command-line option '--tests' ”

狂风中的少年 提交于 2020-03-20 07:46:43
问题 I need to run tests with Gradle in a specific package of my app with a command line, in a fastfile. I'm using this command sh './gradlew test --tests "com.package.exemple.*"' but it give me this error Problem configuring task :app:test from command line. >Unknown command-line option '--tests'. I tried a lot of variants but no one worked. Thanks for your help ! 回答1: There is an open issue related to this problem. Please star it and use a specific variant name. Currently the top-level "test"

Running instrumented Android test produces “Unknown command-line option '--tests' ”

我与影子孤独终老i 提交于 2020-03-20 07:46:23
问题 I need to run tests with Gradle in a specific package of my app with a command line, in a fastfile. I'm using this command sh './gradlew test --tests "com.package.exemple.*"' but it give me this error Problem configuring task :app:test from command line. >Unknown command-line option '--tests'. I tried a lot of variants but no one worked. Thanks for your help ! 回答1: There is an open issue related to this problem. Please star it and use a specific variant name. Currently the top-level "test"

Running instrumented Android test produces “Unknown command-line option '--tests' ”

Deadly 提交于 2020-03-20 07:46:07
问题 I need to run tests with Gradle in a specific package of my app with a command line, in a fastfile. I'm using this command sh './gradlew test --tests "com.package.exemple.*"' but it give me this error Problem configuring task :app:test from command line. >Unknown command-line option '--tests'. I tried a lot of variants but no one worked. Thanks for your help ! 回答1: There is an open issue related to this problem. Please star it and use a specific variant name. Currently the top-level "test"

How to test a component using react-redux hooks?

眉间皱痕 提交于 2020-03-17 07:58:36
问题 I have a simple Todo component that utilizes react-redux hooks that I'm testing using enzyme but I'm getting either an error or an empty object with a shallow render as noted below. What is the correct way to test components using hooks from react-redux? Todos.js const Todos = () => { const { todos } = useSelector(state => state); return ( <ul> {todos.map(todo => ( <li key={todo.id}>{todo.title}</li> ))} </ul> ); }; Todos.test.js v1 ... it('renders without crashing', () => { const wrapper =

Instrumentation run failed due to 'Process crashed.'

我怕爱的太早我们不能终老 提交于 2020-03-17 06:45:47
问题 I wanted to run the following test: package com.xxx.yyy; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test

TestNG: More than one @DataProvider for one @Test

妖精的绣舞 提交于 2020-03-17 06:45:46
问题 I'm using TestNG for Eclipse . Is it possible to give two data providers step by step to the same test-function? I could put both providers in one, but that is not what I want. I need (not like in this example) to generate independently data. @DataProvider(name = "dataSet1") public Object[][] createDataX() { return new Object[][] { { 1, 1 }, { 2, 2 } }; } @DataProvider(name = "dataSet2") public Object[][] createDataY() { return new Object[][] { { 0, 0 }, { 3, 3 } }; } I want to give both