Following on from the article A Brief Overview of Performance Code Profiling, other methods that can be used in the development process to improve the performance of code are
- Web service /API testing using virtualisation.
- Unit testing.
This article will explain the above types of testing from a performance point of view. Over the last few years, the use of web services and API’s have increased greatly which has meant that the testing of these components has expanded exponentially. This has introduced the concept of virtualization to the mix which can address the following situations:
- Testing API’s still under development
- Testing API’s owned by third parties
- Testing API’s that are expensive to use
- Testing API’s in Geographic or Security Restricted areas
What is a Web Service?
According to the W3C, a Web service is defined as:
“A web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other web-related standards.”
What is an API?
According to the Oxford dictionary, the definition of an API (Application Programming Interface) is “a set of programming tools that enables a program to communicate with another program or an operating system, and that helps software developers create their own applications (= pieces of software)”
What is Service /API Virtualisation and how can it be used for Web service/API testing?
Service/API virtualization allows your organisation to emulate any of the services (A service could be a network service, a telecommunication service, or a database) or API’s that are required to be in place for development/testing phases e.g. Virtualized services can allow performance tests to be carried out earlier in the lifecycle. During an agile project, it is important to set/establish performance goals when writing the user stories. These goals can then be performance tested during the development phase by using virtualized API/services. Also, check to see if you can reuse your functional API/Service tests for performance testing. These tests should then be included into the build process so that each build has an element of performance testing contained within it to identify any bottlenecks that may arise. By doing this you can always revert to an earlier build if performance has degraded. There are numerous tools out in the market which can be used to virtualize API/Services. Here are a few examples of these:
https://www.soapui.org/tools/readyapi/
https://www.microfocus.com/en-us/products/service-virtualization/overview
https://www.ibm.com/us-en/marketplace/rational-test-virtualization-server/details
https://www.tricentis.com/resources/orchestrated-service-virtualization
What is Unit testing?
This type of testing is performed by software developers where they test the smallest testable individual modules of an application e.g. functions, procedures or interfaces are tested to ascertain if they are fit for purpose.
What Performance tests can you run at the Unit Test Phase?
By shifting left we can introduce some performance tests at the unit test phase of the development process. Note the types of performance tests that can be run at this stage need to be fast-running performance tests e.g. tests that measure the time for a query to run or the time it takes for a function to run a series of nested loops. Note Performance tests that take a longer time to run and need a lot of setup need to be run later phase in the plan
Therefore, to improve the performance of code you should implement the above types of testing during the development phase.