Ease usage of Fuzzers outside of parameters #978
Replies: 6 comments 2 replies
-
|
Hi @DevSavvySerge, As far as I understand, you want to receive the fuzzing value directly as a function argument and not the fuzzer instance. All of this would involve a lot of effort and would also destroy the existing API. When I introduced the fuzzer, I opted for the easier way, which is certainly not optimal but functional. Therefore, implementing this feature would take time that I don't currently have. |
Beta Was this translation helpful? Give feedback.
-
|
Not exactly what I had in mind but you're up to something even better than what I had in mind. Here was my exact case: I had to write: Where I could have written: Which was not a huge game changer. |
Beta Was this translation helpful? Give feedback.
-
|
You cannot use a fuzzer in this way. Can you please attach a complete example of exactly what you are doing? |
Beta Was this translation helpful? Give feedback.
-
|
Sure func test_load_resource_WhenCalledAndLoadingAlready_DoNotAddToResourcesLoadingOrStartsLoading() -> void:
var sut = mock(GlobalReduxSlice, CALL_REAL_FUNC) as GlobalReduxSlice
var path := StringFuzzer.new(10, 15).next_value()
do_return(true).on(sut).__is_loading(path)
sut.__load_resource = [StringFuzzer.new(10, 15).next_value(), StringFuzzer.new(10, 15).next_value()] as Array[String]
var expected = sut.__load_resource.duplicate()
sut.load_resource(path)
assert_array(sut.__load_resource).contains_same_exactly(expected)
verify(sut, 0).__load_threaded_request(any()) |
Beta Was this translation helpful? Give feedback.
-
|
Okay, that completely contradicts the actual purpose of the fuzzer as a test argument. The way I see it, they're misusing the fuzzers for their test setup here ;) |
Beta Was this translation helpful? Give feedback.
-
|
You are welcome to use the fuzzers in your test, but this is not the intended use case ;) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the
Fuzzershelper class provides convenient static functions for use as test method parameters, for example:However, using these fuzzers outside of parameterized tests (e.g., directly within test logic or custom scripts) can be cumbersome since the static methods all return the base Fuzzer type instead of the specific subtype (StringFuzzer, IntFuzzer, etc.).
This means that the returned object handles data as a generic Variant, losing the strong typing and specific features provided by the concrete fuzzer classes.
✅ Benefits
Beta Was this translation helpful? Give feedback.
All reactions