testing

org.mockito.exceptions.misusing.NotAMockException on InjectMocks object

会有一股神秘感。 提交于 2020-02-03 02:11:12
问题 I'm trying to mock the return value from a method but I'm getting NotAMockException . @InjectMocks private MyService myService; @Mock private OtherServiceUsedInMyServiceAsAutowired otherServiceUsedInMyServiceAsAutowired; Inside MyService I have a method called myMethod() and I want to return dummy object when this method is called. doReturn(someDummyObject).when(myService).myMethod(any(), any(), any()); And at that point I'm getting the error. What am I doing wrong? Full error: org.mockito

Kotlin internal members not accessible from alternative test source set in Gradle

…衆ロ難τιáo~ 提交于 2020-02-02 02:44:06
问题 Following https://docs.gradle.org/current/userguide/java_testing.html#sec:configuring_java_integration_tests and https://www.michael-bull.com/blog/2016/06/04/separating-integration-and-unit-tests-with-gradle we are attempting to separate our integration tests from plain unit tests. The problem we have is internal members in Kotlin are not accessible from such tests. As per Kotlin doco there is a visibility exception for test source sets. The internal visibility modifier means that the member

Running Jmeter remotely from command line

☆樱花仙子☆ 提交于 2020-02-02 02:09:05
问题 Is it possible to run Jmeter on remote server without having Jmeter client on local machine. I mean can I just run jmeter.bat on remote machine from command prompt, so that it just run tests on remote server and store results in listener.jtl file over there, without any jmeter client on my machine. 回答1: Here is the link: http://jmeter.apache.org/usermanual/remote-test.html. Just go through the documentation available in the Jmeter's website. The scenario given by you is some sort of

Python mocking logging while retaining log output

社会主义新天地 提交于 2020-02-01 07:59:04
问题 I have a series of unit/integration tests which using the python logging module . I would like to test that the right things are logged when appropriate which I can achieve using the mock module as follows: @mock.patch('logging.Logger.info') However, when I do this the actual logging is stopped (for obvious reasons!) and this is useful for me to debug why my tests are working etc. My question is as follows: Is there a way in why I can mock out logging calls so I can assert they have been

Testing logging output with pytest

余生颓废 提交于 2020-02-01 03:14:05
问题 I am trying to write a test, using pytest, that would check that a specific function is writing out a warning to the log when needed. For example: In module.py: import logging LOGGER = logging.getLogger(__name__) def run_function(): if something_bad_happens: LOGGER.warning('Something bad happened!') In test_module.py: import logging from module import run_function LOGGER = logging.getLogger(__name__) def test_func(): LOGGER.info('Testing now.') run_function() ~ somehow get the stdout/log of

How do you do page performance tests?

独自空忆成欢 提交于 2020-01-31 08:48:50
问题 I know everyone who reads the question will think "Firebug!" right away. Maybe some will think "YSlow!" and "Google Page Speed!" While I really like these tools, I'm more concerned with how the quickly the page will render in IE 6/7/8. All of the above tools require Firefox. That's all fine and you can definitely test the underlying speed of getting the page to the browser but what about when it comes to actually rendering the page? I haven't seen any really good answers on how to test

Testing: unit vs. integration vs. others, what is the need for separation? [closed]

泄露秘密 提交于 2020-01-31 07:50:50
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . To the question Am I unit testing or integration testing? I have answered, a bit provocative: Do your test and let other people spend time with taxonomy. For me the distinction between various levels of testing is technically pointless: often the same tools are used, the same

Testing: unit vs. integration vs. others, what is the need for separation? [closed]

可紊 提交于 2020-01-31 07:50:16
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . To the question Am I unit testing or integration testing? I have answered, a bit provocative: Do your test and let other people spend time with taxonomy. For me the distinction between various levels of testing is technically pointless: often the same tools are used, the same

Why should I use RSpec or shoulda with Rails?

﹥>﹥吖頭↗ 提交于 2020-01-30 14:13:27
问题 I am setting up a rails app and I just finished making some unit tests and my friend said that apparently fixtures are no longer cool and people are now using RSpec or shoulda. I was wondering what the actual benefits are to use these other toolkits. Any information at all is appreciated. -fREW 回答1: RSpec and similar frameworks are tooling designed to aid in Behavior Driven Development. They're not just a prettier way to write tests, though they do help with that. There is plenty of

Why should I use RSpec or shoulda with Rails?

我们两清 提交于 2020-01-30 14:11:11
问题 I am setting up a rails app and I just finished making some unit tests and my friend said that apparently fixtures are no longer cool and people are now using RSpec or shoulda. I was wondering what the actual benefits are to use these other toolkits. Any information at all is appreciated. -fREW 回答1: RSpec and similar frameworks are tooling designed to aid in Behavior Driven Development. They're not just a prettier way to write tests, though they do help with that. There is plenty of