Giter Club home page Giter Club logo

Comments (5)

jlink avatar jlink commented on July 20, 2024

Somehow the test framework must invoke mock object creation within its lifecycle. In jqwik you're supposed to do that in the test class's constructor. With Mockito for example you'd call
MockitoAnnotations.initMocks(this); there.

To be frank I have no idea how it can possibly work with Jupiter without some additional mechanics like registering a Jupiter extension through a service provider. I also tried to find out how JMockit works in principle but jmockit.org seems to be dead.

Do you have a link to JMockit's current documentation?

from jqwik.

jlink avatar jlink commented on July 20, 2024

I had a look at JMockit's source code. It comes with code that hooks into Jupiter's extension mechanism. Since such a mechanism is currently not available for jqwik you'll have to use a different way to make JMockit inject mock objects. I guess JMockit's documentation would help if I only knew where it was...

from jqwik.

jlink avatar jlink commented on July 20, 2024

OK. I eventually found the current documentation:
http://jmockit.github.io/tutorial/Introduction.html#runningTests

I guess the javaagent approach could work with jqwik. Let me know if you try it (successfully or unsuccessfully).

from jqwik.

SashGraf avatar SashGraf commented on July 20, 2024

I tried with -javaagent:C:/.../jmockit-1.39.jar. It doesn't seem to work.
The JUnit5 test is green and the jqwik is still red.

from jqwik.

jlink avatar jlink commented on July 20, 2024

I didn't succeed in making it work either. So you'd probably have to ask the author of @jmockit if there is a programmable way of invoking all the necessary mocking harness. Looking at https://github.com/jmockit/jmockit1/blob/master/main/src/mockit/integration/junit5/JMockitExtension.java shows that there is quite a lot going on...

But maybe there is a more straightforward way to solve the testing problem you want to solve with integrating jmockit with jqwik? In my experience, mocking is not often necessary when doing proberty-based testing. In the rare occassions in which I did use it Mockito was fully up to the job.

So if you like, open an issue describing your testing problem and we can try to find a solution for that.

from jqwik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.