So someone's asked, like you showed us with React, with a web page, any thoughts on testing libraries or ways we can use this with React Native? Have you had any experience with this? Yeah, with React Native it's more challenging because you have, if you use, how do you call that? The web simulator. You mean like an emulator? It's not an emulator, but like just using it in the web. Like the web view? Yeah, like you have a layer where you can render in the browser, but it's not as realistic, so you will have to mock many things, so it's not going to be realistic, so you will not have this experience with VTest. There are other tools like Detox, I think, not an expert of React Native, but I think Detox works for that. Fair enough, fair enough. I know that there's a lot of complexity to some of these questions, and remember you can always get more follow-up afterwards.
This is kind of a general one, and it's maybe a bit of a testing philosophy question, which is what are good rules of thumb for speed and scope for unit testing, right? So lots of people have to decide how granular are we going to get, and I love what you said, there's a difference between code coverage and, was it usability coverage or user? Behavior, yeah, whatever. So tell us a little bit about how you go about prioritizing that speed and that scope. Cool, how many hours do I have? Two minutes and 49 seconds. Okay, so I have a, go to my cookbook, even though I think it's on the Angular section, there is an intro on testing it, but it's very generic, it's not specific to Angular, and one of the concepts is narrow versus wide, and I don't use unit versus integration, because the moment you say unit, people come with lots of different definitions. So my definition of a narrow test is a test that runs in less than 100 milliseconds, and about the scope, it's a test that is isolated easily, you don't have to pop a database in Docker or whatever, and the third rule, which is the most important one in terms of scope, is the complexity. Anyone in the team can debug any test that fails. So this means that you can mount a component with three or four types of children and maybe call a few hooks, custom hooks and everything, but if everything has a cyclomatic complexity of one and it's very straightforward and easy, and the test fails, it's going to be easy to debug and it's going to be easy to understand. So that's one of the rules. So you have to aim for the widest narrow test. So what is the largest test you can think of that can run in less than 100 milliseconds and still be easy to debug for anyone in the team, including agents? Because I didn't mention it, but for example, WallabyJS, they have this MCP tool that allows the agents to instantly know what's the state of the test and also ask about the values of variables in runtime, so it can really debug properly. So if you provide this, it will be able to debug easily, but if you give it a huge scope, everybody will struggle, agents and humans. I really like that.
Comments