We’ve talked a lot about automated interview questions in the past, but with automation, the question comes up again.

You definitely want to think about layering

Interviewer: How do you understand the idea of automated testing layering? I’ve seen a lot of hiring requirements that directly write this, and will automate the idea of layering first. What you mean? Anything that’s a priority is a plus.

So, why have this automatic layering? What exactly does automatic layering do?

Then you need to make that clear to the interviewer

That you can say: when our script can realize automation, can let us automatically to little point, and then we want to consider the stability of the script, because you might say a background, automation more and more cases, data is also more and more. To improve script maintainability, stability, readability, reusability, and so on, we need to layer automation scripts.

What is stratification? What exactly is stratification?

It’s like a cake, one layer, two layers, three layers…

What’s the difference between the first floor and the second?

The first layer should be less than the second, and as you go down, the cake should be bigger, okay?

In fact, the principle of script layering is to let different layers do different types of things, professional people do professional things, so that our code structure is clearer, there is a lot of code can be reused, a lot of things are reused, so we will layer the code.

So what are the layers?

Object library layer, business layer, logic layer, data layer

Of course some things can be put together, and depending on the layers, you can encapsulate it three or four times, so that’s one more encapsulation.

We encapsulate these layers two or three times.

Object library layer

First you think of an object, what is an object? You do UI automation, what is an object? Are buttons, input boxes, and elements on a website objects?

Encapsulate all the elements of a system into a single level.

In our framework, for example, there is a POM that manages elements in many pages, including how they operate. And it can encapsulate some common services.

What is business? Login is a business, order is a business, just like doing functional testing, a function is a business.

For example, order search is a business, and business is divided into logic, so it is very detailed.

Why is business divided into logic? Because depending on things, it goes in different directions, like search results come up, I click on them, and if they don’t come up, so there’s a lot of logic involved.

And then in those businesses, of course, there are a lot of public methods, so the logical layer may also include the logical processing layer, and there will be a lot of public methods called, so a lot of keywords called.

So the data layer is pretty easy to understand, so LET me pull out all the data, so let’s say we do interface tests. I’m taking all the required parameters of some interface, and I’m encapsulating it.

I opened an Excel sheet in this framework, and this is the data of our interface project. I pulled out all the data and put it into an Excel sheet, which has nothing to do with this code.

The data for these interfaces, you see, the input parameter, the assertion, and of course I’ve only put two here, I’ve pulled out a lot of data, where do I pull it? There are many ways to extract (Excel, YAML…)

To summarize

Background: More automated use cases, more data,

Purpose: Hierarchy of script maintainability, stability, readability, and reusability?

Layers: object library layer, business layer, logical processing layer, data layer

Focused on all the blogger is — — — — — — — –, left left left left left left left left down down down down down down down left left left left left left left left left left down down down down down down down down down left left left left left left left left left down down down down down down down down

Finally:

1, Like, favorites. To prevent the future can not find, want to see, in their home page can be found, very convenient;

Pay attention to me. Let’s make it a long term relationship, next content will share more hardcore dry stuff;

3. Article learning resources can be shared free of charge.

Public number: Programmer Yifan. There are nearly a hundred of them. Thanks for your support!

At present, the development of the test platform project has been completed and it is open source on Github. Interested friends can go to Github to download it

Github.com/ooqitech/AT…

Don’t just be a person who never stops collecting and never starts taking action. Many things become self-taught when you are doing them. If in the process of doing also can a little bit of thinking, a little look at other people’s experience and practice, growth will be faster, the effect will be better! Come on, tester! Road in the foot, success in tomorrow!

I am an, output valuable content, if you are in full bloom, breeze!

Creation is not easy, do not want to be white whoring, your “praise” is the biggest power of creation, we will see you in the next article!