Replies: 59 comments 28 replies
-
I think there is a misconception here. You first |
Beta Was this translation helpful? Give feedback.
-
Can you explain more what is missing in the execution of the system under test? |
Beta Was this translation helpful? Give feedback.
-
Typically
|
Beta Was this translation helpful? Give feedback.
-
Thank you for clarification. Is that any way I can assert it raises the correct exception like
But I got the error
|
Beta Was this translation helpful? Give feedback.
-
I still think there is something odd here. Are you experienced with mock driven development or TDD etc. ? E.g.
For your code, typically the real implementation of I see that the token you instantiate is an invalid token, but it is an instance of |
Beta Was this translation helpful? Give feedback.
-
I am not experienced with mock driven development or TDD. My main goal is to test if the input is valid or not. The instance
I don't want to execute the code in I am wrong when calling token with a
Is it normal if this error occur?
|
Beta Was this translation helpful? Give feedback.
-
Well now you get the Maybe it looks like:
If this is the function under test, then one test could look like:
These are just examples. To help you out, you should focus and maybe post the function-under-test. This function uses a dependency ( Everything else, we also have
|
Beta Was this translation helpful? Give feedback.
-
The function I test is
I need to test all the valid inputs, output type is |
Beta Was this translation helpful? Give feedback.
-
Ok, when You look at the dependencies: In
Make this test somehow pass. It gets easier if the first happy path passes.
And from there you test permutations and focus on edge cases and failing inputs. (There is probably already an error in the code as setting dn, sn, and e should throw.) Does this gets you started? |
Beta Was this translation helpful? Give feedback.
-
I got the error when running
|
Beta Was this translation helpful? Give feedback.
-
I thought To get you started I actually wrote it with |
Beta Was this translation helpful? Give feedback.
-
Thank you for clarifying that for me. I filled out the json value manually and don't care about the arguments
I want to confirm the output of test function, it works.
|
Beta Was this translation helpful? Give feedback.
-
I also tried to test if exception is raised, the correct message is showed. It works with
|
Beta Was this translation helpful? Give feedback.
-
I don't see why there should be any difference in the last example:
|
Beta Was this translation helpful? Give feedback.
-
That works. Thank you !!! |
Beta Was this translation helpful? Give feedback.
-
Are you sure you know what you're doing here? 😁
|
Beta Was this translation helpful? Give feedback.
-
And
so when I call |
Beta Was this translation helpful? Give feedback.
-
So you want to use a |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I don't think you should use It feels brittle to have a plain You can always do
to suppress the signature check (which gives you the I don't know why you put this call in the command. |
Beta Was this translation helpful? Give feedback.
-
I put Adding |
Beta Was this translation helpful? Give feedback.
-
This test should be fail because
So I remove
|
Beta Was this translation helpful? Give feedback.
-
Idk what's going on here. If result.stdout is a patch you did a |
Beta Was this translation helpful? Give feedback.
-
Btw you need to unstub on |
Beta Was this translation helpful? Give feedback.
-
I unstub on I tested for the valid case and the output of command is json and I mock the
|
Beta Was this translation helpful? Give feedback.
-
The code you posted just doesn't match. you mock |
Beta Was this translation helpful? Give feedback.
-
I tried with
|
Beta Was this translation helpful? Give feedback.
-
When you patch |
Beta Was this translation helpful? Give feedback.
-
is there any way I can get the json output when I do not patch |
Beta Was this translation helpful? Give feedback.
-
Hi,
The test function :
But I got the error. Is there any way I can mock this instance ?
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I tried to mock the input type of a function
create_service
inservices.py
.I am setting up a mock with
when
and then usingverify
to evaluate the valid or invalid inputs but I got the following error. Is there any way I can fix the error?mockito.verification.VerificationError: Wanted but not invoked: create_service(<Any: <class 'Token'>>, <Any: <class 'str'>>, None, None, 'p', False) Instead got: Nothing
Beta Was this translation helpful? Give feedback.
All reactions