Automatic testing of web applications and frameworks like MSTest, NUnit, xUnit

IT Ocean blog

Blog subscription

28/01/19

Automatic Testing Of Web Applications And Popular Frameworks

Automatic Testing Of Web Applications And Popular Frameworks

Every software developer at least once in his or her career has found out how easy it is to destroy the look and performance of half of the application, even so the last changeset was about changes in this second, theoretically disconnected half. Unfortunately this is the nature of the malice of inanimate objects that you have to live with. Test engineers can help with that and this is the post about their work and tools.

Writing and automatic testing doesn’t differ that much from traditional source code writing, because, similarly to an application, automatic tests are created with the help of programming languages like C# or Python. A test engineer or ‘software developer in tests’, as they’re also called, have to pick the right language, IDE, framework to develop the tests in and the driver – a tool for translating the code to the specific actions run by a browser.

Driver, the most important of all tester’s tools

The easiest decision in life of every automatic tester is the type of driver, which is the tool for the communication between the IDE and the browser. The easiest, because on the list of relevant tools there is only one of them: Selenium Web Driver (SWD). SWD is unrivalled on the market, probably due to its proliferation; there are versions compatible with all important browsers out there and for running automatic tests in the background, without the need of opening up a browser’s window and the need for watching the running process. Aside from the freedom of tool picking for displaying the test, Selenium gives us the same freedom when it comes to picking the language in which a test’s script is going to be made of.

Personally I can recommend the work with only one browser – Chrome. There is a Selenium version for it, called ChromeDriver.

Available programming languages

If you have ever worked with the code and know at least one of the popular languages, I have good news – you can use the knowledge in test creation. On the list of Selenium-preferred languages there are, among others, Java, C#, Python, Ruby, PHP, Perl or JavaScript. This set of tremendously different languages can shock at first glance but it should came as no surprise that it’s a great advantage that can be put into the learning of automatic testing. Since you probably already know at least one previously mentioned technologies, the next phase should come easier. The creators of Selenium decided on making available the work with so many languages, so that tests can be written using the same technology as the source code. Thanks to this idea, in spear moments between fixing bugs or adding new functionalities, it’s easy to delegate group of developers to write automatic tests. It can be done after a few hours of intensive training as well.

Framework, or the icing on the cake

Each of the previously mentioned languages have at least one of the available frameworks for running automatic tests but I’m going to focus on the most popular ones for C# - MSTest, NUnit and xUnit. It’s necessary to add though, that all frameworks differ because of attributes they use or the method of tests configuration. Attributes are necessary for the correct test setup; with them we are marking classes with tests, tests themselves, a way for launching them and many more. These kind of subtle differences encourages to do experiments. You can figure out which tool is the most useful to you.

MSTest

One of the oldest and slowly fading framework used for automatic testing. It became a legend because of one thing: complicated and tough configuration. On many blogs dedicated to software development and application testing we can find developers’ relations that went through a correct attributes and configurability file config. Spoiler alert – it’s a challenge. But to even encourage you a little I have to mention that it has some benefits as well. In comparison to other frameworks – a huge technical documentation and full integration with IDE – Visual Studio.

NUnit

As popular as MSTest, NUnit is an open source tool for beginning your journey with testing. It’s easy to manage and there is a twin version for JAVA, distributed under the name Junit. The next and a very serious advantage of this framework is its adaptation to all languages supported by Microsoft .NET

xUnit

The team responsible for NUnit decided to simplify automatic testing even more and for that they created another and free tool – xUnit. This growing in popularity framework doesn’t bow to previously mentioned NUnit and allow for the creation in many programming languages like C#, F#, VB.NET, etc. A very big advantage of this language is a number of additional tools, expanded mostly by Microsoft developers, that ease building, launching and analysing the test package.

Attributes

I hope that this brief presentation of automatic testing has encouraged you to perform testing of your own. I also hope you’ll launch an application with less number of bugs, because the aforementioned tools are just the tip of a very big and challenging iceberg.

If you find yourself interested in our company and consider yourself a good match for CSHARK, contact us! If we currently don’t have the right job for you, we will keep your application on file.

//