As more and more applications are deployed in the cloud, including Microsoft Azure, Google Cloud, Amazon AWS or domestic Alibaba Cloud, Tencent Cloud, etc., how to ensure that the production code (Production Code) that works normally locally is deployed After going to the cloud, can it continue to provide expected results? Also, when the application is deployed to a different platform, will it still be as responsive as it is locally? This involves two specialized topics: cloud based performance testing and performance testing.
This lesson will introduce the methods and strategies for these two tests separately.
Methods and Strategies for cloud based performance testing
The concept of "cloud based performance testing" actually includes two meanings:
1. From the local test machine, test the application deployed in the cloud (this method is also called "testing the cloud program").
2. Use a test machine located in the cloud to test applications deployed locally or in the cloud (also known as "testing with the cloud", or TaaS, that is, Test as a Service).
From a local test machine, test an application deployed in the cloud
According to my experience, the main differences between the testing of local programs and cloud programs include the following two points:
1. Login mechanism: In the local environment, because most of them are located inside the enterprise network, the login mechanism may be relatively simple. However, in the public cloud environment, for security reasons, cloud service providers provide a series of login mechanisms, which may invalidate the local test code. For this difference, developers need to consider the needs of cloud based performance testing during the development stage and provide certain API-level access methods. If it is a front-end UI test, you can generally directly enter the program interface by clicking the mouse and entering the account number, but this faces the security issue of whether to write the login password in the test code.
2. Network status: In the local enterprise network, the network conditions are predictable, but in the public cloud, the configuration of the network and virtual machines is often uncertain. This means that the test may fail due to some unknown factors. This means that when testing locally, it is also necessary to simulate certain network failures and configuration errors, and check how the production program handles these situations.
At the same time, cloud based performance testing also provides many useful functions. For example, cloud service providers generally provide comprehensive monitoring and diagnostic tools, which are convenient for testers and maintenance personnel to analyze the running status and find logs. Taking the ApplicationInsight service provided by Microsoft Azure as an example, users can see the response speed, status, and access load of each microservice, and all logs can be obtained through query, which is convenient for finding the root cause when a failure occurs.
All in all, if you are testing an application deployed in the cloud from a local test machine, you need to pay attention to the following three points:
1. In the development stage, the difference between the login mechanism deployed on the cloud and the local one is taken into account;
2. Simulate possible network failures and errors in the cloud during local testing;
3. Use the monitoring tools provided by the cloud service provider to comprehensively monitor the operation of microservices.
Testing with Cloud (TaaS)
This emerging model is called testing as a service (TaaS). Simply put, the process is: the cloud service provider provides a test platform (also known as "test cloud") that includes multiple browsers and multiple configurations. The development team first writes the automated test script locally, and then uploads it to Test Cloud, run these scripts from the cloud to test the targeted local or cloud application.
The benefits of this approach are obvious:
Save environment configuration time. Cloud based performance testing provides a complete set of testing environments. Testers log in to the testing environment by using virtual desktops and other means, and only need to set some simple parameters or provide simple test scripts to execute tests in the cloud immediately. This transfers the cost of software and hardware installation, environment configuration, and environment maintenance to the cloud testing provider (the operator of the public cloud or the maintenance team of the private cloud). With the current virtualization technology, after the tester specifies the hardware configuration, software stack (operating system, middleware, tool software), and network topology, it only takes a few hours to create a new test environment. If the tester can accept the standard test environment that has been created, they can log in immediately. Moreover, because it is a network-based application, when problems with software usage are encountered during the test, remote and fast support from the cloud test service provider can also be obtained, and the phenomenon of stagnation or even stop of the test rarely occurs.
Fully assembled. Cloud based performance testing can not only provide a complete testing environment, but also provide many additional services. For test machines, it can provide restore points so that testers can reset the virtual machine to a specified state. For test execution, it can monitor every move of the program under test, such as registry access, hard disk file read and write, network access, system log writing, system resource usage, memory image serialization, screen recording, etc. Displaying this information together with test cases can help testers find problems and locate errors. For large-scale testing, cloud testing can provide multiple test clients, download test cases from the master computer, execute and report the test results, and the master controller will summarize the results and report to the testers. In fact, these functions have been realized by various tools, and the task of the cloud test platform is to integrate them and provide unified and complete functions. In this way, testers can focus their efforts on their own testing domain to maximize their efforts, rather than managing various tools.