Testing with micro-services – challenges in automated Testing of cloud solutions

Alex Alex 17 December 2019
Testing with micro-services – challenges in automated Testing of cloud solutions

A name value, complex, cloud to develop a solution without test automation is hardly possible. The majority of the Tests should be Unit Tests, i.e. Tests that test a defined program function automated. Dependencies by Mock objects will be replaced.

When I discuss with other development teams on the topic of automated Testing, I come across very different opinions and approaches. Some swear by the use of End-to-End Tests, the other set on Unit Tests, and others find it overrated automated Tests at all and rely on the Test manually, because automation is too expensive and unreliable.

Unit vs. integration vs. End-to-End Tests

in My opinion the Royal way, as is so often the case with the extreme positions. A complex cloud to develop a solution without test automation is hardly possible. It is thus the key DevOps principles, because manual Testing is time-consuming, therefore, only rarely in detail can be made. The consequence of this is that frequent Roll-out of software improvements is impossible. To focus on one type of test, such as End-to-End Tests, or Unit Tests, also brings nothing. To the mixture, it is, in my opinion:

the
    the
  • the majority of The Tests should be Unit Tests, i.e. Tests that test a defined program function automated. Dependencies by Mock objects will be replaced.
  • the
  • in A lower part should be integration tests. You test the Interaction of several parts of the program whose function has already been tested by Unit Tests. It has less Mock to be used-objects.
  • the
  • In the case of End-to-End Tests simulates a software robot to the user, and the full application of automated, operated via its user interface. These Tests are expensive to develop and should be used sparingly. The focus on a few key processes that process users in the Software and its correct Functioning is particularly important the
    the
    the
    the
    the
    the
    the
    the
    C# 8.0 cheat sheet
    the

    Free C# 8.0 – new language features at a glance

    the
    the

    The C#8.0 cheat sheet summarizes the new Features of the language together with a view to the current one .NET Core 3.0, respectively .NET Standard 2.1. Download now, and faster & effective the

of course, exceptions confirm the rule. An application which consists of UI, is different to test than an application, which revolves almost completely around complex Algorithms.

DevOps does not require full test coverage

I'm not a proponent of a one-hundred percent test coverage. Code,

the
    the
  • which is very simple in structure and thus a low risk of error has,
  • the
  • the follow-up costs of a contained error in the low, or
  • the
  • of the changes are very rare,

must not necessarily be tested automatically. It must not be forgotten that any automated testing is an investment and opportunity costs. Instead of developing the Test, could you add the Software from the user's point of view, valuable functions or other Tests to write. I've seen a few Teams at a very high level of test coverage of a fetish is, and at some point was more important than the implementation of User choice. It must not be forgotten that the DevOps principle of Continuous Flow of Customer Value consists of two Parts: Continuous Flow and Customer Value. Who is so busy, through the automation of the Continuous Flow, to ensure that no more time remains for the development of Customer Value, will have no success.

the challenge of micro-services

Unit-distinguishing Tests is hardly between classic and cloud native applications, which are composed of micro-services. A different case of integration and End - to-End Tests. For someone who is for the development of a back-end micro-service is responsible, are End-to-End and manual Tests that are a particular challenge. The own micro-service is only a small part of a larger Whole. In order to test the entire application, you need to play tens of different, technically heterogeneous micro-services together. Such an environment for Debugging and Tests is a challenge.

solution: Container

containers are a key element to the solution of this problem. As a developer, you can go micro-services, the need for integrative Tests, as the Container is high and does not need to take care of this to your system requirements. Without Container testing via micro service boundaries are often very difficult, because each micro service-specific settings, runtimes, Patches, needs, etc.

Microsoft has dedicated to this issue in the Azure Cloud a private product: Azure Dev Spaces. You make it Developers easy to developing a micro - service, and deploy for testing purposes in a Kubernetes environment in which the other micro-services are available. This reduces the requirements on power and proper setup of the development environment is enormous.

Who can't use a ready-made solution such as Dev Spaces, or wants, which should build the total solution so that Developers can integrate as easily as possible locally or in test environments, ongoing micro-services in a total environment. Here are some examples:

the
    the
  • It should be through configuration, a test environment to be set so that a certain micro-service can be replaced by a Test or development version. This must be taken into account in the development of the Service-Discovery-concept for the micro-services architecture.
  • the
  • Locally, for example, in the Debugger, running micro-services are not based in HTTP-communication to be so easy to integrate into an overall solution, which runs in the Cloud. Tools such as ngrok in this respect are helpful and should be made in collaboration with the network teams and the development teams. Alternatively, you can connect the local development network with VLANs in the Cloud (e.g. Azure VPN Gateway), and a combination of Cloud and development environment for Debugging and testing.
  • the
  • In the case of Message-based protocols (such as Azure Service Bus), it plays often a smaller role whether a communication partner in the Cloud and the other on a development machine or in a test environment.

Infrastructure as a flexible Resource

The Cloud is not automated, integrative Testing, but only more difficult, it also enables new scenarios and practices. Who Configure it on the manual its cloud environment, on any of the colorful portals omitted, and instead, true to the DevOps mentality and the cloud to work on Scripts to automate, which may at any time and without great expense test environments for integration and End-to-End drive Tests high. Instead of such testing on local servers run that are bored most of the day, rolling out to a new environment in the Cloud, makes the Tests run, and deletes it at the end of everything. By the usage-based pricing model in the Cloud, the costs for this approach are minimal.

in addition, you can be by this test approach can always be sure that you can at any time establish a completely new cloud environment from the ground up. There are many situations where this is useful. Here are some examples:

the
    the
  • if You want to venture into new geographical regions, and decides, in the corresponding data center to a new production environment again.
  • the
  • You are forced to due to a problem (e.g., data center failure, DDoS attack), in the short term to a new Deployment upgrade.
  • the
  • You need a short-term production same environment for Tests that are not in the production environment is feasible (e.g., Destructive Testing, load tests, penetration tests).
  • the
  • development teams can roll out without the large expense of production of the same environments in which they other Teams, new versions of the software can provide (for example, exploratory testing by test team, acceptance testing by the customer, testing by Friendly Customers, etc.).
  • the
  • to be used For training or demonstration scenarios can be making production of the same environments.

test data generator

In this context, I recommend thinking about whether the respective project to the automated Roll-out of cloud environments, the optional filling with test data is valuable. In the case of many of the above examples, it would be helpful if the application created would not be filled, empty, but with data. This test data should not be static. They should be generated via Scripts, so that you are up to date (e.g., date of transactions generated in a current time range), and the amount of test data is configurable (e.g. for load tests).

There are in the Cloud, a lot of useful test data generators, for certain categories of data (e.g., names of people or products, countries, numbers, values with a defined, static distribution, GPS coordinates, credit card numbers, Profile pictures) to generate test data. An Internet search with terms such as Generate Test Data puts you on the right track. Many generators are for small-scale scenarios for free, but mostly paid price plans, in which larger amounts of data can be generated. The test data is available via Webservices and can be integrated into Scripts for automated building of test environments.

Headless Coding

Regardless of whether or not automated or manual is to be tested, even with smart Deployment scripts, containers and Dev Spaces, the integrative Test of a micro service is, in the context of the overall system is a challenge. Normally, it is usual to start with a click, the development environment for a Debug Session within seconds. Is connected but in order for a Deployment in any cloud environment, extended the time for the Start of the Tests, or a debugger, to many seconds, maybe even minutes. In this respect, Unit Tests is, in my view, in connection with micro-services are of particular importance. They allow me as a developer, my Code without a UI, so headless to try and debug. Increase due to the reduced waiting time my productivity. This is in addition to the commonly expressed advantages such as positive impact on the software design, documentation, character and protection against regressions, an important Argument for Unit Tests and weighs the disadvantage of the maintenance effort for the Tests to be a part of.

the

Windows Developer

Windows DeveloperThis article appeared in the Windows Developer. Windows Developer provides comprehensive and vendor-neutral about new Trends and possibilities of Software and system development around Microsoft technologies.

of Course, you can use the Windows Developer on the developers.kiosk digital in the Browser or on their Android and iOS Devices read. In addition, the Windows Developer is still available as a Print magazine in the subscription available.

the
the
the
the
the

Source: entwickler.de

Comments (0)

    No comments yet

You must be logged in to comment.