When we are working on a feature, it sometimes happens that we might introduce a bug. Now there are testers who will found these bugs, but it's actually a burden for them as they have to go through each and every test case again. This is where automation tests will come into the picture,
According to Softwaretestinghelp,
Automation testing is a Software testing technique to test and compare the actual outcome with the expected outcome. This can be achieved by writing test scripts or using any automation testing tool. Test automation is used to automate repetitive tasks and other testing tasks which are difficult to perform manually.
But basically as a C# developer and an Angular developer, we usually cover the code with our developer unit tests so basically almost all the functional part is covered. Recently we were facing issues with the UI and thus UI Automation Testing was a need of the hour. UI Automation tests are nothing but checking if the UI is working fine or not, that means the button is clickable, the website is working in different browsers or in different browser's language etc.
In one of my previous post # Supporting Multiple Browsers for Web Developers,
One thing which we have to take care of is supporting multiple browsers, that means Chrome, Firefox, IE and Edge all these browsers have to be supported. The problem arises when some things work on some browsers but do not work on other browsers like recently I have to modify the scroll bar to make it touch-friendly, the easiest option is to change the CSS which works only in case of chrome but other browsers we don't have that option. Similarly, even if some of the browsers are on the same technology still some browsers support something whereas some browsers don't.
Thus one of the use cases for UI automation tests was to test our code in all different browser all at once instead of manually checking it everywhere. We were testing some of the frameworks, but at last, zeroed at Specflow.
The good part of spec flow is that writing automated tests is so easy, just like plain text. As you can see below, if I am making a Calculator and if I want to see additional functionality is working fine or not, it's as easy as writing just like below. Though I also need to add a function which will return the addition of 50 and 70, but i.e. just one line of code.
The above example is just a normal code example, but what we had to do for UI Automation is to
- Launch the Browser with the test URL
- Find any element you want to test, like a Button or Label
- Check if the Button is clickable or check if the label is displayed or not or etc.
These all things are just an example of how easy to get started, though we do have spent some time in creating the framework for UI Automation, and now all the developers whoever is writing UI component have to write the UI Automation test cases. This I think is one of the good addition along with unit tests because in that way we will not miss the obvious UI bug which we (developers and testers) might have missed. Now with this change, we are writing Code, Unit Tests, Integration Tests and also the UI Tests and though it adds up some time for developers to deliver their task still now we are less prone of delivering the obvious bugs which we might send to the testers (why make their life easy).