-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with 'plugin' option #27
Comments
Hi, thanks for the kind words! First of all, plugin library will implement the interface which will - as you done - return a dictionary of objects (mainly primitive types such as DateTime, string, int, etc) with string keys to replace placeholders. Let's say you want to send this request to your API:
where public class SuperbenchmarkerPlugin : IValueProvider
{
private Random _random = new Random();
public IDictionary<string, object> GetValues(int index)
{
return new Dictionary<string, object>
{
{
"fooValue",
_random.Next()
},
{
"barValue",
_random.NextDouble()
}
};
}
} and you would use Now going back to your issue. The exception probably has little to do with Alternatively you are using a different version of CommandLine library which conflicts with the version ilmerged. If none of above is true, please send me a repro project and I will try it out. Also this could be .NET 4.7. Can you please try with plain .NET 4.5.2? |
Oh, I think I got what you mean. The sb from nuget package is meant just as the library not the runner. You need to get the runner from chocolatey or download from nuget from the Download folder of this project - that has ilmerge of everything and is 4MB. |
Hi @aliostad , sorry for radio silence...getting slammed at work 😞 Ah, i see the problem...i was running the So now my next question, clarifying what you have above: if i understand correctly will substitute the e.g
then another request with:
So basically, i'm altering the JSON payload each request (not touching the URI/querystring) How can i do that with an Thanks again ✌️ |
Parameterising body is exactly the same, just remember to include So your template file would look like:
And in your class: public class SuperbenchmarkerPlugin : IValueProvider
{
private Random _random = new Random();
public IDictionary<string, object> GetValues(int index)
{
return new Dictionary<string, object>
{
{
"IDS",
string.join(",", Enumerable.Range(0, 2).Select(x => _random.Next()));
},
};
}
} You can randomise the number of items to send too but you get the idea. And then run
|
Awesome, i got it...just had to make sure i was referencing the plugin DLL via absolute. Thanks again @aliostad ! 😃 |
Hey @aliostad sorry one final question.. 😊 How can i use the I see you've got an example on the README:
Does the What i'm wondering, is what if i wanted to test say 3 sets of endpoints, using the plugin technique above? From the looks of it, i would have to create 3 seperate plugin DLL's, and 3 seperate Totally workable in the meantime, but in my particular example i have a few endpoints (all POST, with different JSON payloads), that i want to all hit with a single |
Yes you can,
Providing multiple templates not supported but nothing stops you to run it like this public class SuperbenchmarkerPlugin : IValueProvider
{
private Random _random = new Random();
public IDictionary<string, object> GetValues(int index)
return new Dictionary<string, object>
{
{
"URL_PATH",
"My_path"
},
{
"Payload",
"{blah blah}"
},
};
}
} and then alternate between patterns. |
Ah got it... thanks! |
Hi @aliostad
Firstly, awesome library...love it! 👏
I'm trying to get the
-p
plugin option working, and not having much luck. I'm just wanting to send a bunch ofPOST
requests with different JSON payloads.What i did
bin
directory of the above projectsb
command, and got an error looking for aCommandLine
package:Can you let me know what i'm doing wrong? Any chance you can update the README/examples section with a bit more info on the
-p
option?Also, can you please provide more info on how to correctly implement the
GetValues
method? What do thestring
andobject
dictionary keys represent?Thanks! 😃
The text was updated successfully, but these errors were encountered: