jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Russell <>
Subject Re: Mocking Framework
Date Sun, 19 Nov 2017 11:28:28 GMT
Hi all

I've resurrected the Spock branch (
does anyone have any thoughts on this thread?
Does this need a vote, some more work or discussion?
Is there a test which I should try to re-write in Spock to make sure it can
do what we need?
Unfortunately a lot of the code hasn't been written with testability in
mind, so mocking etc. is difficult without refactoring.
I really think this will help improve unit test coverage in JMeter by
making it easier (and more fun) to test.

If you had some time please read
alongside the tests I've created, it has more detail about Mock/Spy/Stubs
in Spock.



On Sun, 22 Jan 2017 at 12:43 Graham Russell <> wrote:
> I've added a few more tests which make more use of mocks and I've
refactored AbstractJDBCTestElement a little:
> One of the nice things about testing with groovy is that you can test
protected and private methods/classes without having to use reflection or
change access.
> Does anyone have any questions/concerns/thoughts on the code so far with
> What needs to be done next to agree (or not) the move to Spock?
> Many thanks
> Graham
> On Sat, 14 Jan 2017, 21:47 Graham Russell, <> wrote:
>> Felix/all
>> 1. I've reverted the move - it was intended to make compilation simpler,
but it isn't required.
>> 2. Thanks for the pointer - I've edited AllTests to find Spock
>> 3. I've added a few more examples, I've used Mocks in a few places.
>> The main tests of interest are in org.apache.jmeter.engine.util:
>> PackageTest has gone from 234 to 107 lines in PackageSpec by using
>> and HTTPUtilsSpec is also much easier to read/edit/add to.
>> I've edited the base JMeterTestCases to work when run from IntelliJ (and
created a similar base JMeterSpec).
>> I've also fixed tests which failed when adding the Spock library e.g.
eclipse.classpath and LICENSE file.
>> Are there any tests for which you think mocking would be especially
useful and easy i.e. without having to refactor a lot of code?
>> I'm not sure about my changes to build.xml, especially the compilation
of tests.
>> Please have a look at:
>> and let me know thoughts/feedback and what needs to be done next.
>> If we do move to Spock I'd like to help increase the test coverage and
improve readability of the current tests.
>> Thanks
>> Graham
>> P.S. Sorry for the extra whitespace fixes/changes, it's just a habit - I
could remove it and squash commits if that would help reviewing?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message