Turn your manual testers into automation experts! Request a DemoStart testRigor Free

Tips & Tricks – Create stable tests with no dependence on implementation details.

How many times have your tests failed and then you realized that the HTML had changed? We will show you why you don’t need to worry about that with testRigor. You can create tests without a reliance on implementation by referencing elements in relation to other elements. This will save you hundreds of hours!

Connie Lund: Hello, and welcome to the testRigor Tips and Tricks session. And today, we’ll talk about how to create stable tests. And how many times have you been working on testing and the HTML changes in the background? Therefore, today, Artem, CEO of testRigor, will talk about the reliance on the implementation and why you don’t need to rely on that with testRigor. So Artem take it away.

Artem Golubev: Hello everyone. Let me start sharing my screen. And let me first quickly describe the problem, and then I will talk about how we address it on testRigor. Okay, so here is an example of a test case right on the left side Selenium, on the right, is testRigor. So what’s the problem with the one on the left. And basically, it relies a lot on details of implementation. And this is not what you want to do for your end-to-end test. Mind you, as you should for unit tests, of course, but the end-to-end test is not what is expected and what you’re looking for.

Because when you’re doing end-to-end tests, the whole purpose of end-to-end tested to make sure that the flow works from the end-users perspective. And if instead of presenting or testing it from a user’s perspective, view testing yet again, on the level of details of implementation, the challenge is that as soon as the page changes slightly, that test will break even though again, from a users perspective, everything is fine. And the examples here by any reliance on IDs, names, or especially XPaths, like in this case, would mean that your code will break as soon as any of those details change. And that also applies to everyone’s favorite data test IDs and custom attributes. The problem is the test IDs; all those custom attributes are bad. In 2022, engineers will have less and less control over how HTML is generated. In the modern world, people use libraries to generate HTML because HTML is becoming a low level of just implementation level detail or how things are rendered. This is not the level modern engineers are working on; we’re working on functionality level and use libraries to generate the code, and therefore we do not necessarily have direct control and a bug in the library they use to render those attributes impossible. Moreover, just asking your engineers to add this stuff might be a challenge in the first place. So that’s the challenge we are addressing. Well, multiple ways to do that. And in testRigor, we are working on end-users perspectives, saying things like click communication preferences, but in many cases, that might not be enough. For example, probably the most representative example is this Update button, which is the same for the two sections. For personal information and change your password section. And this is a relatively common issue for forms. Because there are situations, for example, when you move from one location to another or move money from account A to account B, when you might have two sections of the forms with identical inputs, but those sections are different. 

For example, this section is very moving from and then as this section is very moving too, but the address is, address fields are identical as always. And therefore, you need a way to refer to, for example, the second section or two sections where you’re going to, for like, the same city address and all those fields. So, in this particular example, how do you click on this button another letter, and testRigor gives you multiple ways. Of course, you can click the second embed, but a better way would be to hook it up into the section itself because, logically, this is part of the section. This update belongs to this section, which updates the long service section, which is how they are differentiated. So, therefore, you can say things like click Update below, change your password, or you can say things like click update and change your password section. That would also work in testRigor. And the point is, this relative location would give you the right input, right? So when you are entering data in from and to address, as you can say, below, or from, or below to, that would allow you to refer to the right fields correctly. Even though they will, they might not have anything whatsoever, including seriousness and everything like that. Anyway, or rows details will change. So again, your best bet is to make sure what stuff is as has been being expressed from the point of view and end-user. So this is one example, and an example would be working with tables. Let me show it again. So basically, when we work with tables, you often want to ensure that you are dealing with the right element. Right you are, for example, you want to delete a row that contains just this ID. You don’t want to delete the first one or whatever random one you want to delete this line that contains this ID. And whereas different syntax how to do it, you can express it in tables terms, as an example above, or you can rely on double relative location. 

You can say things like, click on the second button below actions and the right of SPK2. So that basically will create an intersection from two reference actions, and SPK2 highlights this area, and you will be able to click on this location. So this is one, and testRigor supports up to four relative locations by nesting them

So you can say hey, like select this area by various references, and within that area, you can define other references, references versus references. Moreover, let me show you for more fine grain, the syntax to refer to the stuff, and that would make sense in a second if you go documentation and in the documentation section, where is referencing locations section where you might want to go, and this is how you can refer to elements in general. And this section, I’m talking about the subsection selecting elements about other elements, which is what I’m talking about. So these are different ways to refer to a single reference with different relative locations. I could be diagonal, a little lower, and results here. And why I scrolled in here is I want to point out several interesting points here. So first, what does it mean when we say things like the below actions? What does it mean that one element is below another? 

Well, of course, if this element is small, it’s completely consumed below this with this text in here, like in this particular example was no question, but what if this element is large? And this referencing element is small. And when you say below, it is just, and it’s just only partially intersects. For example, if you’re talking about the whole line in here, but a whole row for this table probably has, I don’t know, like 20% overlap. With this column. Right, does it mean it is below this text? Or maybe it is below some other text with more intersection? So like, for example, additional data text is larger. When we say below, the mean that below ‘t be this row should be below this additional data below our actions. So therefore, to address this, we have a way to specify what it means to be below to clarify in a little more detail. What they mean by default it would be completely below, meaning that those overlaps are at least for the person. So they did it for as a person because there’s many situations like even jobs or even here is very intersection might not be completed. For example, if you try to click on the update below, the current password is quite small. Right? So if you’re looking just below current password update has only a partial intersection. So, we have found that from the human perspective surrounding 30% is roughly what people mean when they say below average. It should be below and overlapping by at least 50%. 

However, that’s not always the case. Sometimes, we mean below, somewhere below the cutting line. So for that, we have this element roughly. So what would it do? Is it was a say hey, like if you say to click on update the world changed roughly below change your password. What would it mean as it will find, change your password, create a cutting line, and everything below this line would be roughly below? So this way, it doesn’t have to intersect with this text; particularly, it would be considered below. In the case of this example of this table, this input this Delete button is below actions clearly, because it has 100% the intersection of this call and if you drove from sections, however, it’s not, it’s not below. This is the default definition of ours or recovers completely below additional data. However, it is roughly below additional data. What does it mean to get additional data text, create a cut-off line, and here everything below is obviously out of line? With your roughly below three because they’re awfully below additional data, but it’s not below additional data. It’s not completely below. Moreover, that’s even that is not enough in some cases, to in some cases you want to say yeah, but it should intersect like in this row, for example, by this intersection might be a little lower than 50%, which you have the default for that use cases you have. Intersection leave at least 20 or 10% overlap or whatever percent you want, or you actually in case you want to increase it they say hey, it should be at least 60% overlap. This is what I mean. In this scenario below. So you can fine-tune it by specifying specific percentages. So this is one way you have control over the meaning of the law because below would mean different things in different circumstances, and you have a way to address that. This is one, and before we switch to the questions, I want to point out one more important thing: the three-default behavior of multiple relative locations. 

So if you say things like the below actions and on the right of SPK two, the first reference automatically becomes a reference. Why? It was because it had been designed. So unlike this verbiage, which refers to tables where you would have complete below reference, then you saying below something and then the right of something v expect that you’ll have the first reference is a section. Because it is a section with that, you probably would want it to be rough, so if you have a double reference, like below something and then right of some things, the first reference would be roughly below, and the second would be completely on the right. So this way, it would get all this crud offline, and whatever’s on the right will still work in this part. The particular example might or might not work. In your example, you can fix this half-hour by saying something completely below actions and the SPK two on the right. You will achieve the same as you do with tables. By saying table, you’re already giving a tip on how relative location should behave. Anyway, so this is what I wanted to talk about. As you can see, relative locations are quite a complex topic. I want to stop and switch to questions, please.

Connie Lund: Does anyone have any questions? You can put them in the chat, or I can open your mic, and you can ask them out loud, Peter? Yes, Peter, I can open your mic. Go ahead, Peter.

Speaker Peter: I’m just wondering, do you know you guys constantly improve your application and products. So is there a constant improvement? Like, we’ve had some issues with the location where it doesn’t pick up? And some of it related to, obviously, our understanding of how the scripting goes and stuff, but how often do you improve it every time you do a bit push out? Or how often do you put this stuff?

Artem Golubev: set in stone almost because we have a huge number of customers using it right now, but it’s intentional, so we cannot change behavior much anymore. He’ll break

Speaker Peter: So when was the last time you pushed down enhancements just because I want to look at what we’ve done? See if there are better ways to what we did previously. Have you pushed out this enhancement recently, or has this core functionality been there for…

Artem Golubev: These are the core functionality that has been developed for a while? We probably don’t do a good job of going through it and explaining it in module one on onboarding sessions where they had been there for quite some time. And, like, we have Slack channels with our customers because if something doesn’t work as you would expect, this is very you pin gas and will help you look at it and help you find some stuff. So, for example, you might need to enable nested iframe support and all these different kinds of stuff in some cases. 

Speaker Peter: Okay, all right. Thank you.,

 Connie Lund: Okay. Thanks, Peter. Does anybody else have any questions? I can unmute your mic. Right, so is there anything else that you want to share with Artem and wrap up with?

Speaker Peter: Just have a question, are you recording this for me to get a copy of the recording just for reference, or?

Connie Lund: I’m sending it. I send the recording out after or link to it. So it should come by email to you.

Artem Golubev: Yep, another thing might affect relative locations, and you must be careful about that. So there is one pretty impactful setting. In testRigor, if you go to settings and go to Speed optimizations, and scroll down to the very bottom or are getting visibility of elements, how do we work with elements on the page, and by default, it is visible first. Well, we will only work if elements are visible to the end user at that moment on that page. So it was advanced, which you can see on the screenshot. However, if you create bashed approach, it will go through the entire page, and you will be able to work this all, even potentially visible elements. For example, if something is below the scroll line, you can’t see it, but you might be able to scroll to it. So keep in mind that the default approach is visible first. And that would mean that whatever you work with must be visible on this page. So you should scroll to it or something. Other than that

Connie Lund: All right. Thank you, everybody. The session next week is going to be on email testing. And we look forward to seeing you there, and we will be sending out this recording. Thank you


Related Articles

What is BDD 2.0 (SDD)?

The ability to document test scripts in the exact way the user intends has always been the ultimate dream for testers. Until the ...

Top 59 Test Automation Tools to Choose from in 2024

The quote precisely mentions the most important action point during software testing. When there is late bug detection in a ...