This project is read-only.
1
Vote

LoadTestUserContext.UserId is not unique

description

This excerpt from page 208 is incorrect:
 "How to create guaranteed unique user IDs for UNIT tests
  Web tests have the ability to create unique user IDs for every user, but UNIT tests do not. The UserId property of the LoadTestUserContext object is *guaranteed to be unique among all running users*."
 
The LoadTestUserContext.UserId (and in a WebTest, the equivalent $WebTestUserId context parameter) is only "unique" within the same Scenario and on the same Agent. For example, if you have 2 Agents and 2 Scenarios in your LoadTest, you will actually have FOUR distinct users with UserId=0.
 
This means the code sample provided is only valid for a single Scenario on a single Agent, and likewise for any other solution relying on the uniqueness of UserId.
 
This behaviour also means that the results in the LoadTest results database can be misleading. For example, the LoadTestTestDetail table includes AgentId but it does not include Scenario, so two "User 0" in two different scenarios are indistinguishable in the test result.
 
The text should be amended to clarify that UserId is not unique beyond the trivial case.

comments