testing

Gradle Robolectric Resources NotFoundException in Testing

北城以北 提交于 2020-01-21 06:46:29
问题 I've already knew that this issue has been asked before but I can't solve this problem. I am able to compile and apply test with jUnit, Robolectric and Gradle. The issue or error comes when I try to test an Activity or get a resource. Every time I've got the same issue: android.content.res.Resources$NotFoundException: unknown resource Resources$NotFoundException: no such theme PageActivity startPageActivity = Robolectric.buildActivity(PageActivity.class).create().get(); Context context =

Timed out waiting 45 seconds for Firefox to start

我怕爱的太早我们不能终老 提交于 2020-01-21 05:32:09
问题 I am using ubuntu 16.04 Timed out waiting 45 seconds for Firefox to start. Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:31.527Z' System info: host: 'supranimbus-Inspiron-3250', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.10.0-40-generic', java.version: '1.8.0_151' Driver info: driver.version: FirefoxDriver at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:131) at org.openqa.selenium.firefox

How to ignore generated files from Go test coverage

大憨熊 提交于 2020-01-21 02:42:48
问题 I have a generated file in my package with DO NOT EDIT on top. I am running tests for my package with go test -coverprofile=cover.out <package> . This creates coverage profile and shows total coverage percentage. But it also includes generated files while calculating the coverage. Is there a way to ignore generated files in coverage calculation? 回答1: Most Go tools operate on packages, because a package itself forms a unit that may be useful in its entirety. Excluding files from a package

How to launch tests for django reusable app?

廉价感情. 提交于 2020-01-20 13:31:33
问题 Can I launch tests for my reusable Django app without incorporating this app into a project? My app uses some models, so it is necessary to provide (TEST_)DATABASE_* settings. Where should I store them and how should I launch tests? For a Django project, I can run tests with manage.py test ; when I use django-admin.py test with my standalone app, I get: Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. What are the best practises here? 回答1:

How to launch tests for django reusable app?

心已入冬 提交于 2020-01-20 13:30:54
问题 Can I launch tests for my reusable Django app without incorporating this app into a project? My app uses some models, so it is necessary to provide (TEST_)DATABASE_* settings. Where should I store them and how should I launch tests? For a Django project, I can run tests with manage.py test ; when I use django-admin.py test with my standalone app, I get: Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. What are the best practises here? 回答1:

How to mock a Scala singleton object?

≯℡__Kan透↙ 提交于 2020-01-20 02:16:49
问题 I am trying to mock a Scala singleton object. In particular, I need to mock the object play.api.libs.ws.WS used inside a service component (class under test). Using Mockito this is not possible, the test execution fails in the following way: [error] MockitoException: : [error] Cannot mock/spy class play.api.libs.ws.WS$ [error] Mockito cannot mock/spy following: [error] - final classes [error] - anonymous classes [error] - primitive types (GeolocationSpec.scala:18) Reading here, it seems that

How do I confirm a javascript popup with Capybara?

旧街凉风 提交于 2020-01-19 06:52:06
问题 I've tried several examples found online, but with no luck. I am looking to confirm the confirm message of a delete link. The last attempt was the code below, but that resulted in an Capybara::NotSupportedByDriverError error. def confirm_dialog page.evaluate_script('window.confirm = function() { return true; }') end 回答1: First of all switch to using Selenium as the driver by putting an @javascript tag in front of your scenario. The following code in your cucumber step will then confirm the

What is the difference between mocking and spying when using Mockito?

旧时模样 提交于 2020-01-19 01:58:50
问题 What would be a use case for a use of a Mockito spy? It seems to me that every spy use case can be handled with a mock, using callRealMethod. One difference I can see is if you want most method calls to be real, it saves some lines of code to use a mock vs. a spy. Is that it or am I missing the bigger picture? 回答1: The answer is in the documentation: Real partial mocks (Since 1.8.0) Finally, after many internal debates & discussions on the mailing list, partial mock support was added to

Waiting from a desktop app for events originating from a metro app and vice versa

心不动则不痛 提交于 2020-01-17 14:59:28
问题 We have a metro app and we want to test certain issues that may come up in the app due to multiple operations going on in async. So basically our plan is to have a test app (preferably a desktop app) which can wait on certain events generated from within the metro app.We also want this to be bidirectional that is our desktop test app also generates certain events on which the metro app will wait (We will inject that part in the metro app code).This way we hope to generate more scenarios. The

Waiting from a desktop app for events originating from a metro app and vice versa

南笙酒味 提交于 2020-01-17 14:57:27
问题 We have a metro app and we want to test certain issues that may come up in the app due to multiple operations going on in async. So basically our plan is to have a test app (preferably a desktop app) which can wait on certain events generated from within the metro app.We also want this to be bidirectional that is our desktop test app also generates certain events on which the metro app will wait (We will inject that part in the metro app code).This way we hope to generate more scenarios. The