Visual Studio 2010 Ultimate Web Performance Test and Load Test Virtual User Accounts

I need to download a test site. It uses crowd authentication to authenticate users.

I created a Visual Studio 2010 testing project and created an online performance test that signs using the username and password that I used to record the test. I connected the access database with the "Users" table, in which I linked to the login form, and the test suite launches a test for each row of data in the user table.

It all works as I expected.

Now I want to run a load test with a maximum of 250 concurrent users. How to tell Visual Studio to use a different username and password for each of the virtual users in the load test.

In short, I want to configure a profile for each virtual user in a load test.

+3
source share
1 answer

I would create a web test that uses only one login to login. Then you can create a small piece of code in a web test to get a "random" login from the database, a list in the code to select a login.

If you need a unique login for each test, you will need to evaluate how many logins are required and re-fill it.

, , . , , .

, , , .

   public static bool GetNextLogin(out string userName, out string password)
    {
        bool result = false;

        using (SqlConnection connection = new SqlConnection(loadTestLoginsConnection))
        {
            using (SqlCommand command = new SqlCommand("GetNextID", connection))
            {
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        userName = reader["UserName"].ToString().Trim();
                        password = reader["Password"].ToString().Trim();
                        result = true;
                    }
                }
            }
        }

        return result;
    }

, post. , WebTest.UserName WebTest.Password.

int CurrentLoginID

BEGIN TRANSACTION
        BEGIN TRY
            DECLARE @CurrentID AS INT
                UPDATE CurrentLoginID SET Number = Number+1
                SELECT @CurrentID = Number FROM CurrentLoginID
                SELECT [Password], UserName FROM AvailableLogins WHERE AvailableLogins.ID = @CurrentID
            COMMIT
            END TRY
        BEGIN CATCH
                DECLARE @ErrorMessage NVARCHAR(4000);
                DECLARE @ErrorSeverity INT;
                DECLARE @ErrorState INT;

                SELECT 
                    @ErrorMessage = ERROR_MESSAGE(),
                    @ErrorSeverity = ERROR_SEVERITY(),
                    @ErrorState = ERROR_STATE();

                -- Use RAISERROR inside the CATCH block to return error
                -- information about the original error that caused
                -- execution to jump to the CATCH block.
                RAISERROR (@ErrorMessage, -- Message text.
                           @ErrorSeverity, -- Severity.
                           @ErrorState -- State.
                           );
            ROLLBACK TRAN                 
        END CATCH
+4

Source: https://habr.com/ru/post/1756679/


All Articles