 Hi You will see that is he power is a apps developer and I Moodle developer and it that's important because you will see that we will talking about both during the sessions, right? It's important apps model. Okay Let's start. I Want to yeah, it's like get people involved here. What do you think about manual testing who loves it? Manual manual testing. Okay. Only a copy. Yeah, thanks. It's a was it in those for you who who hates it Okay, a lot of people hates manual manual tests and what about people that don't care? Okay, haha, but why it's like, okay, okay? And same question but with automated testing. How many people love automated testing? Okay, now I'm happy. Yeah. Okay. How people hates automatic testing nobody That's amazing. No, it's like we need to do take it out because yeah, we were expecting and what about people that don't care automatic testing What are you doing here? It's like yeah, we're not it's like coffee is outside. So yeah Okay, let's let's start with the talk That's it. Why you need test if user reports back You need it, right? So let's go. Bye Sorry Automated testing are all the scripts and processes that validate and review your code and they We have a problem here Yeah And they prove that your code passes like your defined Quality threshold so the better are your test the higher will be this threshold and We are now going to present the benefits and the drawbacks of automatic testing Manual testing is very tedious very hard and it consumes a lot of time, but also writing automatic tests are Consumed time But the benefit of this is that when you write a test It can be run forever Also, it's used to to detect bugs earlier and mostly regressions and They are reliable if the test are reliable. If not, you have a problem here and they are 20 24 seven can be run in any time and What this is a phrase that we love is that fix a back with a test and it's fixed forever Because if a regression happens and you broke it the test will tell you on the other part There are also drawbacks For example manual testing Introduces randomness because humans are not perfect. I mean sorry is perfect, but humans usually not So so when when they run a test They introduce randomness because they make things different every time. So You it can help finding bugs if if testers are not thinking about finding edge cases, for example There are a few misconceptions about Automated testing First of this it's like it's going to replace automatic testing to manual tests The answer is no so no worries about people that works your testing because no it's not it's not going to happen The idea of the automatic testing is to reduce the number of tests to run manually, but not to remove completely another thing is like Not and it's impossible to test An application all the future so it's impossible It's like as an application. It's not manual automatic. It's impossible because there are a lot of features It's like even I'm still discovering Features in model and I've been working like 15 years with model. So yeah, it happens the same I guess with any or all any project and It's like it's important that we take into account that there are a few things to automate like for instance a Business-critical it's important to create some tests for them because they are important and if we are to met them It they will help us to identify some regressions Things that are repeatedly as Paul mentioned before it's like manual tests are tedious So yeah, why not to try to automate things that are not as easy or funny to test There are few tests that are difficult to to perform manually. So that's also a good candidate for for automate And the ones that are time-consuming. So yeah things few ideas and Nowadays, there are a few tools that it's like you can record the Record some future how it's working and they create magically this test That's okay in some cases, but that's not recommended. It's like creating test is not as easy as just recording some features Part of the big Miscontentions there are few testing challenges for instance as I said before it's impossible to test a completely application completely relationship between the testers and developers and has not as Easy let's say because you know developers are great people And it's not easy to talk with them us Because we need to make sure that testers and developers talk the same language It's very important to have these regression testings Because it's like especially when an application is growing and growing. It's very important to identify them these locations earlier It's not easy to find a skillet testers So that's also an important challenge when we try to find some people who to run all these Manual tests or to create the automated tests is not always easy to find them Testing applications and the time constraints are is not good In fact doing anything and their time constraints is not good So but it's like testing especially bad because yes, you wouldn't you won't be focused on what you are really testing You just want to finish this and don't It's also important. It's critical to define which tests to be to run first So it's we need to know with which criteria we need to use to realize these tests We need to make sure that testers and understands the requirements This is not always easy because you know if it is depending on the person giving them the the These requirements and I just say the skillet testers are not easy to found and Communication with developers is not easy. So it's all these points are kind of related and the last one is like It's like we are not running just one project. I'm sure that most of the people here It's like we are not just we are not have just one model We have also other projects in our team and testing all these different projects is sometimes challenging because you need to have Skillet test is knowing more than one application. So it's like another challenge Okay, so this is our division on types of automatic testing The first one is not really a test but is checking for standardization Because it says that your code is passing your style Style definitions But it is important to have a good quality code Also, there's the unit testing or the integration testing That is saying that your methods are doing what you say they are doing In our projects we use PHP unit on the model site and just on the apps side and then we have this acceptance and behavior testing that Checks that your features behave as they say We are using cucumber. We will explain later What is this about but there are also another other frameworks like fitness and Also, we find important The user experience testing because it's a kind of test that will involve quality code. It's not objective so Always need somebody behind to check to check the tests and This test is meant to for just to know if the users Can do what you want them to do or what they want to do Okay on the part of this ten a standardization checks the LMS part has the Yeah, we have a Stupid, I know at least the developers we have the code in a style which defines kind of serious rules And we have two different ways to check that the code is It's okay with these rules. We have the same level I don't know if you know this you know this level But it's like if you add this to the any trucker issue this the cybot will be run and you will see some of the rules defined in the coding style like if the commit message is okay or the Some means there are some missing PHP dog blocks or things like that And apart from that we have also Linter the PHP code in the sniffer So it's like something that you can install locally in your local environment and put and it will help you to Identify or to follow the rules defined in the coding style. What about the pop? Yeah on the part of the app on every commit on every code You send to us There's a check that test that language strings are currently introduced in the code Also, we have a linter that is called as lint and is checking the coding styles And we have this code compatibility Because JavaScript is evolving very quick and we have to be backwards compatible Compatible So we checks that all the functions we are using Can be run on an Android 5 iOS 11 or the Chrome 61 version and For a final check we build the app to find if there are completion errors Okay So we will start on the unit testing Okay on the unit testing We run unit and integration test on the LMS part we run PHP unit and On the app JavaScript part we run we run jest But you have to be aware that all the JavaScript code that is in the LMS part. It's not tested. So we are not perfect Those tests are run without any browser So they are very fast and they are good for this TDD that is test driven development that is Encourage developers to write the test before start development of the functions Okay About PHP unit. I'm going to give you a few best practices But before that how many people has written some PHP unit test Okay, not too bad. Okay. So yeah, I guess I hope that you are familiarized with them Otherwise, it's time for taking a picture of this or to annotate them It's like we recommend the use of covers and covers the full class For this that has to check and to see how cover it is your application So go for it and that is label to the the PHP doc blocks I learned this one while preparing this presentation So the the group annotation is also recommended because you can run test For your plugins. So you you have more than one PHP unit file You can add this group label and then run more than one PHP unit files easily Remember that this important to keep the use of the reset after test To the minimum. So it's right. Just use it when you need to remove to to reset the data And it's important not to use it in the setup and in the tear down methods. So please remember this and Data providers are our friends. How many people has used out the providers when creating PHP unit? Okay, so yeah people that has written some PHP unit and hasn't used that the providers just your homework for tomorrow So it's like they will help you to just when you need to run the same test with several Scenarios with different data. That's the the best way to do it. We will see an example in the next slide Another good thing about PHP unit is that it's integrated with a github action. So it's like once you push your branch to go github several jobs are run and a couple of PHP unit jobs are executed using different model configuration ones based on PHP and Databases so that's okay because it's also you you will see if the test are pricing passing or your Boat has broke some of the existing test or the new ones that you have created About the there is an example. Yeah, maybe the letter is not the best so probably at the end of the yeah It's quite quite hard to see but we will share the presentation. So Here there are two methods the first one the one in the left is the test This is using a provider. So as you can see here We have the data provider, which is the the name of the method Which is the other one when when we have an array with all the scenarios that we will execute in so in the left one we have the the test to be executed with the parameters and the things to test and On the the other that the data provider is just an array with all the data that we want to test It's that easy. So it's not super hard That's something that you need to try and yeah came to us Okay, and on the other part in the part of the of the moodle up We are now introducing just into the app. So we have a Lower coverage for the app Just is installed using node package manager and if you Type np npm install it will be installed We have this issue that We are using the the app steam to We are using two hours a week to add more tests to the old code base and Is also integrated in the github actions the difference with the moodle lms is that if the test Don't pass the code is not integrated because it's blocked by github okay, and the next type of Tests is the behavior testing We have We have this behavior driven development as it is like the test even development but using behavioral testing test using these These tests are written in a customer or user friendly language. So every user should Be able to read those those tests and those are the main the main concepts of of the behavior Testing cucumber is the software tool that we are using to automate this test but the the current framework of cucumber for php is called be had and It's using gherkin language is we will see later How how this language is and if you if you are using this test You usually see this word mink in in the in the failures and it's the library that is used to control the simulated browser so So if you find this word You know what it is the gherkin syntax it's like Let's see how some examples gherkin. It's based on a feature So it's like in model probably people familiarize it with we had knows that we have a future file But for every fuinture that we want to cover in every feature file We have one or more scenarios and then every single scenario has a list of steps These steps is like we have several types of steps that we have the given the when and then it's recommended to have only Once occurrence of these steps and then add a lot of ants if you have to lead to add a lot of fans Or do you need more given when or then maybe that may need that you need to split this scenario in more than one The given is as kind of the preconditions that needs to happen to run a test The Gwen is like what the user has to do to The then which is the result. Okay, so let's see an example. I think it will be make things easier Yeah, again Probably the the letter is not the best for you, but it's like sorry We are trying we have an example here were to try to see the functionality of the login block we have in mudel a login block and On the right on the left side We have the lateral language a way to define what we want to test So it's like this feature which is logging from the login block that we have in mudel Just a few description. This is not it's not Mandatory is not running anything, but it's like just to see that you need a user with an account just to make sure that he can He or she can log in we have an scenario in that case We are trying to say to to test that Julia wants to log in as a student using the block This is just to be the successful scenario But we could have any more scenarios like for instance What happens with the user and the password are not okay, or we could also have some etched scenarios It's like this is just one example And then we have this different steps in the natural language We will say that given that Julia has a valid user account and that we have the blog the login block in the home page when Julia inserts his her name and password in the Block in the login block then she should look in that's the natural language what it says If we check if we make to translate this lateral and language to gherkin So it's like the one the thing that we have in the hat. That's what we will get It's quite similar. In fact, we were testing this with Julia and she was able to understand the code So it's like and she is not the developer. So yeah So yeah, it's like the feature as you can see is exactly the same test The scenario is like logging as a student through the login block. So that's okay I and then we we have the steps in that case. They are slightly different We have the given the following users exists in that case We want to have the the users Julia. We are using a big generator. They are super important because and they make Tests faster. So it's like something that we recommend especially because in that case we are not testing that They uses creation. So it's like instead of saying you're looking as an admin go to the site Administration go to users create an user. That's long and you need a lot of time for this We have only this step with the create these users done And then it's like for the login block for adding the login block to the main page It's not that easy because we don't have a generator. So it's like instead of having one single step We need like five steps, which will take longer than The other the previous one. So it's like that's why it's also important for you It's like if you are creating your vhap test, it's important to use vhap generators That's also something that we would like you to give from this presentation So it's like these five steps are creating The the the add adding the block the login block to the home page And then it's like once we have the user and the block We need we have this the when when I set the field user name to Julia and I set the field password to And I click to the login button So it's like you can see there the username password and the login button Then I should see that you are logging it and the login block should not appear anymore So it's like this is kind of the translation. It's not it's not that hard and as you can see a almost it's like a regular tester should be able to kind of prepare create them That's Okay, so who currently should write those tests We have here the three amigos the first one is the one that loves meetings The pro downer and the business analyst and they define the scope and Yeah, translate the user stories into current features. So they know how this feature should go should work Also, there's the developer Ta-da, okay the developer that adds the steps and works Behind the scenes like like how every step will be implemented in in the code And think about how everything works and the last one is the tester that will generate the scenarios think about edge cases add all the edge cases into the every feature and It wants to They want to break the application. So if they cannot break it you win Okay, we seen like the checks thing that the unit test the behavioral test and now the last one which is like the usability testing testing this can be automated, but It's something that we think that it's really important usability testings are not for finding bugs are for Trying to find improvements We have recently we have one person in Moodle our UX researcher in product experience team She's named her name is Cetara So we probably start seeing her name in the forums and things like that if you want to participate if you want to help us Do these researchers or participating in the service that we are doing we Recommend you to subscribe to this forum Or you can also visit our product bar in the ground floor and contact to Sabina. She's running some Test related to the database activity project that we are going to improve for 4.1 And you can also contact to Edu from the Moodle app. I think Edu is giving a presentation Edu has a presentation this Thursday at 12 30. I think so it's Is there? Okay here, so He's talking about how how the Moodle app has evolved to 4.0 and Yeah, 4.1 At 1 p.m. Okay a Part of all these types. It's also important to talk about the quality assurance a QA testing We have two different tape types of QA in Moodle Every week we release a version before releasing this version. We are Testing manually all the issues manually or not depending on if the issue has some automated testings or not But the ones that I don't have any test They need to be they need to be executed manually and we have a dedicated team for that and apart from that We have we have also the QI cycle cycle that runs every It's like before every release every major release About one month or one month and a half before the version is released And that's really nice because the QA cycle is also run not just because for this The dedicated team is also run by the community So that's something it's like if you want to help Moodle to get better and things like that That's something that anybody can do So just keep that and it's like if you want to help us you will see that there are a lot of issues to be test manually And it's important that it's like we're trying to reduce the number of issues in the QA and we are Moving from from manual test to automatic test. We are adding some behats there So that's also kind of related what we have been talking before Okay, so one of the objectives of this of this talk is to make you think about to have a QA team in your in your projects On or even in your life There are lots of roles on the QA part, but we separated into two Main ones the manual QA that will analyze and make all the manual test Execute them and make also exploratory tests. So they want to break the app, you know and creates a report and for example on the apps part they Find the coherence on on the iOS and Android versions and so on and on the other part on the automated part The non-functional QA will write how the test and when and what test They are needed and write a test plan Also, also, they make they run the test of course and regressions and for checking for performance And and write the documentation of that. So, yeah, and the other Like objective of these of these talk is to make you think that you have to invert the pyramid So currently in the moodel app. We are in the left part. We are not perfect We have a few unit tests even less integration tests then we have quite a few we had test and a lot of manual testing before any release and the objective is to move to the other part to have the To have less less work to do a more automated the elements part do did a great job on that and Unless The other are on the left on the right part So it's like Once we have all these automated testing layers It's easy to go for a continuous integration, which is why what we have in LMS as I mentioned before it We have weekly release every week And it's we can do this because it's like we have a lot of Things automated. We have the github actions. They help us to identify PHP unit failures. We have the cybot for the coding style checks. We have Jenkins We have Jenkins which is running a lot of PHP unit and we had tests So it's like this is helping us. There's not to have to run all the manual tests every single week And we can release this weekly every week As we are kind of It's like we have been talking about that. It's like this is a kind of summary. We will You you will find this summary in the presentation is just to yeah, and we can go for the next one Yeah, tomorrow you will find another be hat and testing Talk with Davos me. I don't know if he's here, but yeah interesting one. Yeah, he's there So check the schedule and this is one of our Pimpina la talks and Let's see what's next. Hope we can repeat again