How to choose e2e test language?

How to choose e2e test language?

e2e_language

Some time ago I faced a big dilemma. In our company, we have two teams: back-end and front-end. When we start thinking about end-to-end testing in our current project, the discussion begins. We were thinking about the best technology to do it. We are using AngularJs in this project, so we want to take advantage of Protractor library. It is the library for testing Angular Single Page Applications without waiting after each action.

We have two possibilities.

  • write in TypeScript in JS environment,
  • write in C# and .NET environment

Each one of this approach has its advantages, but I want to present you my opinion on this subject.

.NET and C#

This combination is very easy for beginners. We don’t need too many configurations to start testing. It is a very extensible solution. C# has an important attribute – strong typing. It reduces errors and helps to write tests faster because every error is visible right after it is typed.

Moreover, we can prepare right architecture of test cases and PageObjects using inheritance and object creation.

There are many third party libraries to help us with everyday tasks. For example WebDriver.Support for manipulating select elements. We can also integrate .NET Selenium with many external services like [BrowserStack] for testing on many devices.

There is also good [Protractor.NET] library. It is a port o JS version, but it works pretty well.

It also has a very useful mechanism of debugging. You can stop the test execution at any point and check its state or test for selectors. Debugging is may be invaluable help during the development.

TypeScript

TypeScript is a strongly typed language as well, but in fact, it is much more liberal than C#. It is worse for newcomers, but if you already know what you do, it is very powerful.

Initial configuration of compiling TypeScript and running tests may be problematic even for experienced developers. It differs between versions and front-end environment changes fast. If you have people skilled in this area, you will manage to do this.

TypeScript has a weak mechanism of debugging. Holding on breakpoints is almost impossible. You can do this with debugger command, but you have to use it explicitly in your code. It is annoying if you need to stop on many lines in several executions.

Conclusion

If you have a separate team of testers, you should choose C# as a language for tests. It gives you a powerful object oriented and strongly typed mechanisms, that can speed up your test development and increase their quality.

However, if you don’t have a separate team and front-end team is responsible for end-to-end testing, you should do it in TypeScript. They already know this language and can easily integrate tests into the building or CI workflow.

You can find more information about end-to-end testing in my book

The power of end-to-end testing

cover6_small
See more
End-to-end testing is a great improvement in quality testing automation. It reflects the user experience the most of all tests.

This book is a complete guide to Selenium tools. Both for beginners and experienced developers.

It just makes sure that system works fine, saving your time after all.

%d bloggers like this: