| Topic | Presenter | Summary | Duration | Tags | Quiz | Captions |
| ---------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------- | ---- | -------- |
| Unit Tests | James Gray | This video discusses Unit Testing: why we do it, how we do it at Clarity, how to run a test and more. #DevTraining, #FridayDevTraining, #ClarityDevelopers | 53:01 | #UnitTests, #WeeklyDevTrainings, #FridayDevTrainings, #DeveloperTraining, | N/A | |00:00:00.570 --> 00:00:04.749 - Testing It's annoying is extra work. It almost doubled their 00:00:04.749 --> 00:00:07.859 - workload depending on what you're trying to do with it. 00:00:08.380 --> 00:00:12.070 - Um? And a lot of people think that testing is absolutely 00:00:12.070 --> 00:00:15.047 - useless. You would rather just have a person go try it, and if 00:00:15.047 --> 00:00:19.760 - it works, it works. Um kind of stuff like that, but all that is 00:00:19.760 --> 00:00:22.990 - baloney, um, so you should really do testing. Testing is 00:00:22.990 --> 00:00:25.251 - good, I think is why testing is. 00:00:25.770 --> 00:00:30.376 - Why you make sure that, uh, not only can you say that it works, 00:00:30.376 --> 00:00:34.653 - but you can actually prove it with a thing that says that it 00:00:34.653 --> 00:00:36.298 - passes versus fails on a 00:00:36.298 --> 00:00:39.970 - consistent basis. We used to have testing projects all over 00:00:39.970 --> 00:00:43.710 - the place that were like every provider had its own testing 00:00:43.710 --> 00:00:47.400 - project. Um and stuff like that. Unfortunately, that ballooned 00:00:47.400 --> 00:00:52.015 - the number of projects that we had and how many DLL files are 00:00:52.015 --> 00:00:55.920 - getting copied into bin folders all over the place, which made 00:00:55.920 --> 00:01:00.180 - the physical install size of Seth B12 gigs with a full build 00:01:00.180 --> 00:01:05.150 - versus like 6 or 7 gigs that it is right now. Now that we've 00:01:05.150 --> 00:01:09.410 - combined them all into this one, I think combine them all in 00:01:09.410 --> 00:01:13.315 - that. There are a couple here that are separated still on 00:01:13.315 --> 00:01:15.090 - purpose and then like there's 00:01:15.090 --> 00:01:18.900 - like. The client ones here. They are separated. That is because, 00:01:18.900 --> 00:01:21.933 - uh, they have special requirements on them that, like 00:01:21.933 --> 00:01:25.640 - you can't use the same project for like they have modifications 00:01:25.640 --> 00:01:29.347 - to the app config or different references that they need to 00:01:29.347 --> 00:01:32.717 - special out. Namely, like the heartland testing one for the 00:01:32.717 --> 00:01:34.065 - payment provider, there they 00:01:34.065 --> 00:01:36.940 - require. It's uhithinkits.net standard, uh, XML document 00:01:36.940 --> 00:01:40.660 - reader and writer here, which is really annoying that you have to 00:01:40.660 --> 00:01:44.380 - do that. But it's just a requirement of their DLL, so we 00:01:44.380 --> 00:01:47.790 - don't want to interfering with the rest of the print providers 00:01:47.790 --> 00:01:51.200 - or anything when everyone else is doing their normal stuff. So 00:01:51.200 --> 00:01:55.230 - we hit that once separated off, and then we have this Oracle one 00:01:55.230 --> 00:01:58.950 - set up so that it can do its separate connection to the 00:01:58.950 --> 00:02:01.740 - Oracle databases, and it's different way for testing until 00:02:01.740 --> 00:02:03.290 - we can close that out. 00:02:03.900 --> 00:02:08.380 - Uhm, and then the UI one. This is the old selenium testing I am 00:02:08.380 --> 00:02:09.660 - bringing in newer selenium 00:02:09.660 --> 00:02:12.010 - testing to it. Um? 00:02:12.890 --> 00:02:16.883 - I don't even know where is buying or I think they're 00:02:16.883 --> 00:02:18.335 - actually in another branch. 00:02:18.340 --> 00:02:21.475 - So I had the selenium testing inside this project. Right now 00:02:21.475 --> 00:02:24.895 - I'm a pull that over to this project to train. Just reduce 00:02:24.895 --> 00:02:28.315 - this one. But this is also not referencing more than just the 00:02:28.315 --> 00:02:31.735 - data model, so it's not actually popping out a whole bunch of 00:02:31.735 --> 00:02:35.155 - separate DLL or anything, so not making a huge impact by having 00:02:35.155 --> 00:02:36.580 - it leopard at the moment. 00:02:36.950 --> 00:02:40.844 - Helping itself, um, one of the issues that or what there's 00:02:40.844 --> 00:02:44.384 - different kinds of testing that you could do in different 00:02:44.384 --> 00:02:47.570 - places, and we've tried different types overtime and we 00:02:47.570 --> 00:02:51.818 - kind of settled on something that kind of go to court work 00:02:51.818 --> 00:02:52.880 - best for us. 00:02:52.890 --> 00:02:56.949 - With with different things and we have them all super different 00:02:56.949 --> 00:03:01.008 - names like I think if Chris Reddick remembers at one point 00:03:01.008 --> 00:03:04.698 - we had these super awesome like shadow ninja warrior tests. 00:03:05.200 --> 00:03:09.316 - That we talked about, and then there's like end to end tests. 00:03:09.316 --> 00:03:13.089 - There's the test that come from Jasmine. That which has the 00:03:13.089 --> 00:03:15.833 - storefront there. Selenium testing, which is, you know, 00:03:15.833 --> 00:03:19.949 - mirroring what end user would do by clicking through pages on the 00:03:19.949 --> 00:03:23.379 - website. There's there's unit testing and testing. We kind of 00:03:23.379 --> 00:03:27.152 - ends up being about balloon term that different people use for 00:03:27.152 --> 00:03:30.239 - different things. One of those things would be like. 00:03:30.850 --> 00:03:35.422 - You load up a class, you take out everything except for one 00:03:35.422 --> 00:03:39.613 - function. Um, were property, and then you pass that into another 00:03:39.613 --> 00:03:44.185 - class of the function, and then make sure that the result is 00:03:44.185 --> 00:03:45.709 - what you were expecting. 00:03:46.400 --> 00:03:50.060 - Which is like a micro micro. Testing your testing a very tiny 00:03:50.060 --> 00:03:53.720 - thing in a very perfect vacuum that says that you might use 00:03:53.720 --> 00:03:57.380 - like a simple math function that says that make sure that when 00:03:57.380 --> 00:04:01.345 - this value gets passed in with a 5, but function supposed to add 00:04:01.345 --> 00:04:05.310 - 2 to it. So we get a setting back kind of thing. That's 00:04:05.310 --> 00:04:08.055 - that's really micro testing isolation. It has no bigger 00:04:08.055 --> 00:04:11.715 - picture around what's going on in the rest of the system. What 00:04:11.715 --> 00:04:15.070 - may be involved, data that gets loaded in from a database, 00:04:15.070 --> 00:04:17.815 - anything like that that might've happened inside that function. 00:04:17.860 --> 00:04:22.241 - It's just considered a black box and it supposed to only do that 00:04:22.241 --> 00:04:26.285 - one thing and that just proved that that one thing happened and 00:04:26.285 --> 00:04:28.307 - anything beyond that is icing on 00:04:28.307 --> 00:04:32.401 - the cake. That that what happens is a secondary action. Generally 00:04:32.401 --> 00:04:36.949 - speaking, we don't go to down to that level of micro testing 00:04:36.949 --> 00:04:41.390 - where. It's just kind of, uh, uh, doing that black boxing 00:04:41.390 --> 00:04:45.266 - thing because there are so many moving parts in the system and 00:04:45.266 --> 00:04:49.465 - we often would run into places where if you try to do something 00:04:49.465 --> 00:04:53.018 - so isolated, then when something else that was in a different 00:04:53.018 --> 00:04:56.248 - area that would have affected this function broke, they would 00:04:56.248 --> 00:04:59.801 - have no identification to that because it was so isolated it 00:04:59.801 --> 00:05:03.677 - didn't know about that other change. So in our case, what we 00:05:03.677 --> 00:05:08.199 - kind of do is it's a more broad section of unit testing in that 00:05:08.199 --> 00:05:12.398 - I'm kind of testing for one or a small group of things with. 00:05:12.520 --> 00:05:15.875 - With a single test, but it's physically aware of the entire 00:05:15.875 --> 00:05:19.840 - system. Whenever it does it. So if the function is called that I 00:05:19.840 --> 00:05:23.805 - need to make goes, it has to go like it's in the product 00:05:23.805 --> 00:05:26.550 - workflow and the product workflow function here it needs 00:05:26.550 --> 00:05:30.210 - to call out to something in the users workflow and the vendors 00:05:30.210 --> 00:05:33.870 - workflow in the stores workflow in order to get data from those 00:05:33.870 --> 00:05:36.615 - other locations or run additional functions or test or 00:05:36.615 --> 00:05:39.360 - additional like workflows and changes that would need to 00:05:39.360 --> 00:05:42.105 - affect how this function physically does what it's going 00:05:42.105 --> 00:05:45.831 - to do. Um, it can do all of those things, and the only 00:05:45.831 --> 00:05:48.360 - thing that's quote Unquote fake is an actual database. 00:05:49.650 --> 00:05:53.082 - Uh, so kind of you know, the biggest thing about what we have 00:05:53.082 --> 00:05:55.986 - here in one of the most complicated things which it took 00:05:55.986 --> 00:05:58.890 - me several years to get through multiple iterations of to figure 00:05:58.890 --> 00:06:03.114 - out the best way to do this. and I say best way in that I'm not 00:06:03.114 --> 00:06:06.282 - aware of anyone online who does it this way. This seems really 00:06:06.282 --> 00:06:09.714 - weird and unique to clarity, but it does seem to work really well 00:06:09.714 --> 00:06:13.146 - for us on what we're doing in kind of proving and mocking out 00:06:13.146 --> 00:06:16.314 - a database in order to make sure that the system functions like 00:06:16.314 --> 00:06:20.010 - it would in a real scenario and still give us and do all the 00:06:20.010 --> 00:06:21.594 - things that we wanted to do. 00:06:21.700 --> 00:06:25.574 - And also tell us you know, you know when Breakers got added to 00:06:25.574 --> 00:06:29.448 - a table or a safe changes was called in the context or things 00:06:29.448 --> 00:06:33.322 - like that. So that works out really well in a lot of what 00:06:33.322 --> 00:06:36.600 - we're trying to do in making sure that everything is going 00:06:36.600 --> 00:06:39.282 - smoothly whenever changes occur inside the system. It's not 00:06:39.282 --> 00:06:43.156 - perfect, no system would be, and the only thing I could say in 00:06:43.156 --> 00:06:46.732 - that if we want it to be more perfect or have more 00:06:46.732 --> 00:06:49.414 - capabilities overtime it's about getting through an building more 00:06:49.414 --> 00:06:50.606 - and more code coverage. 00:06:51.370 --> 00:06:57.572 - Uh. And in getting a making sure that the more of the system 00:06:57.572 --> 00:07:01.544 - is physically covered so that we can say that areas that are 00:07:01.544 --> 00:07:05.185 - currently not covered, in which case if they change they might 00:07:05.185 --> 00:07:08.495 - break something else. If we had that physically exercise that 00:07:08.495 --> 00:07:12.798 - that area, then we be more aware of when things happen and when 00:07:12.798 --> 00:07:16.108 - things change. In a perfect world, we'd probably would even 00:07:16.108 --> 00:07:19.749 - go down to having all the back Enders operating with test 00:07:19.749 --> 00:07:23.059 - driven development, which is you physically write the test 1st 00:07:23.059 --> 00:07:26.615 - and then. You make sure that the test is failing because even it 00:07:26.615 --> 00:07:29.420 - barely even trying to exercise the function and then you start 00:07:29.420 --> 00:07:32.735 - working on your function to make it past the test that you needed 00:07:32.735 --> 00:07:36.050 - to do so. If you're saying that supposed to be a simple math 00:07:36.050 --> 00:07:39.365 - function, it supposed to add 2 to the Five and come back with 00:07:39.365 --> 00:07:43.190 - the Seven. You have to check in for a 7 at the end, but you 00:07:43.190 --> 00:07:45.995 - haven't even written the function to do that yet, so it's 00:07:45.995 --> 00:07:49.055 - failing at first when you run the test, you visibly modify the 00:07:49.055 --> 00:07:52.370 - function you make it do the things it needs to do, and then 00:07:52.370 --> 00:07:53.645 - the the test itself starts 00:07:53.645 --> 00:07:57.770 - passing. Um? Now that is extra time and things like that, and 00:07:57.770 --> 00:08:00.938 - if you're on a deadline and there's a client who was like 00:08:00.938 --> 00:08:03.842 - I'm not paying for extra hours blah blah blah, there's always 00:08:03.842 --> 00:08:06.746 - going to be exceptions. And things like that need to happen. 00:08:06.746 --> 00:08:10.442 - I know that Chris has said in the past that he's OK with most 00:08:10.442 --> 00:08:13.610 - of our clients being or nearly all of our clients being like, 00:08:13.610 --> 00:08:17.042 - you know, we're going to do this extra work because it costs so 00:08:17.042 --> 00:08:18.362 - much on the back end. 00:08:18.430 --> 00:08:23.232 - After the fact of you know things we had to go back and fix 00:08:23.232 --> 00:08:27.005 - because it wasn't 100% effective on what we were doing, but. 00:08:27.650 --> 00:08:30.000 - Uh, we kind of still haven't really, truly enforced that 00:08:30.000 --> 00:08:32.350 - throughout the system, and any questions about what I've said 00:08:32.350 --> 00:08:35.640 - so far before I start going into like more of a real like, I'm 00:08:35.640 --> 00:08:38.460 - going to start showing you like how we market database and how 00:08:38.460 --> 00:08:39.635 - we write in actual test. 00:08:41.550 --> 00:08:48.630 - I have a question, so if you are you said that a 00:08:48.630 --> 00:08:51.998 - test. In your version, uh. 00:08:53.360 --> 00:08:56.814 - Uh, combine both. Let's say the workflow product of user and 00:08:56.814 --> 00:09:01.210 - isn't that a lot of things. If the test fails, how do you know 00:09:01.210 --> 00:09:04.664 - them? What actually failed is a problem in product. Is the 00:09:04.664 --> 00:09:08.118 - problem in weather or wherever we already did? It depends when 00:09:08.118 --> 00:09:11.886 - workflow itself and what it's trying to do. In most cases like 00:09:11.886 --> 00:09:15.340 - an exception will get thrown from wherever the point is or 00:09:15.340 --> 00:09:19.108 - the data will not come out correctly. And then I'll have to 00:09:19.108 --> 00:09:22.562 - go through and run a debug session on it where it's 00:09:22.562 --> 00:09:25.074 - attached and physically following the test and step 00:09:25.074 --> 00:09:26.958 - through it and see where the. 00:09:27.110 --> 00:09:32.654 - Where it goes already? OK, uh, what we'll do then is uhm. 00:09:33.360 --> 00:09:36.737 - The first thing here, it will here I'll start with a. 00:09:37.800 --> 00:09:40.848 - Talking about the test, one of the T4 tests that we have. 00:09:42.170 --> 00:09:46.832 - So we have all these tables and all these table. Uh, as many of 00:09:46.832 --> 00:09:51.161 - you know and some of you bring not uhm, we run T forward 00:09:51.161 --> 00:09:53.825 - throughout the entire system that primarily function against 00:09:53.825 --> 00:09:57.488 - the data model or we would have things like an account. 00:09:58.090 --> 00:10:01.434 - Um, the account says that it has these sorts of interfaces 00:10:01.434 --> 00:10:05.386 - that it conforms to, like how it talks like how it links to 00:10:05.386 --> 00:10:08.426 - stores, how it links to users, etc. With these individual 00:10:08.426 --> 00:10:11.770 - properties on them. For every table that we have in the 00:10:11.770 --> 00:10:15.114 - database, which equates to one profile here around a lot of 00:10:15.114 --> 00:10:16.026 - these separate folders. 00:10:17.380 --> 00:10:23.048 - Uh, we run actual to interfaces and we run T fours that generate 00:10:23.048 --> 00:10:25.228 - content for all of these 00:10:25.228 --> 00:10:28.996 - different sections. The services layer includes, uhm, we go to 00:10:28.996 --> 00:10:31.852 - the services layer. These services layer includes end 00:10:31.852 --> 00:10:36.136 - points for all this stuff that are basically an extended set of 00:10:36.136 --> 00:10:39.349 - crud operations. So you got create, update, read, create, 00:10:39.349 --> 00:10:43.990 - update, read, delete, and if I say in that order its curd. But 00:10:43.990 --> 00:10:47.560 - it's Crud. Whatever we add onto that, like Deactivate and 00:10:47.560 --> 00:10:51.130 - reactivate, which is like the soft delete software store from 00:10:51.130 --> 00:10:55.057 - kind of like putting something in the Recycle bin and pulling 00:10:55.057 --> 00:10:56.128 - it back out. 00:10:56.190 --> 00:11:00.337 - We also have stuff that says get it by, not just by an 00:11:00.337 --> 00:11:04.484 - identifier, but also by the custom key or by SCO URL or by 00:11:04.484 --> 00:11:08.312 - display name or by name. We have a lot of extra extended 00:11:08.312 --> 00:11:11.502 - functions like that. A lot of these different entities in 00:11:11.502 --> 00:11:15.330 - here. So like here's the get account by SEO URL which provide 00:11:15.330 --> 00:11:18.839 - their own individual routes and stuff on there, similar to how 00:11:18.839 --> 00:11:22.986 - we have all these extended crowd operations. Here I have a set of 00:11:22.986 --> 00:11:24.900 - tests that will happen for each 00:11:24.900 --> 00:11:29.376 - table by default. Um in here that will run things like, you 00:11:29.376 --> 00:11:32.940 - know, checking my ID, uh, that exists. That doesn't exist with 00:11:32.940 --> 00:11:36.828 - an invalid ID checked by a key that exists that doesn't exist 00:11:36.828 --> 00:11:40.716 - with an invalid key, so will go through. It will exercise some 00:11:40.716 --> 00:11:44.280 - positive and negative paths on these things to make sure that 00:11:44.280 --> 00:11:48.816 - on a positive path we get an ID that were kind of expecting that 00:11:48.816 --> 00:11:52.704 - doesn't exist. We would get a null or that it's invalid ID, 00:11:52.704 --> 00:11:55.944 - meaning stuff is probably like a negative one, which is 00:11:55.944 --> 00:11:57.240 - completely invalid for an 00:11:57.240 --> 00:12:00.618 - identifier. Uh, that would it would throw an invalid operation 00:12:00.618 --> 00:12:03.938 - exception. All the functions themselves should be named in a 00:12:03.938 --> 00:12:05.266 - similar format like verify. 00:12:06.030 --> 00:12:07.370 - The function that we're calling. 00:12:07.990 --> 00:12:11.894 - With whatever kind of information that we're doing 00:12:11.894 --> 00:12:15.877 - should. Do something so and something could be like returns 00:12:15.877 --> 00:12:18.514 - of returns. A valid value returns a particular negative 00:12:18.514 --> 00:12:22.030 - value, like a null, or it returns a or it doesn't even 00:12:22.030 --> 00:12:24.667 - return it, just physically throws an exception and checks 00:12:24.667 --> 00:12:28.476 - for that kind of thing. And thanks for the way this T4 is 00:12:28.476 --> 00:12:31.992 - written. It could actually Check all of these at the same time. 00:12:32.620 --> 00:12:36.260 - Using a thing to kind of reduce the amount of time that it takes 00:12:36.260 --> 00:12:39.120 - for the test. Typically run and get through all of these 00:12:39.120 --> 00:12:42.500 - separate things at once and then I get to know exactly where the 00:12:42.500 --> 00:12:45.100 - problem is. If this function failed to throw this exception, 00:12:45.100 --> 00:12:47.440 - it will actually throw a different exception that says 00:12:47.440 --> 00:12:51.340 - that the test it do what it was supposed to do and let me know 00:12:51.340 --> 00:12:54.460 - that this test on this path stack trace with failed and how 00:12:54.460 --> 00:12:58.100 - to go fix it. Or maybe not how to fix it? Like where the 00:12:58.100 --> 00:13:02.260 - problem is so they can go get it fixed myself if I go in and look 00:13:02.260 --> 00:13:03.300 - at one of these. 00:13:03.370 --> 00:13:06.711 - Gonna go into this one. This is download an abstract base and it 00:13:06.711 --> 00:13:08.253 - kind of just inherits what that 00:13:08.253 --> 00:13:13.258 - information is. And pulled it over to these individual pieces. 00:13:13.770 --> 00:13:16.872 - Um, there several things about how this test is structure that 00:13:16.872 --> 00:13:20.820 - I'm going to go over and explain in detail to kind of get you 00:13:20.820 --> 00:13:23.922 - guys at understanding what is going on here. But the first 00:13:23.922 --> 00:13:27.588 - thing that we need to do and I'm sure everyone who's looked at 00:13:27.588 --> 00:13:30.690 - the back end as recognize familiar with the name on text 00:13:30.690 --> 00:13:33.792 - profile name and it's a string. That string is used fricking 00:13:33.792 --> 00:13:38.420 - everywhere. Um, what this does and what it means, is it 00:13:38.420 --> 00:13:42.523 - throughout the entire system it supposed to be able to pass 00:13:42.523 --> 00:13:46.999 - around this string value. To say this is the context under which 00:13:46.999 --> 00:13:50.729 - we are running, and that context isolates what's happening inside 00:13:50.729 --> 00:13:54.832 - this test against any other test or live production thing that's 00:13:54.832 --> 00:13:58.189 - happening at the same time, so that they they. 00:13:58.230 --> 00:14:01.730 - Virtually don't interfere with each other at all. There still 00:14:01.730 --> 00:14:05.580 - cases where it can because it's like static variables and things 00:14:05.580 --> 00:14:09.080 - like that. But in virtually every context of what happening 00:14:09.080 --> 00:14:13.740 - this. And I think my head that shut off at some point. Do we 00:14:13.740 --> 00:14:15.300 - know when I last last audio? 00:14:16.030 --> 00:14:19.759 - So I said context profile name in, uh, except for aesthetic 00:14:19.759 --> 00:14:23.149 - scenario, they should help it isolate in alive running website 00:14:23.149 --> 00:14:26.539 - such as the QA, flight, staging site production, whatever. That 00:14:26.539 --> 00:14:30.607 - will always be null so that in those scenarios you don't have 00:14:30.607 --> 00:14:35.014 - to worry about like trying to find a name and match it up 00:14:35.014 --> 00:14:38.404 - somewhere or whatever. The only time it Contacts profile name 00:14:38.404 --> 00:14:41.794 - will actually have values is when you're running these tests. 00:14:42.420 --> 00:14:45.579 - Um, so that they they they test themselves, can run side by side 00:14:45.579 --> 00:14:48.738 - at the same time. But they are talking to each other, but there 00:14:48.738 --> 00:14:51.411 - are only running under the context that it grabs by that 00:14:51.411 --> 00:14:55.820 - single name. So when we do that, we create this context profile 00:14:55.820 --> 00:15:00.328 - name and what it does is like this is the name of the that's 00:15:00.328 --> 00:15:04.514 - going into it. And if you follow in the function it goes and 00:15:04.514 --> 00:15:08.056 - appends the type of the thing that's that's running it. So 00:15:08.056 --> 00:15:09.344 - this accounts workflow here. 00:15:10.040 --> 00:15:14.340 - Count workflow tests. Uh, it says. Accounts accounts that are 00:15:14.340 --> 00:15:18.816 - workflow test. Um gets a good trip ended onto that testing. 00:15:19.440 --> 00:15:24.042 - Um, so does that, and then it says pipe and then the actual 00:15:24.042 --> 00:15:28.998 - like the function name that got it like I passed in so that each 00:15:28.998 --> 00:15:33.246 - individual task it goes in there and it gets processed. So maybe 00:15:33.246 --> 00:15:35.370 - account account Standard workflow test pipe. 00:15:35.540 --> 00:15:38.936 - Verify a check is this Friday that exist should return an ID. 00:15:38.936 --> 00:15:42.049 - All is one continuous string with a pipe in the middle. 00:15:42.980 --> 00:15:46.258 - And that's how it gets that name for isolation. So every 00:15:46.258 --> 00:15:49.536 - individual one that runs only ever deals with that one thing 00:15:49.536 --> 00:15:54.006 - I'm going to close that and I'm going to go back a step here. Or 00:15:54.006 --> 00:15:56.092 - did the function we were in and 00:15:56.092 --> 00:15:58.400 - do that. Back over here is with you the whole thing. 00:15:59.900 --> 00:16:04.151 - Hope I just close that file so I'm gonna do the recently closed 00:16:04.151 --> 00:16:06.113 - and reopened that that mean to 00:16:06.113 --> 00:16:10.606 - close it. A man then I want check exist by ID right here so 00:16:10.606 --> 00:16:13.334 - I'm not go ahead and laps everything and expand this one 00:16:13.334 --> 00:16:15.070 - so I have just this one open. 00:16:15.600 --> 00:16:18.444 - It's really clear and obvious in the video. This is what I'm 00:16:18.444 --> 00:16:23.610 - looking at. Why make this name coming out of here? That's that 00:16:23.610 --> 00:16:28.050 - generates for the test and I'm going to pass his name into 00:16:28.050 --> 00:16:32.490 - these other locations here. What we do first here is we created 00:16:32.490 --> 00:16:36.560 - using that says to create a child container. Now a child 00:16:36.560 --> 00:16:40.630 - container in our registry loader deals with structure map in our. 00:16:40.630 --> 00:16:43.220 - Our dependency injection are dynamic injection, dependency 00:16:43.220 --> 00:16:47.290 - injection, inversion of control. All of those names kind of apply 00:16:47.290 --> 00:16:49.140 - here for what we're doing. 00:16:49.710 --> 00:16:54.671 - The root container is the container in which all of the 00:16:54.671 --> 00:16:58.730 - different types of injections and using throughout the system 00:16:58.730 --> 00:17:03.691 - get loaded into all at once. So it's like the foresighted 00:17:03.691 --> 00:17:08.201 - interface used concrete class, so if it submits requested to 00:17:08.201 --> 00:17:12.711 - ask for an generate a new, for instance, that clarity, 00:17:12.711 --> 00:17:16.770 - converse, quantity, sorry, Clary ecommerce entity class, which is 00:17:16.770 --> 00:17:19.927 - our database are entity framework database class. 00:17:19.960 --> 00:17:23.752 - Um, then it would go through any would generate a live connection 00:17:23.752 --> 00:17:28.176 - to a database if we were to just straight up, use it with passing 00:17:28.176 --> 00:17:33.372 - a null. As the context profile name, what we do here is we set 00:17:33.372 --> 00:17:37.404 - up a child container that says as a subset of that massive 00:17:37.404 --> 00:17:40.764 - container. I'm going to have this little container here where 00:17:40.764 --> 00:17:44.796 - I'm going to load customisations into it. And then I wanted to 00:17:44.796 --> 00:17:49.164 - use this container instead of the route one as we go so the 00:17:49.164 --> 00:17:52.860 - child will inherit everything from the parent and then as it 00:17:52.860 --> 00:17:56.556 - does stuff inside the child it will allow it to override 00:17:56.556 --> 00:17:59.916 - specific instances of the parents so that we can do. 00:17:59.970 --> 00:18:04.810 - You know custom work that's going to happen for this test 00:18:04.810 --> 00:18:07.840 - specifically. So we created using where we do, we create the 00:18:07.840 --> 00:18:10.162 - child container. It's a disposable, so we could put 00:18:10.162 --> 00:18:12.742 - inside of using and then we reference this child container 00:18:12.742 --> 00:18:14.032 - as we pass it in. 00:18:15.060 --> 00:18:18.330 - This next line hear the mocking setup goes into actually 00:18:18.330 --> 00:18:21.600 - creating the mocking database setup, so here it calls the 00:18:21.600 --> 00:18:25.197 - blocking set up with existing data for this table and expanded 00:18:25.197 --> 00:18:29.500 - tables. So that function leads me over here and this function 00:18:29.500 --> 00:18:33.119 - by itself does nothing here at this level, but at the 00:18:33.119 --> 00:18:36.080 - overwritten level it would actually do specify stuff up 00:18:36.080 --> 00:18:40.738 - here. So that's it. This is the function that overwrites it and 00:18:40.738 --> 00:18:44.434 - it basically says to create a mocking setup and it tells it 00:18:44.434 --> 00:18:48.438 - all the tables that we want to set up inside of our mock 00:18:48.438 --> 00:18:51.826 - database. You can see we have the account table. We have 00:18:51.826 --> 00:18:53.366 - accounts, associations, Contacts, currency assignments, 00:18:53.366 --> 00:18:56.446 - account files, and then some other things like Contacts you 00:18:56.446 --> 00:18:59.526 - know getting into the country in the region tables, store 00:18:59.526 --> 00:19:02.606 - accounts, the users, the vendor account tables, all these tables 00:19:02.606 --> 00:19:06.918 - we were telling it so that when it goes to create a mock context 00:19:06.918 --> 00:19:08.458 - which is our mock database. 00:19:08.520 --> 00:19:13.187 - We wanted to assign an generate data for all of those tables for 00:19:13.187 --> 00:19:14.264 - use with this. 00:19:16.660 --> 00:19:20.605 - Uh, so and I'll go over how how it does that in a moment here. 00:19:20.605 --> 00:19:23.761 - But first we get back here. But basically this is just saying 00:19:23.761 --> 00:19:26.917 - create the setup and these are the tables that we wanted to 00:19:26.917 --> 00:19:30.073 - eventually create, but it's not done that yet. When we call the 00:19:30.073 --> 00:19:31.388 - do set up a sync. 00:19:31.960 --> 00:19:35.110 - Or passing in the child container that we created were 00:19:35.110 --> 00:19:38.575 - passing in that mocking setup and we're passing passing in the 00:19:38.575 --> 00:19:41.725 - name of that context profile that we created into here. 00:19:42.580 --> 00:19:46.420 - And in the first thing that we do is we go to the mocking step 00:19:46.420 --> 00:19:49.492 - and say do the mocking setup for the context and give it 00:19:49.492 --> 00:19:52.820 - that name and we're doing it in an async capacity. So I'll go 00:19:52.820 --> 00:19:53.844 - into that function there. 00:19:55.590 --> 00:19:58.890 - Now what it does is if the setup already been completed because 00:19:58.890 --> 00:20:01.365 - something else had already called it, great, we just 00:20:01.365 --> 00:20:04.115 - returned the context and we're done. Meanwhile, if it hasn't 00:20:04.115 --> 00:20:06.865 - happened, then we say the setup complete is false. We're 00:20:06.865 --> 00:20:10.440 - starting to set up and then we'll see. You can see down here 00:20:10.440 --> 00:20:13.465 - that we've got the set of complete true. So basically in 00:20:13.465 --> 00:20:16.490 - between. Here these two points. Nothing else should try to start 00:20:16.490 --> 00:20:19.790 - it again. Try to do additional work. That way you know if 00:20:19.790 --> 00:20:22.540 - something is processing. It leads to do the processing in 00:20:22.540 --> 00:20:25.290 - place. There's alternate methods that could do. Here we're likely 00:20:25.290 --> 00:20:27.215 - to assign a task and have that 00:20:27.215 --> 00:20:30.274 - task. Get Fed back to other things to will wait for that 00:20:30.274 --> 00:20:33.086 - task to finish up. But I never finished migrating to 00:20:33.086 --> 00:20:36.180 - that. When we went to a sink, and as far as I could tell 00:20:36.180 --> 00:20:39.053 - there were no issues with it. So I'm kind of left it alone. 00:20:40.650 --> 00:20:44.095 - And then we basically get into the first thing here is that we 00:20:44.095 --> 00:20:47.275 - create on bot context. Now the mark context as a mouse. Over 00:20:47.275 --> 00:20:51.250 - here you may not be able to see the video 'cause it might be a 00:20:51.250 --> 00:20:54.430 - little too small, but it's a mock of at the interface. For 00:20:54.430 --> 00:20:56.550 - clarity, Commerce entities, which is our database context 00:20:56.550 --> 00:21:00.882 - class interface. And what it specifies inside there if I go 00:21:00.882 --> 00:21:04.490 - here, it's actually right there, and if I go to here. 00:21:05.110 --> 00:21:08.542 - This is one of the T fours that's down in the data model 00:21:08.542 --> 00:21:13.296 - project. Um, that says that, uh, it should have. It should be a, 00:21:13.296 --> 00:21:17.172 - uh, an interface that specifies that is a DB context. It should 00:21:17.172 --> 00:21:21.371 - have the context profile name on it, so we could pass that around 00:21:21.371 --> 00:21:24.601 - with it easily, and it should basically have all the 00:21:24.601 --> 00:21:28.800 - individual tables on it as DB sets, which when you look at the 00:21:28.800 --> 00:21:31.707 - concrete of clarity conference entities, this is what normally 00:21:31.707 --> 00:21:35.906 - get done. Get built out in alive scenario is all of these things 00:21:35.906 --> 00:21:39.136 - with all that stuff it's just conforming to that same 00:21:39.136 --> 00:21:42.600 - interface. And going through all this stuff, but in our case 00:21:42.600 --> 00:21:46.054 - here, when we're working with the tests were not going to 00:21:46.054 --> 00:21:49.822 - generate this class, we're going to generate a mock of it. Now. 00:21:49.822 --> 00:21:53.590 - Mark is provided by MOQ. It's a, It's a standard library that 00:21:53.590 --> 00:21:56.416 - because the new get package and it provides convenience 00:21:56.416 --> 00:22:00.498 - functions for a lot of testing purposes in a lot of places so 00:22:00.498 --> 00:22:04.580 - that we can do. We can call a function and then if that 00:22:04.580 --> 00:22:08.034 - function is mocked it says how many times that function was 00:22:08.034 --> 00:22:09.604 - called and things like that. 00:22:10.220 --> 00:22:14.191 - And we could do things like, you know, was the save 00:22:14.191 --> 00:22:17.440 - changes called? Was you know what happened when a 00:22:17.440 --> 00:22:20.328 - particular function on this class was called with 00:22:20.328 --> 00:22:23.216 - particular arguments and how to behave whenever those 00:22:23.216 --> 00:22:26.104 - kinds of things happen on this different stuff. 00:22:28.430 --> 00:22:31.562 - Um, so with a mock context, which is a fake database, we 00:22:31.562 --> 00:22:35.477 - sell it to go in and do the Mike and set up for the context 00:22:35.477 --> 00:22:38.609 - runners. Now the context runners here. This is more T4 that goes 00:22:38.609 --> 00:22:39.653 - into this mocking setup. 00:22:40.460 --> 00:22:44.828 - Here I have a T4 that physically exercises every table and it 00:22:44.828 --> 00:22:48.468 - says for every table it should create. Basically create a 00:22:48.468 --> 00:22:52.108 - collection in memory that mimics woulda tables. Contents would be 00:22:52.108 --> 00:22:56.476 - and populate it with some sample data that I've assigned and it 00:22:56.476 --> 00:23:01.572 - goes through and this is a lot of complex logic in here for how 00:23:01.572 --> 00:23:05.940 - it basically goes through and does all of this. Most of that 00:23:05.940 --> 00:23:09.944 - is going to be irrelevant to anyone who actually needs to 00:23:09.944 --> 00:23:11.036 - touch this code. 00:23:11.110 --> 00:23:14.223 - Um, because it just kind of doing it all the background. 00:23:14.223 --> 00:23:17.619 - What's more relevant is to come over here to the runners folder. 00:23:18.130 --> 00:23:20.430 - And actually create what the data is going to be. 00:23:21.200 --> 00:23:26.320 - And I will turn the word rap on for this so that you can kind of 00:23:26.320 --> 00:23:29.520 - see what's going on here. For instance, I'm creating three 00:23:29.520 --> 00:23:32.720 - separate accounts in the accounts table in our mock data. 00:23:32.720 --> 00:23:36.880 - Whenever I generate data, I have an account ID of one that has 00:23:36.880 --> 00:23:41.360 - this custom key. I have a name of Black Star farms. It has a 00:23:41.360 --> 00:23:44.880 - description to just have a company that has a phone number 00:23:44.880 --> 00:23:49.040 - of fax and email. It is taxable. There are some SCO data that's 00:23:49.040 --> 00:23:52.240 - really irrelevant, but it's there and I could generate a 00:23:52.240 --> 00:23:55.146 - JSON attributes. Value in using a serializable attributes 00:23:55.146 --> 00:23:58.440 - dictionary and then serialising it directly into the JSON 00:23:58.440 --> 00:24:01.578 - attributes. Uh, with the serializable dictionary right 00:24:01.578 --> 00:24:05.274 - here and then, I also have, like, uh, let's say an account 00:24:05.274 --> 00:24:08.970 - images. I have an image for the account. This goes into account 00:24:08.970 --> 00:24:13.282 - ID one. It's a JPEG, it's just image dot JPEG knee. It's not a 00:24:13.282 --> 00:24:16.670 - real image that actually sets anywhere, it's just kind of like 00:24:16.670 --> 00:24:20.674 - a reference to what image would have been an does that stuff so 00:24:20.674 --> 00:24:24.062 - that I can exercise the table? The table itself would have 00:24:24.062 --> 00:24:28.374 - content if I told it to do do the account image table or told 00:24:28.374 --> 00:24:29.914 - to do the accounts schema. 00:24:30.000 --> 00:24:33.444 - Or I told it to do all do all is very expensive. You should 00:24:33.444 --> 00:24:36.888 - never do all but it is there in case you need to like a 00:24:36.888 --> 00:24:39.840 - quick like you're just trying to make the test work for the 00:24:39.840 --> 00:24:42.792 - moment and it'll go back and do the the more specific table 00:24:42.792 --> 00:24:44.022 - loads later kind of thing. 00:24:45.350 --> 00:24:48.672 - So as we go here through here, we have the raw 00:24:48.672 --> 00:24:51.994 - accounts list here that we build up and it does all 00:24:51.994 --> 00:24:54.108 - these different things for all these different 00:24:54.108 --> 00:24:57.128 - wonderful people and places and stuff. But how about and 00:24:57.128 --> 00:25:00.752 - filed? This is going to work so we populate it with data 00:25:00.752 --> 00:25:04.376 - like this and you say create a dummy account and then it 00:25:04.376 --> 00:25:07.396 - is a function that you just physically pass in values 00:25:07.396 --> 00:25:10.718 - and then they're all named arguments. So if I want to 00:25:10.718 --> 00:25:14.040 - add more content to it, I could say like status ID. 00:25:15.430 --> 00:25:18.370 - Which would have a default value of one, but if I wanted to be 2, 00:25:18.370 --> 00:25:19.742 - I could just pass the two like 00:25:19.742 --> 00:25:23.900 - this. And changes status and deal with that and then that 00:25:23.900 --> 00:25:27.530 - might have that might have effects on our testing down the 00:25:27.530 --> 00:25:32.810 - line. So if I want to test it looks for SSID two or if I have 00:25:32.810 --> 00:25:36.110 - other tests that might be affected by this account. This 00:25:36.110 --> 00:25:37.430 - great Greystar Farms account. 00:25:37.430 --> 00:25:41.181 - Might have changes in it that's that's involved. It would affect 00:25:41.181 --> 00:25:43.227 - those tests as we run them. 00:25:44.210 --> 00:25:48.049 - Any any questions? I know there's a lot of complex here 00:25:48.049 --> 00:25:51.888 - complex stuff going on here about how we create mock data, 00:25:51.888 --> 00:25:55.029 - but any questions immediately about creating mock data here. 00:25:56.150 --> 00:26:00.026 - So OK, I'll move on. But basically you go through it and 00:26:00.026 --> 00:26:03.902 - you make sure that there's data for every table in this system 00:26:03.902 --> 00:26:07.455 - an all the way through and these contexts runners basically just 00:26:07.455 --> 00:26:11.977 - use the T, the exercise that E 4 by passing in content and data 00:26:11.977 --> 00:26:16.499 - to them so that they get data in there, then the raw data is 00:26:16.499 --> 00:26:20.052 - stuff. There's secondary pieces to this in that once all the 00:26:20.052 --> 00:26:24.251 - context runners get run by their main piece on them, I need to 00:26:24.251 --> 00:26:26.835 - find my way back to where I was. 00:26:28.060 --> 00:26:31.947 - Uh, it basically like so this initial wanted to set it up with 00:26:31.947 --> 00:26:34.638 - the database so that each individual table has the 00:26:34.638 --> 00:26:38.226 - contents that it wants and then it. We have three loops here, 00:26:38.226 --> 00:26:41.814 - very loop iterations here that do you link up. So this is 00:26:41.814 --> 00:26:45.103 - basically going to assign the data between the tables to each 00:26:45.103 --> 00:26:49.289 - other that they know what they are and how to talk to it, which 00:26:49.289 --> 00:26:52.279 - makes it act more like the relational database does inside 00:26:52.279 --> 00:26:56.764 - of the the actual context of a SQL Server. So if I were to go 00:26:56.764 --> 00:26:58.558 - into link up schema and accounts 00:26:58.558 --> 00:27:02.005 - here. But it kind of does is like it goes in the accounts and 00:27:02.005 --> 00:27:04.590 - it says linking up a dummy account and it basically says 00:27:04.590 --> 00:27:05.765 - you know pulling from the 00:27:05.765 --> 00:27:09.526 - account types list. Onto my type variable here and copies 00:27:09.526 --> 00:27:14.180 - the data into it so that it can have that raw data there 00:27:14.180 --> 00:27:17.402 - and you can access it as entity dot account 00:27:17.402 --> 00:27:19.192 - associations, entities, account Contacts, etc. 00:27:19.192 --> 00:27:20.982 - Overtime to write your chat. 00:27:22.100 --> 00:27:25.544 - And it just goes through it, finds the data that matches and 00:27:25.544 --> 00:27:28.988 - loads it onto it. Otherwise it assigns a just like an empty 00:27:28.988 --> 00:27:33.580 - list or or an empty null value if it can, or if it needs to on 00:27:33.580 --> 00:27:37.928 - these things. Uh, for all the different variables of 00:27:37.928 --> 00:27:41.640 - properties that are links between tables on these 00:27:41.640 --> 00:27:45.824 - entities. And I have deeper debugger steppers on them 00:27:45.824 --> 00:27:50.060 - because they were supposed to just work and stuff all the way 00:27:50.060 --> 00:27:53.943 - through. As the data gets exercised. But then as we get 00:27:53.943 --> 00:27:58.179 - back to here, so we now have, we've now populated in our 00:27:58.179 --> 00:28:01.709 - tables themselves are fake tables, and then we have linked 00:28:01.709 --> 00:28:05.239 - the contents of those fake tables between each other and 00:28:05.239 --> 00:28:09.475 - then the last step here is it kind of goes through and. 00:28:11.330 --> 00:28:14.810 - It assigns the raw data into the actual data because what we're 00:28:14.810 --> 00:28:18.580 - doing is we populated bunch of raw stuff so that we can link 00:28:18.580 --> 00:28:22.350 - through and do all those links and then you go into the actual 00:28:22.350 --> 00:28:26.120 - mock sets, in which case we do with this setup here. So this 00:28:26.120 --> 00:28:29.020 - context here. This is our mock. I clarity converse entities. 00:28:30.020 --> 00:28:33.322 - And when we do is with Mark we they provide this a setup 00:28:33.322 --> 00:28:38.187 - function. So a set up that says whenever this property is called 00:28:38.187 --> 00:28:42.591 - is going to return this object that is from memory, and that 00:28:42.591 --> 00:28:47.362 - object itself is also a mock list of a DB set of accounts. 00:28:48.140 --> 00:28:51.407 - Um, and brings that stuff back. We could also say that 00:28:51.407 --> 00:28:54.377 - if someone calls the set function, which is a generic 00:28:54.377 --> 00:28:56.753 - that comes from entity framework and they're passing 00:28:56.753 --> 00:29:00.911 - in the type of account that it also does the same thing it is 00:29:00.911 --> 00:29:03.881 - supposed to return the same content of data this way. 00:29:03.881 --> 00:29:07.148 - Either way, the data gets called it still going to load 00:29:07.148 --> 00:29:09.821 - the correct information from our fake data. That's in 00:29:09.821 --> 00:29:10.712 - memory on stuff. 00:29:11.900 --> 00:29:14.864 - And it will run it multiple times if it needs to. Sometimes 00:29:14.864 --> 00:29:17.828 - there's issues where it's just it's trying to hit up so much 00:29:17.828 --> 00:29:21.039 - data at the same time that it's having to run through. It might 00:29:21.039 --> 00:29:24.003 - have to run through a couple of multiple loads and it just 00:29:24.003 --> 00:29:26.967 - basically auto resolves an auto heals itself if it needs to in 00:29:26.967 --> 00:29:29.437 - there by doing it retry an exception with the retry 00:29:29.437 --> 00:29:32.154 - helper. It's rare that it actually does need to do that, 00:29:32.154 --> 00:29:34.624 - but it just kinda prevents hiccups that happened in the 00:29:34.624 --> 00:29:35.859 - cloud if something was wrong. 00:29:37.060 --> 00:29:40.108 - And it has checks in here that says that like if something 00:29:40.108 --> 00:29:42.902 - if, like Moroccans was null, well it should have been there 00:29:42.902 --> 00:29:46.458 - because we were told to do it the same way that we told it 00:29:46.458 --> 00:29:49.506 - to do it before we want to make sure that gets populated 00:29:49.506 --> 00:29:50.776 - impact over on through stuff. 00:29:52.250 --> 00:29:56.746 - So we come back and, uh, we go back to the mocking set up an we 00:29:56.746 --> 00:30:00.680 - say that we assign the data in and then finally we say that the 00:30:00.680 --> 00:30:03.771 - we on the context itself we passed in the context profile 00:30:03.771 --> 00:30:07.424 - name we tell it what to do with the save changes and save 00:30:07.424 --> 00:30:09.672 - changes. Async Witcher 2 separate function calls that 00:30:09.672 --> 00:30:13.418 - could be called. Uh, the same changes result is normally 0, 00:30:13.418 --> 00:30:17.562 - but we can also specify in our mocking set up, like when we set 00:30:17.562 --> 00:30:21.114 - to do with the accounts table. Do the regions table, etc. We 00:30:21.114 --> 00:30:24.962 - could specify that we want the same changes result to be one or 00:30:24.962 --> 00:30:28.514 - negative one, meaning that it failed to come back that way our 00:30:28.514 --> 00:30:32.658 - test comes back with what we want. We tell it as a set of 00:30:32.658 --> 00:30:35.914 - complete is done and then we return the context itself back 00:30:35.914 --> 00:30:37.394 - out to where we were. 00:30:39.080 --> 00:30:44.414 - So that means all the way back up to the abstract base here and 00:30:44.414 --> 00:30:48.986 - then, once we're done with that, we say inside of our child 00:30:48.986 --> 00:30:52.034 - container we override. For RE clarity, commerz entities 00:30:52.034 --> 00:30:55.844 - interface to use this mock contexts instead, and that kind 00:30:55.844 --> 00:31:00.797 - of brings it all home. Just say, you know in our child container 00:31:00.797 --> 00:31:04.607 - this is the thing that's fake. Everything else should be 00:31:04.607 --> 00:31:07.930 - considered real. But do this thing here inside this 00:31:07.930 --> 00:31:11.530 - context and use this big database instead. And then we 00:31:11.530 --> 00:31:14.770 - say override the container and use the child container 00:31:14.770 --> 00:31:17.650 - with this name whenever that name is specified. 00:31:19.220 --> 00:31:20.956 - And then that leads us back into 00:31:20.956 --> 00:31:25.440 - the tests. Uh, down here and then we we can go in and 00:31:25.440 --> 00:31:29.210 - actually say like create a new workflow. So like if this is the 00:31:29.210 --> 00:31:32.400 - accounts that would say a new account workflow then we call 00:31:32.400 --> 00:31:35.300 - the chess exists a sync function. We're passing in that 00:31:35.300 --> 00:31:38.780 - context profile name and I'll wrap this a little bit so that 00:31:38.780 --> 00:31:40.520 - it's a little more smart about 00:31:40.520 --> 00:31:45.299 - what it's doing. Um, we call it by get ID async, which is an 00:31:45.299 --> 00:31:48.189 - internal function here that basically says it goes and grabs 00:31:48.189 --> 00:31:51.657 - the idea of the first account record in the table. So that 00:31:51.657 --> 00:31:55.703 - goes back and looks at this and goes OK. It's going to be the 00:31:55.703 --> 00:31:59.171 - number one because that's the first one we have in here. The 00:31:59.171 --> 00:32:02.639 - reason I have a function there or not instead of just always 00:32:02.639 --> 00:32:06.107 - using one is that we have tables like the products table where 00:32:06.107 --> 00:32:09.575 - there isn't a product ID one it's like 1152 or 969. There's 00:32:09.575 --> 00:32:11.598 - some tables in here that have a 00:32:11.598 --> 00:32:14.950 - different first ID. Um in there so I just haven't calling out to 00:32:14.950 --> 00:32:16.438 - go get that information and then 00:32:16.438 --> 00:32:20.506 - pull it up. So an that information is good stored into 00:32:20.506 --> 00:32:24.070 - some dictionaries in here so that we say you know what the 00:32:24.070 --> 00:32:27.634 - information is. So it's really fast and easy to pull that info 00:32:27.634 --> 00:32:31.495 - back into the test itself. And if I can scroll back down to 00:32:31.495 --> 00:32:35.653 - where it was there we go. So goes out and gets the ID so. 00:32:35.700 --> 00:32:40.264 - It's going to find here is that it should be ID one. It should 00:32:40.264 --> 00:32:44.828 - ask that in to check if ID one exists in the table and then 00:32:44.828 --> 00:32:48.088 - using that same context where our child container with that 00:32:48.088 --> 00:32:52.000 - fake databases that it should then come back and get us a 00:32:52.000 --> 00:32:53.956 - result. The result should be a 00:32:53.956 --> 00:32:58.610 - nullable int. We should see that it came back as a as a non 00:32:58.610 --> 00:33:02.570 - nullable inch because it was a digital with an actual value of 00:33:02.570 --> 00:33:06.860 - one and then we want to assert that those two values match or. 00:33:06.860 --> 00:33:10.820 - This will have done is it went through an. It exercised the 00:33:10.820 --> 00:33:14.120 - check exist async function which if I CTRL F 12. 00:33:14.410 --> 00:33:17.919 - Here it is inside workflow for bases and it should exercise 00:33:17.919 --> 00:33:21.428 - that the check exists. Async went through talk to the set 00:33:21.428 --> 00:33:25.575 - which we we told to use that memory data in table. There we 00:33:25.575 --> 00:33:29.722 - filtered by the ID. We selected the idea and then we got a 00:33:29.722 --> 00:33:33.550 - single or default async. So we waited that to happen and then 00:33:33.550 --> 00:33:37.378 - sort of exercise this against that table to make sure that it 00:33:37.378 --> 00:33:39.930 - actually worked. Now someone could have overwritten this 00:33:39.930 --> 00:33:43.120 - function like in the product's Workflow. That said that if 00:33:43.120 --> 00:33:46.948 - you're checking my ID that it must also check this other data. 00:33:46.980 --> 00:33:51.248 - There's some other stuff that might be going on whatever and 00:33:51.248 --> 00:33:54.740 - anywhere inside that those overrides would also must comply 00:33:54.740 --> 00:33:59.008 - with this check. Assist by D. Thing. So if you're overwriting 00:33:59.008 --> 00:34:03.276 - the functionality then you need to override the tests or you 00:34:03.276 --> 00:34:07.932 - need to override and conform to what the original set of tests 00:34:07.932 --> 00:34:11.812 - for these standards set of tests is doing to comply. 00:34:12.550 --> 00:34:16.840 - Uh, you should always still be replying that if there is an ID 00:34:16.840 --> 00:34:21.130 - one and we're checking for an ID one that it should always come 00:34:21.130 --> 00:34:25.090 - back true because it gave us the ID one back basically, and 00:34:25.090 --> 00:34:28.720 - that's what we're asserting here. And then we're done. We go 00:34:28.720 --> 00:34:31.690 - in every say, remove the override container for that 00:34:31.690 --> 00:34:34.660 - particular name from the main container, and then basically 00:34:34.660 --> 00:34:36.640 - just freeze up the memory of 00:34:36.640 --> 00:34:41.406 - that piece. That was a lot and this is a very simple version of 00:34:41.406 --> 00:34:44.760 - one of these tasks. There's one thing here that get a lot more 00:34:44.760 --> 00:34:47.340 - complicated, and there's a lot more spirits involved in like 00:34:47.340 --> 00:34:50.178 - making sure that that like if it's coming back within account 00:34:50.178 --> 00:34:52.758 - table that was just an accident. I didn't mean to. 00:34:53.340 --> 00:34:57.390 - OK. Um, if it you know, if you're calling back in the 00:34:57.390 --> 00:34:59.910 - actual account, we also check for individual properties that 00:34:59.910 --> 00:35:02.430 - got assigned for individual data. If we're doing that, 00:35:02.430 --> 00:35:06.070 - create or an update, then we go through it and we check. Make 00:35:06.070 --> 00:35:09.710 - sure that those values if we go back and call the record after 00:35:09.710 --> 00:35:13.070 - the fact that the data in the database, or rather the fake 00:35:13.070 --> 00:35:16.430 - database, changed to match the data that was supposed to go in. 00:35:16.500 --> 00:35:19.701 - Things like that for some of those more specific stuff, but 00:35:19.701 --> 00:35:23.193 - this is the basic structure behind the test is you do your 00:35:23.193 --> 00:35:26.394 - setup. You make sure that you're prepping all the data you're 00:35:26.394 --> 00:35:29.595 - assigning all this stuff in memory. You do your call, you 00:35:29.595 --> 00:35:33.378 - assert the data that comes back, and then you make sure you clean 00:35:33.378 --> 00:35:36.870 - up after yourself by wiping out the extra container. Is it no 00:35:36.870 --> 00:35:41.368 - longer becomes needed? And we do that with the Triple A 00:35:41.368 --> 00:35:44.954 - pattern which is arrange act assert. Now in this case we 00:35:44.954 --> 00:35:48.866 - kind of like this should really be here. I'm gonna take that 00:35:48.866 --> 00:35:52.778 - off and put this here because that's where we do the actual 00:35:52.778 --> 00:35:55.386 - action. So arranging we're prepping we're acting we're 00:35:55.386 --> 00:35:58.646 - doing the action itself. And then we're certainly that are 00:35:58.646 --> 00:36:03.210 - action did what it was supposed to do. And then we just have a 00:36:03.210 --> 00:36:06.470 - little bit clean up afterward here with this remove override 00:36:06.470 --> 00:36:06.796 - container. 00:36:08.240 --> 00:36:14.036 - Any questions about that before I try to move on, that was a lot 00:36:14.036 --> 00:36:17.669 - man. There's a lot to that. There's a lot about like you 00:36:17.669 --> 00:36:20.559 - know we're doing some some custom stuff here. That seems 00:36:20.559 --> 00:36:23.738 - pretty crazy, but once you actually like, really go in and 00:36:23.738 --> 00:36:27.495 - dig deep dive into what it's doing and why it's doing it. It 00:36:27.495 --> 00:36:30.385 - starts to make sense about what's happening and then making 00:36:30.385 --> 00:36:33.853 - sure that, like you know, this seems like a really stupid thing 00:36:33.853 --> 00:36:37.321 - to check. Like you. Yeah, of course the database is going to 00:36:37.321 --> 00:36:40.500 - give us back the one or whatever, but where this really 00:36:40.500 --> 00:36:43.390 - starts to shine is functions that are getting overridden in 00:36:43.390 --> 00:36:44.546 - these complex workflows like 00:36:44.546 --> 00:36:47.876 - sales orders, accounts. Uh, you know products, uh, you know, 00:36:47.876 --> 00:36:51.008 - stores where a price points where there's really complex 00:36:51.008 --> 00:36:55.184 - overwrites this how some of the stuff works to make sure that 00:36:55.184 --> 00:36:59.012 - they still conforming to what the original back is for what 00:36:59.012 --> 00:37:03.188 - basic card operations do and then once you get past all of 00:37:03.188 --> 00:37:07.016 - these basic crud operations, which gives a lot of tests here 00:37:07.016 --> 00:37:10.844 - that do positive and negative paths. And then like you know. 00:37:10.860 --> 00:37:14.347 - An invalid IDs zero negative one negative. 100,000 men value into 00:37:14.347 --> 00:37:18.151 - Max Value. Invalid Keys where it's a null or it's just white 00:37:18.151 --> 00:37:22.272 - space. In those keys. You know ideas that are not in the data. 00:37:22.272 --> 00:37:26.393 - In most of these tables don't have these ideas in the data in 00:37:26.393 --> 00:37:29.563 - their smaller numbers are numbers that are not one of 00:37:29.563 --> 00:37:33.050 - these individual values. Here these are. This way we can test 00:37:33.050 --> 00:37:36.854 - negative paths on things you know this is supposed to be hey 00:37:36.854 --> 00:37:40.975 - when bad data gets passed in is supposed to go in and say 00:37:40.975 --> 00:37:42.243 - invalid operation or an 00:37:42.243 --> 00:37:45.179 - argument. Out of range or an argument null exception. You 00:37:45.179 --> 00:37:48.270 - know. We make sure that those negative pads also get conform 00:37:48.270 --> 00:37:51.361 - to and if you override those functions in the workflows for 00:37:51.361 --> 00:37:54.452 - your regular business logic, you need to make sure you still 00:37:54.452 --> 00:37:56.981 - conform to those individual things so that someone else 00:37:56.981 --> 00:38:00.353 - doesn't have to look at this workflow and go. Why the hell 00:38:00.353 --> 00:38:03.725 - does not do what I'm expecting it to do? Kind of scenario? 00:38:04.950 --> 00:38:08.778 - And it helps a lot with covering those things that making sure 00:38:08.778 --> 00:38:12.606 - that you know we get those things in there and then once 00:38:12.606 --> 00:38:16.434 - you get past this stuff and making sure that those at least 00:38:16.434 --> 00:38:19.624 - those basics are covered, we start getting into the special 00:38:19.624 --> 00:38:22.176 - workflows. So for instance, products here as special 00:38:22.176 --> 00:38:26.004 - workflows one, and there's a bunch of tests in here that all 00:38:26.004 --> 00:38:29.194 - go into extra data around, creates an update and things 00:38:29.194 --> 00:38:33.660 - like that. If I can get it to expand again. So here's one that 00:38:33.660 --> 00:38:37.488 - say create with valid data should add to the TV set and 00:38:37.488 --> 00:38:41.269 - save changes. And I'm adding an extra data onto the product 00:38:41.269 --> 00:38:43.656 - model as I'm passing it in um. 00:38:44.380 --> 00:38:47.427 - Uh, as I'm doing stuff here, that's going to have stuff 00:38:47.427 --> 00:38:50.751 - that's not part of the automated before. So I have like package 00:38:50.751 --> 00:38:54.352 - data, master pack pallet data. I have I need to cover some of 00:38:54.352 --> 00:38:57.122 - these other tests in here for like when you assign 00:38:57.122 --> 00:38:58.784 - associations and product categories and manufacturers 00:38:58.784 --> 00:39:01.831 - because there's a lot of cash, some extra logic that's beyond 00:39:01.831 --> 00:39:05.986 - the basic crud set when it comes to a product that has a lot of 00:39:05.986 --> 00:39:09.864 - this stuff in here and there's a lot more in here that needs to 00:39:09.864 --> 00:39:13.742 - be covered at some points on this stuff. So I have a test in 00:39:13.742 --> 00:39:17.176 - here that are. Exercising some of these extra things to make 00:39:17.176 --> 00:39:20.608 - sure that they call you know the save changes got called 00:39:20.608 --> 00:39:24.040 - correctly at least once the there was an add function that 00:39:24.040 --> 00:39:27.472 - put in that product. At least that happened only once. There 00:39:27.472 --> 00:39:30.904 - are the create async function called winter and did all these 00:39:30.904 --> 00:39:34.960 - extra things and then I can add even more asserts in here to 00:39:34.960 --> 00:39:39.328 - make sure that if I go and get that product after the fact that 00:39:39.328 --> 00:39:43.072 - it got an ID number that's greater than all the other ID 00:39:43.072 --> 00:39:46.192 - numbers that it got the name that was passed in. 00:39:46.230 --> 00:39:50.003 - Was saved correctly that it's got the same package with all00:39:50.003 --> 00:39:53.776 - the all those dimensions on that package. Stuff gets in there. 00:39:53.776 --> 00:39:57.206 - All those things get assigned in done correctly and clean 00:39:57.206 --> 00:39:59.950 - themselves back up afterward for everything that's going. 00:40:00.510 --> 00:40:04.230 - And you can see there you know with with these special to 00:40:04.230 --> 00:40:08.260 - workflow test I don't move out to talk to these other things. I 00:40:08.260 --> 00:40:12.600 - just want to do the exact things that I need. So like here it's 00:40:12.600 --> 00:40:16.320 - possible to save changes. Result was one. You know those kinds of 00:40:16.320 --> 00:40:19.730 - things and then we exercise all through all of those functions 00:40:19.730 --> 00:40:23.450 - and this gives us our code coverage for how things work on. 00:40:23.460 --> 00:40:28.894 - Stop so for instance, if I open up a ticket for you, Yeah? 00:40:29.700 --> 00:40:33.600 - If I wanted to run this one test alone, I'm gonna tell it 00:40:33.600 --> 00:40:34.800 - to cover this test. 00:40:38.800 --> 00:40:42.342 - And we can see how, how much of the system gets covered by just 00:40:42.342 --> 00:40:43.860 - one test as it runs it. 00:40:45.880 --> 00:40:47.428 - I say that but. 00:40:50.580 --> 00:40:52.248 - Come on created session. 00:40:57.240 --> 00:40:59.330 - Baby, I need to do. 00:41:01.220 --> 00:41:03.194 - Oh, there goes. You just took it 00:41:03.194 --> 00:41:07.340 - a minute. Normally whenever you try to run tests with the recent 00:41:07.340 --> 00:41:10.508 - protests runner, it will try to physically go back and call it 00:41:10.508 --> 00:41:13.412 - and yeah, see it actually created it twice. So I'm going 00:41:13.412 --> 00:41:14.468 - to kill this one. 00:41:16.130 --> 00:41:18.338 - Let's just do the other one. 00:41:19.010 --> 00:41:23.820 - There we go. So this one should be running at a test coverage, 00:41:23.820 --> 00:41:26.500 - one which creates extra information about what's going 00:41:26.500 --> 00:41:30.369 - on. Oops, I didn't want that entire thing. I just want that 00:41:30.369 --> 00:41:34.752 - one. It's a bottom here so you can see what's going on, so 00:41:34.752 --> 00:41:37.843 - right now I have zero percent coverage because I don't have 00:41:37.843 --> 00:41:41.215 - it. I haven't run any coverage tests to run with coverage data, 00:41:41.215 --> 00:41:42.620 - but when it runs this. 00:41:44.690 --> 00:41:47.966 - I had to do setup and teardown and get the like application 00:41:47.966 --> 00:41:50.969 - running, which is a lot of boilerplate stuff that X unit 00:41:50.969 --> 00:41:54.791 - has to run in. Resharper has to run for just a single task. It 00:41:54.791 --> 00:41:57.794 - doesn't have to do this for every individual test, it just 00:41:57.794 --> 00:42:01.343 - kind of does it like once so we're running for a single test 00:42:01.343 --> 00:42:04.892 - that takes a lot of extra time, like an extra minute first is 00:42:04.892 --> 00:42:08.714 - like telling it to run the 4000 plus tests at once. It kind of 00:42:08.714 --> 00:42:12.809 - all had that set up in here down at one time. There we go and 00:42:12.809 --> 00:42:15.539 - then it did coverage analysis and so basically it knows. 00:42:15.650 --> 00:42:19.382 - Everywhere in the code this that this test touched, which was a 00:42:19.382 --> 00:42:21.248 - total of 5% of the entire 00:42:21.248 --> 00:42:26.382 - system. Uh, from this one test and I can go in and see all the 00:42:26.382 --> 00:42:29.770 - individual areas like if I go into business logic here. Well, 00:42:29.770 --> 00:42:32.542 - it exercise the workflows registry which was the structure 00:42:32.542 --> 00:42:36.546 - of map stuff which was doing the using so that 100% coverage. And 00:42:36.546 --> 00:42:40.550 - then I have to scroll way down here in the workflows layer. So 00:42:40.550 --> 00:42:43.938 - like 8 exercise that product status workflow 87% and the only 00:42:43.938 --> 00:42:47.326 - thing it didn't was some of these listing light things that 00:42:47.326 --> 00:42:50.098 - probably would be covered by different tests on stock. 00:42:51.200 --> 00:42:54.314 - The Workflow for normal and display basis, which are 00:42:54.314 --> 00:42:58.812 - actually the base of what these two are. It exercise those a lot 00:42:58.812 --> 00:43:00.888 - there to like 29 and 30%. 00:43:01.420 --> 00:43:05.092 - Um, the product workflow. It got 23% of the product Workflow and 00:43:05.092 --> 00:43:08.152 - all the different things and this junction statement here is. 00:43:08.152 --> 00:43:11.518 - These are how many individual lines of code or junction points 00:43:11.518 --> 00:43:14.884 - like an if statement or a ternary. There are inside the 00:43:14.884 --> 00:43:18.556 - product workflow class and it out of all of them there are 00:43:18.556 --> 00:43:22.534 - 16157 that are still uncovered so we only got 23% of them. But 00:43:22.534 --> 00:43:27.124 - if I look and look at one of the functions that are in there like 00:43:27.124 --> 00:43:30.796 - let's look at relate notable package I think I could turn on 00:43:30.796 --> 00:43:33.822 - the code highlighting. And it will show me I have green 00:43:33.822 --> 00:43:36.870 - passing tests on all of these part, but like this Gray spot 00:43:36.870 --> 00:43:39.918 - here, it skipped over because that was not part of the test. 00:43:39.918 --> 00:43:42.712 - Which means I might go write a different test that would 00:43:42.712 --> 00:43:45.506 - satisfy this. So I would write a different test that would 00:43:45.506 --> 00:43:48.300 - make sure that it satisfied this if condition here to go 00:43:48.300 --> 00:43:51.348 - into the package equal to null and then I had that one 00:43:51.348 --> 00:43:53.888 - separately covering the test. Same same thing here and all 00:43:53.888 --> 00:43:56.936 - that stuff. Go ahead. I can't see the screen here on if 00:43:56.936 --> 00:43:58.968 - you're on a different screen than this one. 00:44:01.370 --> 00:44:04.945 - OK, so it just hasn't caught up yet. Yeah, your mouse is like 00:44:04.945 --> 00:44:08.520 - kind of just froze there so we were talking about this and that 00:44:08.520 --> 00:44:12.095 - and you get your mouse is moving and I don't think about the 00:44:12.095 --> 00:44:14.845 - screen. I assume you're talking about another screen. I just 00:44:14.845 --> 00:44:16.220 - wasn't sure what to say. 00:44:16.260 --> 00:44:19.923 - There and started again. I didn't know that the testing was 00:44:19.923 --> 00:44:21.588 - so extensive in self, seriously. 00:44:22.210 --> 00:44:26.122 - Giving the minute to kind of resolve. Hey I have stop sharing 00:44:26.122 --> 00:44:30.360 - not part of all of this passing. That's going on for the back 00:44:30.360 --> 00:44:33.946 - end. Basically there is the Millennium testing but it is a 00:44:33.946 --> 00:44:37.532 - totally different ball game so that would really need his own 00:44:37.532 --> 00:44:40.859 - session. To kind of cover what's going on, I have just started 00:44:40.859 --> 00:44:42.473 - sharing again. Let's see if it 00:44:42.473 --> 00:44:45.472 - comes through. I am pacing egg 00:44:45.472 --> 00:44:47.728 - ISO image. You seen it? 00:44:48.230 --> 00:44:50.318 - Oh OK, Oh yes, we see the Castle 00:44:50.318 --> 00:44:54.988 - image. OK so I just pasted the guise of image. If you want ever 00:44:54.988 --> 00:44:57.356 - want to click on that in the in 00:44:57.356 --> 00:45:02.868 - the chat here. So what this image? I'm just, it's just part 00:45:02.868 --> 00:45:05.940 - of my screen up here, uh? 00:45:07.470 --> 00:45:11.188 - OK, cool, so you could see in the main block here there's a 00:45:11.188 --> 00:45:14.620 - lot of like code there that's got like a green background and 00:45:14.620 --> 00:45:17.766 - then online 860 there's a Gray background. What that means is 00:45:17.766 --> 00:45:20.626 - that there is passing testing that is covering those other 00:45:20.626 --> 00:45:23.486 - statements, but then the Gray area is something that not 00:45:23.486 --> 00:45:26.632 - exercised. Right now I would want to go another test that 00:45:26.632 --> 00:45:28.634 - would physically satisfy whatever that is. Statements 00:45:28.634 --> 00:45:32.352 - conditions are so that I can get it to go inside that if 00:45:32.352 --> 00:45:36.356 - statement. Do that line at 60 and exercise it. And if I had a 00:45:36.356 --> 00:45:38.358 - test that will save the test was 00:45:38.358 --> 00:45:41.715 - failing. What would happen is I would have a green background. I 00:45:41.715 --> 00:45:44.740 - could get a red background saying that I have tests that 00:45:44.740 --> 00:45:47.765 - are failing against those things either wrong with the test or 00:45:47.765 --> 00:45:51.065 - what's wrong with my code. I need to figure out which by 00:45:51.065 --> 00:45:53.815 - probably debugging and stepping through it or just looking for 00:45:53.815 --> 00:45:56.565 - code logic. That's like, maybe there's a reversed if condition 00:45:56.565 --> 00:45:59.590 - that supposed to be a true versus false kind of scenario. 00:45:59.590 --> 00:46:02.615 - Any number of things that could be going wrong inside code 00:46:02.615 --> 00:46:03.715 - anywhere inside your system. 00:46:04.530 --> 00:46:08.417 - And on the right on the bottom there we've got the unit test 00:46:08.417 --> 00:46:10.510 - coverage window from Resharper. That's really handy 00:46:10.510 --> 00:46:13.799 - for showing out how much of the code is actually being 00:46:13.799 --> 00:46:16.789 - covered and showing along this different things and like down 00:46:16.789 --> 00:46:20.078 - to the line and number of statements inside of a single 00:46:20.078 --> 00:46:22.769 - function of everything that could be possibly going on. 00:46:24.020 --> 00:46:28.219 - Um, so with that in mind, in going through and make sure that 00:46:28.219 --> 00:46:32.095 - it is much coverage of possible. I believe the last time I 00:46:32.095 --> 00:46:35.971 - clocked it, if I did a full system code coverage which would 00:46:35.971 --> 00:46:39.847 - take like 2030 minutes on my local, I think we're at 42% 00:46:39.847 --> 00:46:43.400 - coverage of the entire system and this is just talking about 00:46:43.400 --> 00:46:46.630 - backends, not front end, so there's definitely a lot of 00:46:46.630 --> 00:46:49.537 - areas that can visit physically, especially the most complicated 00:46:49.537 --> 00:46:54.059 - areas that can go in and get a lot of extra work done around 00:46:54.059 --> 00:46:57.964 - different things and. Do you stop it? Stop scaring me again I 00:46:57.964 --> 00:46:59.228 - want to share it. 00:46:59.910 --> 00:47:04.558 - OK. I started sharing again just in case it gets through and then 00:47:04.558 --> 00:47:06.262 - being while I will click on. 00:47:06.810 --> 00:47:09.610 - The hot spot part of the screen. 00:47:10.730 --> 00:47:12.850 - Open device is that. 00:47:13.440 --> 00:47:17.148 - Um, and I'm going to give you a screenshot here. Adjust the 00:47:17.148 --> 00:47:17.766 - hotspots window. 00:47:19.050 --> 00:47:22.010 - Which is really useful for finding out where you're hot, 00:47:22.010 --> 00:47:25.562 - but there it's a nice little word cloud of like the things 00:47:25.562 --> 00:47:27.042 - that have the most problems. 00:47:27.600 --> 00:47:28.808 - Um in the system. 00:47:29.480 --> 00:47:33.716 - So we put that in there. There's that screenshot. Another guy is 00:47:33.716 --> 00:47:35.834 - a link in by the window. 00:47:36.460 --> 00:47:40.225 - Uh, and you can kind of see here in the middle of this thing. It 00:47:40.225 --> 00:47:42.484 - has been big bold letters, target order, checkout provider. 00:47:42.484 --> 00:47:45.496 - That means that that one at the moment because it will have 00:47:45.496 --> 00:47:48.006 - coverage, don't have tests that have physically been run to 00:47:48.006 --> 00:47:51.269 - cover it. It says it is the most risky thing inside the system 00:47:51.269 --> 00:47:54.783 - and I can't really show it to you it there. But there is a 00:47:54.783 --> 00:47:58.558 - tooltip. Uh, maybe I can trigger it to to grab this print screen 00:47:58.558 --> 00:48:04.044 - here. Oh yes, I did. Good sweet I hope. 00:48:04.550 --> 00:48:07.916 - Yes, it did 00:48:07.916 --> 00:48:13.895 - this screenshot. Um, so in this screenshot I actually 00:48:13.895 --> 00:48:19.420 - have the tool to that I get went by hovering over that target 00:48:19.420 --> 00:48:23.670 - order takeout provider in big bold letters. It says that 00:48:23.670 --> 00:48:27.495 - there's the rigorous method. Is this particular statement inside 00:48:27.495 --> 00:48:31.745 - the inside there inside the class, the risk metric is 00:48:31.745 --> 00:48:35.145 - 24,180, which is ridiculous. There's a cyclomatic complexity 00:48:35.145 --> 00:48:40.245 - of 155, which is ridiculous, and so it very much needs code 00:48:40.245 --> 00:48:41.520 - coverage on it. 00:48:41.580 --> 00:48:44.418 - Now I do actually have tests that will physically cover this, 00:48:44.418 --> 00:48:47.772 - as you need to run them and get them in my coverage statement. 00:48:47.772 --> 00:48:51.384 - Then I can speed this, but once I had my full code coverage I 00:48:51.384 --> 00:48:54.996 - can go in and go find OK. You know what is the riskiest area 00:48:54.996 --> 00:48:58.608 - that I have? Let's go right test for that that I can make sure 00:48:58.608 --> 00:49:00.156 - that my most risky areas are 00:49:00.156 --> 00:49:03.736 - covered top down. Um, all the way throughout the system, and 00:49:03.736 --> 00:49:07.402 - that's where we kind of need to focus on making sure that things 00:49:07.402 --> 00:49:11.350 - get built out. And if I were just kind of like split up the 00:49:11.350 --> 00:49:15.298 - work to say that, like you know of all the all the back end 00:49:15.298 --> 00:49:18.682 - devs, let's put it all. Take the top one. Erickson next biased 00:49:18.682 --> 00:49:21.784 - one Brenda takes with next highest one. I think it written 00:49:21.784 --> 00:49:24.810 - after that. Uh. 00:49:24.810 --> 00:49:28.230 - Igor and, uh, a Sterling. You know everybody could come in and 00:49:28.230 --> 00:49:31.935 - we kind of just. We just outlined it. Say OK, I want you 00:49:31.935 --> 00:49:35.355 - guys to go run it, create test for these individual places and 00:49:35.355 --> 00:49:38.775 - the commitment. We get them added into our CI CD process to 00:49:38.775 --> 00:49:41.910 - make sure that these tests get exercised so that our riskiest 00:49:41.910 --> 00:49:45.045 - areas get covered the most. Right now, the kind of the 00:49:45.045 --> 00:49:48.465 - opposite is true in that all of our least risky areas are 00:49:48.465 --> 00:49:52.170 - covered to like a 90%, but then our most risky areas are very 00:49:52.170 --> 00:49:56.445 - much lacking in a lot of a lot of points. We want to make sure 00:49:56.445 --> 00:49:58.725 - that we get a lot of that stuff 00:49:58.725 --> 00:50:02.680 - kind of reversed. Can we go in and we cover a lot of those 00:50:02.680 --> 00:50:04.080 - areas as much as possible. 00:50:04.090 --> 00:50:07.896 - Kind of it is that the microphone is kind of how 00:50:07.896 --> 00:50:11.702 - coverage works and how we're doing the testing. Kind of makes 00:50:11.702 --> 00:50:12.740 - sense to everybody. 00:50:14.930 --> 00:50:18.458 - Kind of makes sense. 00:50:18.460 --> 00:50:22.915 - Excellent description of James. It is. It's just extremely 00:50:22.915 --> 00:50:26.875 - complicated and it's really cool to know that. 00:50:26.880 --> 00:50:31.344 - Bye. The testing and stuff is way, way more in depth and 00:50:31.344 --> 00:50:35.296 - complicated than I thought it was. Yeah, and then I mean a lot 00:50:35.296 --> 00:50:39.248 - of it is there is kind of boilerplate to make it so that 00:50:39.248 --> 00:50:43.200 - there's a point where when you go in to write your test, you're 00:50:43.200 --> 00:50:46.544 - having to write these 2030 lines. You don't have to write 00:50:46.544 --> 00:50:50.192 - all that other stuff into every single test you have. All these 00:50:50.192 --> 00:50:53.840 - utilities that will basically do all of that for you, and mostly 00:50:53.840 --> 00:50:57.488 - even this can literally just be copied and pasted. Swap out what 00:50:57.488 --> 00:51:00.348 - people are doing. Change your action. Uhm, and then change 00:51:00.348 --> 00:51:03.362 - what you're asserting against. Uhm, so that even then it's down 00:51:03.362 --> 00:51:07.198 - to like you know 5 to 10 lines of what you actually would need 00:51:07.198 --> 00:51:10.760 - to change. Besides a copy paste to make sure that you were doing 00:51:10.760 --> 00:51:13.774 - and covering all the individual places that were trying to do 00:51:13.774 --> 00:51:16.788 - what function you were calling and what you were trying to 00:51:16.788 --> 00:51:18.158 - prove by calling that function. 00:51:19.050 --> 00:51:22.248 - With star and it seems like a lot, and if you're if you're 00:51:22.248 --> 00:51:24.954 - ready to actually sit down and start doing testing and you're 00:51:24.954 --> 00:51:28.644 - ready and you want to run it by me, I will always be happy to 00:51:28.644 --> 00:51:32.580 - run that by you or run that. You run that by me. I will always be 00:51:32.580 --> 00:51:34.056 - happy to review that with you. 00:51:34.110 --> 00:51:37.326 - If I'm available to just drop it, I'm doing what I'm doing, 00:51:37.326 --> 00:51:41.614 - but I will try to do what I can to review it with you to make 00:51:41.614 --> 00:51:44.562 - sure that you got an in-depth understanding of I'm trying to 00:51:44.562 --> 00:51:48.046 - create a test. I'm trying to prove this. You know, what do I 00:51:48.046 --> 00:51:50.994 - do? And then we'll walk through building that test together on 00:51:50.994 --> 00:51:53.942 - stuff, and maybe we could do that another training session as 00:51:53.942 --> 00:51:57.216 - well. On that stuff 'cause we're kind of running out of time 00:51:57.216 --> 00:52:00.674 - here, but yeah, that's that's what we do. That's why we do it 00:52:00.674 --> 00:52:03.866 - this way. There's a lot to it, and it feels really complicated, 00:52:03.866 --> 00:52:07.324 - but actually, you know, when you boil it down to just these few 00:52:07.324 --> 00:52:10.250 - pieces that you're actually going to touch it. There's not a 00:52:10.250 --> 00:52:13.708 - whole lot to those computers are going to touch, and that was my 00:52:13.708 --> 00:52:15.038 - goal with the whole scenario. 00:52:16.460 --> 00:52:20.036 - Did you have any questions about the complexity of the unit tests 00:52:20.036 --> 00:52:21.526 - that would help you understand 00:52:21.526 --> 00:52:26.460 - Jesse? Nothing specific I would need to. I would need to step in 00:52:26.460 --> 00:52:30.880 - and maybe try and make one for myself. Let stays, just wait for 00:52:30.880 --> 00:52:33.600 - me to to learn something complicated, but still 00:52:33.600 --> 00:52:36.320 - excellently, uhm, just a explained and displayed James. 00:52:36.990 --> 00:52:41.610 - OK, um, if you have nothing else black, go ahead. I was gonna say 00:52:41.610 --> 00:52:45.970 - the same thing. I was going to say the same thing you're fixing 00:52:45.970 --> 00:52:48.775 - to say, unless anybody has any questions for James, your Chris 00:52:48.775 --> 00:52:52.090 - or myself, or any part of the training, then we can go ahead 00:52:52.090 --> 00:52:55.660 - and finish out the day and get back to work. So I'll open up 00:52:55.660 --> 00:52:58.465 - the floor for any questions overall and then if not, will 00:52:58.465 --> 00:53:01.270 - just go on and I hope everybody has a great weekend.