Tests give us an assurance which application works fine. We usually want to execute them on some Continuous Integration servers. It is very convenient because we can configure them to run after each repository commit or once a day.
Continuous integration flow usually works as follows. The application is built on CI server and then it executes all tests. Because all tests run on the same database, it is hard to make all them all independent. However, test independence is a very important principle. The result of one test may affect the correctness of another test. It is especially problematic if we want to run tests in parallel. We can’t be sure what will be the order of execution. It is not only the problem of the database. The browser can also store a state of the application.
In this post, I want to show you the principles of the most useful pattern for end-to-end testing. I will use Selenium for all examples. I assume that you know this tool. It would be easier to explain some things.
Selenium WebDriver gives us powerful tools for writing end-to-end tests. We can imitate the user behavior on every aspect. However, it doesn’t come without some pain. It has several problems that testers must deal:
Beside of the normal usage, Selenium WebDriver has a lot of extra capabilities. The one of the most clever and not usual use of end-to-end testing is checking if web page fulfills accessibility rules.
Accessibility is a very broad topic, but there are some guidelines how to create the web application, that people with some disabilities (visual, hearing or manual) can use it. If we learn how to do this and on what elements we should focus to provide the accessible web site, it turns out to be very simple. There is few number of rules keep and that’s it. Screen readers or other software will take care of the rest.
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
Today I want to show you the method to minimize the initial amount of work. When we decide to use Page Objects pattern in our test code, we should map our web application pages to classes. It is not a creative task. That’s why we can try to automate it. By the definition of Page Object, we should take HTML structure and find all significant places and create class members for them. It sounds easy, but it may raise some problems. There are few different tools to generate Page Objects. We can notice two approaches among them.
Entity Framework change tracking optimization Data changes tracking Entity Framework gives us an opportunity to work with data without bothering to notify database about entity changes made during data processing. EF provides few methods of tracking this modifications. Snapshot change tracking By default in Entity Framework it is enabled snapshot change tracking mechanism. It works by saving entity states each time when it is loaded from the database. When for example SaveChanges method is called, Entity Framework scans all entities…
Read More Read More