Load/Stress Test with Unit Test Paradigm

I'm in love with the ability to load test against a unit test in Visual Studio Enterprise. However, I don't always have access to a Visual Studio Enterprise license. So I'm looking for a free load/stress test tool.

My intent is to use a unit-test environment (e.g. xUnit, MsTest), to integration-test my web service (REST, SOAP) requests. For example:

//NOTICE THAT THIS IS A C# UNIT TEST.
//IT WILL BE USED AS THE TARGET OF A LOAD-TEST.
[TestMethod, Benchmark]
public void Inventory_GetInv_Ok()
{
    //ARRANGE
    var items = new List<ItemRequest> {
        new ItemRequest { SKU = "0010015488000060", ReqQty = 2 } ,
        new ItemRequest { SKU = "0010015491000060", ReqQty = 1 }
        };

    //ACT
    //This is a WCF SOAP client making a service request.
    invResponse = client.GetInv("US", items);
    var inventory = invResponse.ItemInvResults;

    //ASSERT
    Assert.AreEqual(2, inventory.Count);
    Assert.IsTrue(inventory.Any(x => x.AvailQty > 0));
}

Visual Studio Enterprise does exactly what I want. It allows me to specify the quantity of concurrent requests, and the duration. Perfect!

However, as stated, I need to find a free (or much less expensive) alternative. In my search for a load-test tool, instead I'm finding fantastic profiler or benchmarking tools, such as:

Each of these tools will give me performance timings, but none of them provide stress tests or load tests. In other words, they do not simulate 10 or 20 simultaneous users. Each of the above tools profile each test in sequential fashion.

So the next options I might consider include JMeter, The Grinder or Gatling. However, these tools do not provide the harness (unit-test paradigm) that I'm looking for. Or, at least I don't believe they do.

Any suggestions?

Responses so far have suggested this might be a duplicate question...and refer to other SO questions that deal with load-testing tools that do not support a C# unit testing environment. This is why I provided the sample code, to be clear on the unit-testing environment capability I'm expecting from the tool.

1 answer

  • answered 2018-07-18 23:37 SWPhantom

    JMeter has been my go-to tool for testing Soap/Rest requests and I recommend it to others that need to do stress/load testing.

    Insofar as the unit testing, what exactly are you looking for? With JMeter, you can assert on many aspects of the response. I use response body asserts to verify expected values that our platform returns. I have also done post-processing and comparison load tests where the results from multiple servers are compared for correctness.

    To be fair, I don't have much experience with other load testing solutions. My team has tried newer tools, but we've been most successful with JMeter for our needs.