API & Microservices Automation

Oct 18, 2019

11:45

Pune

45

As I understand that every instance of a microservice represents a single responsibility within your application. The real advantage is that, these services are independent of one another, which makes them independently deployable and testable.
so some approaches for how to go about automated testing are .

1. Unit Testing
The scope of unit testing is internal to the service. In terms of volume of tests, they are the largest in number. Unit tests should ideally be automated, depending on the development language and the framework within the service.

2. Contract Testing
Contract testing should treat each service as a black box and all the services must be called independently and their responses must be verified. Any dependencies of the service must be stubs that allow the service to function but do not interact with any other services. This helps avoid any complicated behavior that may be caused by external calls and turn the focus on performing the tests on a single service.

A “contract” is how a service call (where a specific result or output is expected for certain inputs) is referred to by the consumer-contract testing. Every consumer must receive the same results from a service over time, even if the service changes. There should be the flexibility to add more functionality as required to the Responses later on. However, these additions must not break the service functionality. If the service is designed in this manner, it will stay robust over longer durations and the consumers will not be required to modify their code to take into account the changes made later on.

3. Integration Testing
Verification of the services that have been individually tested must be performed. This critical part of microservice architecture testing relies on the proper functioning of inter-service communications. Service calls must be made with integration to external services, including error and success cases. Integration testing thus validates that the system is working together seamlessly and that the dependencies between the services are present as expected.

4. End-To-End Testing
End-to-end testing verifies that the entire process flows work correctly, including all service and DB integration. Thorough testing of operations that affect multiple services ensures that the system works together as a whole and satisfies all requirements. Frameworks like JBehave help automate Functional testing by taking user stories and verifying that the system behaves as expected.

5. UI/Functional Testing
User interface testing is the testing of the highest order as it tests the system as an end-user would use it. Testing of this level must feel like a user trying to interact with the system. All the databases, interfaces, internal and third-party services must work together seamlessly to produce the expected results.

6. API Testing
API testing is critical for automating testing because APIs now serve as the primary interface to application logic and because GUI tests are difficult to maintain with the short release cycles and frequent changes commonly used with Agile software development and DevOps.
APIs have evolved from simple code libraries that applications could use to run code on the same computer, to remote APIs that can be used to allow code on one computer to call code hosted somewhere else.

Here is a quick list of the more common API technologies that exist in approximate chronological order:

** Web Services (SOAP then REST)
** TCP/IP Sockets
** Remote Procedure Call (RPC)
** Common Object Request Broker Architecture (CORBA)
** java Remote Method Invocation (RMI) and Enterprise Java Beans (EJBs)
** Microsoft Distributed Component Object Model (DCOM) – also known as ActiveX

  • TestCon 2019
    Gaurav Mahajan

    Contentserv

Copyright 2020 Clavent. All rights reserved