📜 ⬆️ ⬇️

BFT - Stream Testing

Good afternoon, Hobrechiteli!

image In my heading IT (Interesting Testing) I will try to tell you about various interesting approaches to testing and useful tools that make the process of finding errors fascinating.
Today I will tell you about:

Stream Testing (BFT - BusinessFlowTesting)

BFT is an approach to testing, where you look at a product not from the point of view of specific cases, but from the point of view of the behavior of the system at each of its points.
The approach is a combination of concepts such as Data Driven Testing and Behaviour Driven Testing, applied to business models that are well described by data movement graphs.
You do not test individual test cases, but test the performance of the system, test cases are obtained by themselves smile
Figuratively speaking, you have:
You have no test cases. Test cases are generated based on the input data themselves.
No more arguing about how to name test cases correctly. The name of the test case is the set of inputs that define it and the path they follow. The name turns out long, but completely describing this test. And besides, you do not spend a second on it - it is created by itself.

BFT Framework

How does the BFT framework work and how to make it yourself? Consider a simple example.
Suppose your application is a store selling goods. The main Acceptance tests will be tests on how the user purchases this product and what may happen next.
')
Business entities:
Order states:
Product transfer graph

image

You have a chart that is most likely provided by the business. If not, then you can make it yourself, which will bring a lot of benefit in itself.
To test this Chart, the tester describes each state.
To describe the state you need to specify:PS Both Checks and Transitions are a function of Context, i.e. dataset and path traveled (optional)

Each test is a linear path in this graph, which is characterized by input data.

image

Input data can be of several types:

Writing tests

Basic simple test
We have a business model graph. For this graph, we create a test code that describes, already in a programming language, what needs to be checked in each state and where to go next.
Bottom line: we have a test graph described (the graph does not have to be fully described at first, for example, only the positive scenario is described at first, all other states and transitions can be added as needed).

image

The first test is usually the main positive test that passes from the beginning of the business flow to the end without errors.
We form the input data for a positive test.

The test itself will look something like this:
var SimpleScenario = BusinessGraph.GetScenario(CorrectSimpleData, DefaultControllData);BFTFramework.Run(SimpleScenario, CorrectSimpleData);
BusinessGraph on input data CorrectSimpleData will build a linear script path (by default DefaultControllData) in the output graph we get SimpleScenario.
BFTFramework will execute this script with CorrectSimpleData input data.

The rest of the tests

Now, if we want to check a lot of different positive data, then we simply transfer other sets of CorrectOtherData.

If we need to add, let's say, negative tests (for example, the return of the purchase):And so on, gradually increasing our graph with new paths, and tests with new data sets.
If you decide to make a new check at any step, you do not need to think in which tests it occurs. You simply add it to the appropriate State, and all the tests that pass through it will be corrected.
A new state has emerged, through which our product must pass, simply add it to the graph, and all the tests that affect it will be redirected along a new path.
You edit the test code locally, only where it is needed.

Total:


Application area

Before you use something, think about whether this tool is right for you.
This approach is applicable to projects where you can easily identify business entities and the states in which they live.
It can be:In one of the departments of i-Free, we successfully applied this approach, I hope that it will also help you to make beautiful, easily supported, logged and visual tests.
What's next?

In the following articles:

Source: https://habr.com/ru/post/212567/


All Articles