1
00:00:00,240 --> 00:00:06,250
All right, so this lecture is more like a lecture, which you can easily figure out.

2
00:00:06,270 --> 00:00:10,830
I mean, this is not even a lab kind of things, but I just felt that we have not discussed about it

3
00:00:10,830 --> 00:00:11,220
a lot.

4
00:00:11,380 --> 00:00:16,430
So I'm just going to be talking about it probably very quickly in this particular lecture.

5
00:00:16,440 --> 00:00:21,450
So it's not going to be that complex or modern like how you used to do in the network interception or

6
00:00:21,450 --> 00:00:21,900
cookies.

7
00:00:22,080 --> 00:00:27,400
But this is more like reading the data from a JSON file and using it for data driven testing.

8
00:00:27,450 --> 00:00:32,810
This is something like Don't ask me like how I can do Adriaan testing on the playwright.

9
00:00:32,820 --> 00:00:40,200
I think it was the same question asked by students in my puppeteer's, so I would like to add the same

10
00:00:40,350 --> 00:00:42,060
over here in this course as well.

11
00:00:42,420 --> 00:00:42,830
All right.

12
00:00:42,990 --> 00:00:45,470
So this lab is more diverse than they are doing testing.

13
00:00:45,480 --> 00:00:49,620
So what I'm going to do is I'm just going to go over here to that package.

14
00:00:49,620 --> 00:00:51,210
I'm going to create a folder.

15
00:00:51,510 --> 00:00:55,860
I'm going to call this as DDT for data driven testing.

16
00:00:56,160 --> 00:01:01,440
And over here, I'm going to create a new folder and I'll call this as probably data.

17
00:01:02,040 --> 00:01:10,050
And this data is going to have or hold a JS on file so that one file is going to be called as test data

18
00:01:10,050 --> 00:01:11,660
dart Jasen.

19
00:01:11,670 --> 00:01:18,770
So this guy is basically holding all the test data for our logging operation.

20
00:01:19,040 --> 00:01:25,620
So if you remember in our earlier tests that we wrote for the app Dorsami dot com website, we used

21
00:01:25,620 --> 00:01:30,620
to enter the user name as admin and password is password and the user details something like this.

22
00:01:30,630 --> 00:01:33,830
So this is going to be more like that in this particular test.

23
00:01:33,840 --> 00:01:39,570
I mean, it is going to enter all the user details over here and we're going to see if that works or

24
00:01:39,570 --> 00:01:40,740
not that simple.

25
00:01:40,740 --> 00:01:41,030
It is.

26
00:01:41,040 --> 00:01:42,900
It's super simple and super easy to do.

27
00:01:43,320 --> 00:01:50,040
So in order to do this, I'm actually going to copy paste the same exact code from what we wrote in

28
00:01:50,040 --> 00:01:51,750
our earlier sections.

29
00:01:52,110 --> 00:01:58,350
So I guess we have that on the network interception probably over here.

30
00:01:59,100 --> 00:02:00,660
Uh, oops.

31
00:02:00,660 --> 00:02:02,250
I think we deleted most of them.

32
00:02:02,250 --> 00:02:08,550
So I guess I need to create a new data driven test.

33
00:02:08,550 --> 00:02:11,300
Dargis and I'm going to pass this code.

34
00:02:11,610 --> 00:02:15,630
So this code is going to be pretty much exactly the same code that we wrote already.

35
00:02:15,900 --> 00:02:18,660
And the code is going to look something like this.

36
00:02:18,660 --> 00:02:23,330
I mean, this is the same code that we recorded in our work order earlier.

37
00:02:23,610 --> 00:02:27,280
So I'm just going to do or maybe make use of the same code here.

38
00:02:27,510 --> 00:02:32,460
So what it's going to do is it's going to log into the site and then it's going to enter the hardcoded

39
00:02:32,460 --> 00:02:33,900
value that we have at the moment.

40
00:02:34,110 --> 00:02:35,420
And then that's it.

41
00:02:35,430 --> 00:02:37,360
That's what it is going to be doing, basically.

42
00:02:37,590 --> 00:02:46,800
So if I just go to the DDT over here and if I do, unless it has the data and red ribbon testing, so

43
00:02:46,800 --> 00:02:52,650
I'm just going to do a node of data driven testing.

44
00:02:52,650 --> 00:02:57,290
Dargis So it is going to execute the code like how it used to execute it.

45
00:02:57,510 --> 00:03:02,970
So but all these data that we are entering at the moment on the app is basically from the hardcoded

46
00:03:02,970 --> 00:03:03,320
value.

47
00:03:03,330 --> 00:03:03,650
Right.

48
00:03:03,870 --> 00:03:06,500
So you can see that it is all hardcoded value.

49
00:03:06,510 --> 00:03:09,360
That's what it is entering to perform the operation.

50
00:03:09,630 --> 00:03:14,940
But instead of the hardcoded value that we have at the moment over here, I'm actually going to be making

51
00:03:14,940 --> 00:03:19,170
use of that data that we have in our strategies on file.

52
00:03:19,650 --> 00:03:25,470
In order to do this operation, we are actually going to be making use of a simple construct.

53
00:03:25,590 --> 00:03:30,180
All we going to do is we need to import that data in our test.

54
00:03:30,180 --> 00:03:36,300
So far doing that, I'm just going to do a required and because the power of JavaScript is you can easily

55
00:03:36,690 --> 00:03:41,190
get a JS on file using this.

56
00:03:41,580 --> 00:03:42,310
That's it.

57
00:03:42,330 --> 00:03:46,780
So if you do that, all the data on file is going to be automatically available for you.

58
00:03:47,100 --> 00:03:48,800
This is really, really cool.

59
00:03:48,960 --> 00:03:50,860
I mean, literally really, really cool.

60
00:03:51,180 --> 00:03:52,460
So I'll show you what I really mean.

61
00:03:52,470 --> 00:03:58,440
So if I just go over here on the data and if I want to replace this, I've been to the admin value that

62
00:03:58,440 --> 00:04:00,470
we have on over here.

63
00:04:00,600 --> 00:04:09,890
So I'm going to do is data darte if I just type login, which is nothing but this guy, the login dart

64
00:04:10,890 --> 00:04:11,660
user name.

65
00:04:12,090 --> 00:04:16,710
So if I just give this and if I save it over here, let me just stop the test.

66
00:04:17,130 --> 00:04:23,820
And if I try to run this test at the moment, I'm sorry to give a semicolon.

67
00:04:24,810 --> 00:04:32,040
And if I try to run this guy, you can see that it is going to open the test for me and it is also going

68
00:04:32,040 --> 00:04:35,250
to enter the admin over there, which is quite good, right?

69
00:04:35,510 --> 00:04:42,380
I mean, you could able to do the exact same thing using this particular simple code.

70
00:04:42,390 --> 00:04:45,000
So I just replaced the data log login, that username.

71
00:04:45,000 --> 00:04:47,740
So it's going to enter the user name for me from the design file.

72
00:04:48,090 --> 00:04:55,710
Similarly, if I want to enter the password so I can oops, sorry, I can go here and it can enter the

73
00:04:55,710 --> 00:04:59,760
password data dart and you can see that the intelligence is also.

74
00:05:00,050 --> 00:05:03,910
This time very handy, so it's going to automatically pass, that is on file.

75
00:05:04,160 --> 00:05:05,540
Read that for us.

76
00:05:05,570 --> 00:05:08,800
I'm just going to show us all the property over here, which is quite good.

77
00:05:09,020 --> 00:05:15,440
And similarly, you can keep replacing all these values as well, something like DataDot user.

78
00:05:16,580 --> 00:05:17,920
So this is going to be the name.

79
00:05:17,930 --> 00:05:18,620
So that's it.

80
00:05:18,950 --> 00:05:24,920
So did I not use user name is going to be the name and for the salary, I'm just going to enter the

81
00:05:25,580 --> 00:05:32,750
salary and for the duration work I can just replace that or the duration worked and for the grade I

82
00:05:32,750 --> 00:05:39,730
can just replace that to grade and for the e-mail I can just replace that to e-mail.

83
00:05:40,100 --> 00:05:40,630
That's it.

84
00:05:40,790 --> 00:05:41,680
Very, very simple.

85
00:05:41,990 --> 00:05:44,650
And once I do that, I can then save this.

86
00:05:44,660 --> 00:05:49,340
And then if I try to run this test, it is going to run as expected if I'm not wrong.

87
00:05:49,880 --> 00:05:51,020
So that is.

88
00:05:51,020 --> 00:05:51,620
It is, guys.

89
00:05:51,620 --> 00:05:57,110
I mean, this is really, really easy to work with while we try to perform any one testing.

90
00:05:57,380 --> 00:06:03,620
But do you think that every time I run the test, there is an operation to delete the user as well,

91
00:06:03,620 --> 00:06:05,270
like the user that we created?

92
00:06:05,480 --> 00:06:10,800
But because this is an hardcoded expert over here, the religion is not going to happen.

93
00:06:10,820 --> 00:06:12,640
I mean, it's literally not going to happen.

94
00:06:13,010 --> 00:06:19,280
So in order to delete this user, we should dynamically get the data or pass the value of the particular

95
00:06:19,280 --> 00:06:25,640
user test to user to delete this operation, which you can do it very, very easily.

96
00:06:25,760 --> 00:06:27,980
I think we can make this lab even more interesting.

97
00:06:28,130 --> 00:06:33,560
If you try to handle this dynamic delete operation, please try to do it yourself.

98
00:06:33,590 --> 00:06:37,120
If you can't really do it, we're going to discuss the same solution in our next video.
