![]() The latter was relevant for me because many of the developers and testers were not familiar with Scala - so keeping the load test code simple and understandable was valuable. However, the data is now fed from the test-data-generator project, the advantage being that all of that code is now kept separate and keeping the amount of Scala code to a minimum. This defines our load tests, controls how many requests per second and where we send the data. ![]() Here I have created an example Gatling project that uses both of the above projects as dependencies: The key point here is that we have a neat Java project to easily define and control this behaviour. ![]() Depending on what you’re trying to test, you may want to change it so its more random. In this case I’ve provided some examples where we randomly select from lists of reasonably realistic data - this is limiting the “randomness” of the data but keeping it more useful. Whereas in this project we are now defining and controlling what content we get in the String - we could make it totally random strings “Acse1234fggDG” or we could attempt to make it realistic “Billy Boat”. So for example, in the JSON schema we define objects such as a Name: It has definitions of what various fields should look like and controls how random this content is. This pulls in the above data-model as a dependency and then goes a step further and provides functions that return full JSON strings. Here I have created an example of what a test-data-generator project could look like: In my context, the developers had already created this and used it within their Java applications, so there wasn’t any work for me to do originally and it was extra useful to share the same effective “contract” in a sense - if the model changed it was only changed in one place and it was simply a case of increasing version numbers. ![]() It is basically a code representation of a JSON schema, where we define what a particular object looks like, so in this case I’ve gone with an example of a shopping basket where it has particular nested objects such as “customer” and fields like “name” - also defining what type of data these are (such as String or Integer). Here I have created an example of what a data-model project could look like: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |