1
00:00:06,200 --> 00:00:08,400
Hello everyone. 
Today, we are going to discuss 

2
00:00:08,400 --> 00:00:12,800
the python behave Library. 
So, for those of us who are not 

3
00:00:12,800 --> 00:00:16,000
familiar with it, what is the 
behave library? 

4
00:00:16,000 --> 00:00:20,000
And how is it used? 
The behave is a python library 

5
00:00:20,400 --> 00:00:24,100
that allows us to write 
behavior-driven development bdd 

6
00:00:24,100 --> 00:00:27,100
tests for our python 
application. 

7
00:00:27,800 --> 00:00:32,500
Bdd is a software development 
methodology that emphasizes 

8
00:00:32,500 --> 00:00:35,900
collaboration between developers
QA teams. 

9
00:00:36,000 --> 00:00:41,100
Us and stakeholders with behave.
We can write tests in claim in 

10
00:00:41,108 --> 00:00:46,300
English, which makes them easy 
to understand and maintain even 

11
00:00:46,300 --> 00:00:51,500
for non-technical stakeholders 
but what are the disadvantages 

12
00:00:51,500 --> 00:00:54,100
you ask. 
Yes there are disadvantages. 

13
00:00:54,500 --> 00:00:58,600
First, we introduce a new 
library into the system, and 

14
00:00:58,600 --> 00:01:02,500
every time we introduce in the 
library it comes with, with all 

15
00:01:02,500 --> 00:01:05,900
the ten you Library, comes the 
need to maintain it. 

16
00:01:06,000 --> 00:01:10,300
They need to update it with 
security patches the learning 

17
00:01:10,300 --> 00:01:12,600
curve etc. 
Etc. 

18
00:01:12,600 --> 00:01:15,100
You know that way. 
So this is a new library. 

19
00:01:15,400 --> 00:01:17,900
There is another cone to using 
this Library. 

20
00:01:18,200 --> 00:01:22,500
The con is that once we start 
writing tests in the behave bdd 

21
00:01:22,800 --> 00:01:26,200
methodology, it's different. 
It's not looking like a normal 

22
00:01:26,200 --> 00:01:28,800
programming language, it's good 
to write tests. 

23
00:01:28,800 --> 00:01:34,400
I think it, it makes sense to 
itse the behave, but once we use

24
00:01:34,400 --> 00:01:40,100
it, Then we have to kind of test
those that are written in the 

25
00:01:40,100 --> 00:01:44,000
bdd methodology and those that 
are written in the let's say, 

26
00:01:44,000 --> 00:01:48,100
python do you notice? 
They didn't test library or the 

27
00:01:48,100 --> 00:01:50,300
pythons Library. 
So we need to maintain if 

28
00:01:50,600 --> 00:01:54,800
multiple things. 
It's, especially useful when we 

29
00:01:54,800 --> 00:02:00,200
want to provide non-technical 
people with the ability to Y 

30
00:02:00,200 --> 00:02:04,600
test because it's written, as we
said, in human language. 

31
00:02:05,200 --> 00:02:08,900
So So let's say that we are 
working on an e-commerce 

32
00:02:08,900 --> 00:02:12,400
websites that they can in 
example and we want to write 

33
00:02:12,400 --> 00:02:17,200
tests for the checkout process. 
So we might run, right. 

34
00:02:17,200 --> 00:02:22,400
Some feature file in the behave.
It's a, it's a finder feature in

35
00:02:22,400 --> 00:02:26,100
plain English that describes the
behavior of the to want to test.

36
00:02:26,800 --> 00:02:30,300
Of course, the computer would 
not understand this. 

37
00:02:30,700 --> 00:02:34,400
Normal language, we would need 
to provide another file, another

38
00:02:34,400 --> 00:02:37,200
couple of files. 
The environment fight, and then 

39
00:02:37,200 --> 00:02:41,300
there is that dot steps files, 
which would translate. 

40
00:02:41,400 --> 00:02:43,500
But it's pretty easy, it's not 
that hard. 

41
00:02:44,600 --> 00:02:48,900
If I made it and you will make 
it so you add and couple of more

42
00:02:48,900 --> 00:02:52,600
files to assist. 
So when you quite so basically 

43
00:02:52,600 --> 00:02:56,100
you have one file which is the 
file dot feature, then you add 

44
00:02:56,100 --> 00:02:58,600
multiple files that exist in 
order to test application. 

45
00:02:58,900 --> 00:03:02,000
Then you have a global 
environment file, then you have 

46
00:03:02,000 --> 00:03:05,300
the step, slide step size and 
the environment. 

47
00:03:05,500 --> 00:03:10,000
Five are supporting the dot 
feature files and how is it 

48
00:03:10,000 --> 00:03:14,500
looked like, how does the bdd 
look like the bill DDE? 

49
00:03:14,500 --> 00:03:18,500
Let's take the feature fight. 
Looks like this feature checkout

50
00:03:18,500 --> 00:03:22,400
process as the customer, I want 
to be able to check out and pay 

51
00:03:22,400 --> 00:03:26,000
for my atoms so that I can save 
my order scenario. 

52
00:03:26,400 --> 00:03:30,400
Successful, check out given I 
have added an item to my cart 

53
00:03:30,400 --> 00:03:34,300
and I have navigated to the 
checkout page when I entered 

54
00:03:34,300 --> 00:03:37,400
shipping and payment, you 
Mission and they click place 

55
00:03:37,400 --> 00:03:40,900
order button, then I should see 
a confirmation message. 

56
00:03:41,000 --> 00:03:44,300
So, you see, it's pretty like, 
normal human language and 

57
00:03:44,300 --> 00:03:48,300
straightforward, but things are 
not as those easy as it seems 

58
00:03:48,300 --> 00:03:51,500
because we can, we still need of
course to implement everything 

59
00:03:51,500 --> 00:03:54,400
behind this. 
So, once we have the feature 

60
00:03:54,400 --> 00:03:59,400
file written, we use the behave 
library, to generate the step 

61
00:03:59,400 --> 00:04:02,900
definitions, which are the code 
that actually executes this test

62
00:04:02,900 --> 00:04:05,700
at the test. 
And we would need to fill fill 

63
00:04:05,700 --> 00:04:11,400
in the steps. 
And once we run the tests using 

64
00:04:11,400 --> 00:04:15,500
behave in the command line, it 
will read our feature files, 

65
00:04:15,500 --> 00:04:18,600
match the steps to the 
appropriate, step definition, 

66
00:04:18,600 --> 00:04:22,500
and execute the steps. 
If a test fails behave with 

67
00:04:22,500 --> 00:04:28,600
provide us with the whole 
message, of course, So, so, 

68
00:04:28,600 --> 00:04:31,400
what's the difference? 
You ask the main difference in 

69
00:04:31,400 --> 00:04:35,600
behavior is that it allows us to
fight testing plan English, but 

70
00:04:35,600 --> 00:04:37,600
as we said, of course, we would 
need to support it. 

71
00:04:37,800 --> 00:04:40,400
So it's good. 
If you will need to give the 

72
00:04:40,700 --> 00:04:44,200
ability to high test, to someone
who's not a software developer, 

73
00:04:44,700 --> 00:04:50,000
which makes it easy to, to, to 
White test, we tell them what 

74
00:04:50,000 --> 00:04:53,500
are the abilities, the 
capabilities, what did the 

75
00:04:54,200 --> 00:04:57,800
software developer writing, the 
steps files That day. 

76
00:04:58,200 --> 00:05:01,300
Well, I'm not software 
developers would be able to 

77
00:05:01,300 --> 00:05:04,900
write such a filter feature 
files. 

78
00:05:05,800 --> 00:05:09,700
And let's talk about again about
the downsides and limitations of

79
00:05:09,700 --> 00:05:12,400
using the behavioral, the behave
Library. 

80
00:05:12,700 --> 00:05:15,900
So, one potential downside, is 
that writing a feature, files 

81
00:05:16,200 --> 00:05:18,500
can be time-consuming, 
especially for complex 

82
00:05:18,500 --> 00:05:22,000
application because it's not a 
programming language. 

83
00:05:22,400 --> 00:05:25,900
It can also be a challenge to 
come up with good test scenario.

84
00:05:26,400 --> 00:05:29,200
Covers all the relevant 
functionality and additionally 

85
00:05:29,200 --> 00:05:31,600
because behave is relatively new
library. 

86
00:05:32,000 --> 00:05:35,700
That might be a few resources 
available for Learning and 

87
00:05:35,700 --> 00:05:40,600
troubleshooting compared to the 
established testing Frameworks. 

88
00:05:40,800 --> 00:05:43,800
So the recommendation is to 
start a service to start small 

89
00:05:44,100 --> 00:05:49,300
and gradually, see if it fits us
and walk away to more complex 

90
00:05:49,300 --> 00:05:52,800
tests to. 
So impose the ton to collaborate

91
00:05:52,800 --> 00:05:56,300
with multiple people, with the 
clients would need to use. 

92
00:05:56,400 --> 00:05:59,300
Use this library and 
stakeholders and see that 

93
00:05:59,300 --> 00:06:01,800
everything matches the 
expectations.

