PL-100 Microsoft Power Platform App Maker – Other topics Part 5
September 3, 2023

11. Describe the testing process

Hello. And in this section we’re looking at testing. So you’ve got your canvas app, you’ve got your model driven apps, you’ve got your flaws all set up but now what? Well, you need to make sure that they work correctly and so there are various different types of tests you can do. For example, there are unit tests. For example, is a particular function working correctly? Like the sorting function? So it could be a function, could be some functionality. This is generally done by the person who made it and it can be black box or white box. What do I mean? Black box testing treats the software as a sealed box. So you place yourself in the position of having no knowledge of how the software works.

You just examine the functionality by knowing what it’s supposed to do and see if it does so it requires the tester to have a test case which has various inputs and what the outputs should be. So for this, no programming knowledge is required. Now, due to the lack of knowledge as to how the software works, in black box testing, the tester may be testing the same process multiple times or may not test part of it at all after they don’t necessarily know what they’re looking for in terms of the wider thing, what total functionality is there. Now, white box testing looks at the internal workings of the program.

So here you could test individual units. For instance, you can also do end to end tests, also known as integration testing. So does the overall system work correctly or maybe just a couple of units? Now, with white box testing then you need to have knowledge of the internal workings reason, so that you can go down every path, every cold path, every branch. You can test every single bit of functionality. However, if you only test a single branch once with one input, you may not notice that it works differently with different inputs.

Now, over testing processes, well, you’ve got QA quality assurance testing, so this can be done by someone other than the maker, so it could be done in house or by the end users, so it could be unit testing or it could be an end to end test. You could use a variety of users with a variety of scenarios and say what are your expected inputs and outputs and do they match? And maybe you can ask your end user to put in some unexpected values.

For example, is an expense test of -1000 really acceptable or a date of 2001? And then you’ve got user acceptance testing which is UAT. This is done by the user or by the team and it’s always black box. So in other words, the end user doesn’t know the detail of the programming so it’s final stage before or after it goes live basically. Is this the system that the user expects?

So don’t give additional coaching. Is it intuitive? Do you know that you could press this button to view the accounts ascending and this button to view the accounts descending. Is that intuitive? And if they get stuck, what were they expecting happen? So this is the testing process. So you can have unit tests for particular functionalities end to end tests for integration, quality assurance testing and user acceptance testing. And they could be blackbox with no idea of the internal coding or white bots where you can look at the internal workings of the program.

12. Creating a test in Test Studio

Well, now we’ve gone through the various concepts of testing. Let’s have a look at implementing some testing. And we’re going to go back to our Canvas Accounts app. So I’m going to edit that and we’re going to have a look at the testing facilities that are in built into the canvas apps. And the first one of these is called Tests. So on the left hand side we’re going to Advanced. So there’s Advanced Tools and Tests brackets experimental write tests to validate that your app is working as expected. So click on open tests. Now it says Test may not work properly if a certain setting is disabled.

Formula level error management. So I’m going to set that by going to Upcoming Features and it’s currently in experimental, so I’ll just turn that on. I could have just pressed the button as well to get me there as well, but just to show you where it is, it’s in Settings. So this opens a test studio and what we’ve got is a suite of tests. A suite is a collection of cases. A case has a series of steps. So we’ve got test suites, test cases, test steps, steps a series of instructions or actions put together into a sequence in a case group together into test suites. If we want a new suite, we click on New Suite. If we want a new case, we go to the relevant suite and click on New Case.

Now, how to actually write all of these actions? Well, the good news is I’m not going to. All I have to do is go to record at the top left. So what am I going to test for? I’m going to test to see if I put an expense in. Does that change the number of rows? So let’s record this. So I’m going to go into accounts. Notice what’s happening on the left hand side. It is saying what I am clicking on. I’m going to click on the third here, alpine ski house.

The third arrow so you can see Raw free. I’m going to click on Expenses and then you can see there are no expenses here. I’m going to add a new expense. I’m going to set a particular date. Again, you can see all of this happening here and I’m going to put in an expense value and a description. And then finally I’m going to press this check mark here. So that’s my test. So when I run this again, it will put in exactly the same things.

So part of my test is, can I put in duplicate expenses? So let’s click on Done. And you can see that the computer has worked out all of the code. So we’ve got select, we’ve got set property. So that’s setting a particular property on a screen. So what do I need now? Well, I need to count the number of rows. So I’m going to do that right at the beginning. I’m going to click on this dotted out and I’m going to insert a step above. Now, I’m given four choices. Trace, select set property and assert. So we’ve seen select here, we’ve seen Set property here. In reality, it doesn’t matter what I’m going to do in terms of this choice because I can just override it.

So what I’m going to do is I’m going to create a variable. How do I create a global variable? I use set. So I’m setting a new variable. So number of records before, say, and I would typically then say something like count rows and then expenses and close the bracket. However, there is a problem with count rows. If you go to the documentation, you will see that the count might not be 100% accurate because it depends on a cash. So, in other words, this is a number that I counted previously and it only updates periodically. So I don’t want that. So I’m going to change that to something else. I’m going to say count if the number of expenses and I’m just going to put a true here, so it will count every single one. Now, you should note this right hand side. If I make a mistake, the right hand side will be red. And that gives me a really good clue that there is something wrong.

So I’ve set the number of records before. So at the end, let’s set the number of records after. So I’m going to set this again, doesn’t matter which one I use, paste that in and here is the after. Now I want to do something else. I want to see that number. So what I’m going to do is, well, there’s several ways of seeing. I can see it at the end or I can see it during if I want to see it at the end, perhaps, or manipulate the outcome messages. I can use Trace. So Trace just means I want you to keep a log of the following. So, number of records before and there’s a squiggly underline.

The computer is expecting a text value and it’s got a number. So I’m going to convert that to a number. The easiest way is to join it with an empty string because then it knows it’s got to convert this to a string. So it’s just a quick way of doing it. But I want to see it right now as well. So I’m going to put a semicolon. Now, bear in mind, if you’re in a non English lawcar, you’ll have to put two semicolons and I’m going to say notify. So I want a message on the screen, number of records before.

And again, let’s convert that into a string you can see beforehand. It was a bit dubious, it wasn’t as clear as what we got here. So let’s keep it happy. And again, I’m going to put this down here as well. So I insert another step here and this is going to be and sometimes you can’t paste. You might have to go back in and select it again. There we go. Now we can also rename these steps. So I’m going to rename this one. I’m going to go over here. There’s no rename on the menu, which is a bit odd, but I can go over here and say set number of records and I’ll do the same down here as well. So now we’ve got this far. I want a test. I want to see if the number of records after is the same as the number of records before plus one. If it is, then my test has been successful and that is called an assert.

So I’m going to assert. So this is my theory that the number of records after is equal to the number of records before plus one. If I’m correct, test successful. If not, I want to have an error message. So different number of rows than expected, right? So hopefully you can see what I’ve done. So in this video we created a test. In the next video we’re going to run it and see if our assertion in step 14 works out to be true or false. Take. In the previous video we use Test Studio to create. I have created have a global variable record for and counting the number of rows.

So I can’t use count rows because that might give me an inaccurate figure. I’m using count if instead. Then I wanted to keep track of everything. So here’s a trace. But I also want to not be notified. Right now I’m going to do the same at the end. And then I’ve got to test if the number of records after is equals the number of records before plus one. Test is successful. If not, I want to know about it. So what I’m going to do is save and then publish. And then I can click the play. So I will publish my tests and make this version of the app available to anyone who wants it and then play. Make sure you press save first. Okay. Now notice my mouse is over here. So I’m not pressing any buttons at the moment. So a notify has come up telling me that there are 14 rows. Again, I’m not pressing any buttons. So the computer is now going in. It is setting all of the values as before.

Obviously I could edit the formulas if I wanted different values. So it’s now going to finish off setting the number of records. It’s now telling me that there are 15 rows. The assert is successful. And so now we’re setting the number of records. We now know there are 15 rows. The assert is successful and we are done. So let’s make it unsuccessful. So now I’m going to say that number of rows is expected to be the number of rows before plus two. But I’m also going to do something else. I’m going to go into the test here. So I want to be notified when the test is complete. You can also have when the case is started and when the suite is completed, of course, a series of tests.

So I’m going to put in a notify and I can use a variable called test case result. Now, test case result has a lot of properties such as the start and end times, the test case or the test suite description, ID or name, whether it was a success and whether it was failed. What the failed assertion was the failure message. And any traces that we’ve got. Traces are asserts and trace entry. So it’s not just the trace, but it’s also the assert. So I’m going to put in Traces and Clause, the bracket, but that’s not sufficient. You can see here, Squidly underline it is expecting a text rather than a table, which is what Traces is. So I’m going to put a JSON around it, I’m just going to convert it into a so what I’m going to do is convert all of this into a text, and one way, for instance, is to convert it into a format called JSON.

So it’s just a quick way for me to just convert a table into text. So let’s play this again. Now, we know that the assertion is going to fail, so notice that there is a Copy PlayLink, by the way, and also not that it asked me to publish this as well. Ideally, I should also save it as well. So what’s that copy link PlayLink. Well, I might want to test this on a different machine. So different users can run the test on a different machine if they have got a Play link. And so that’s what that Copy PlayLink button is for. So in this particular test, we started off with 15 rows, we’re going to end up with 16 rows and the assertion is going to fail. It’s going to be false, actually. You can see here.

However, don’t click on this Play button. If you have made changes, you must save first. Now, once you’ve saved, you can click on Play. It will then publish it for you, but it won’t save it for you. Now, notice that there is a Copy PlayLink button here. So what’s that for? Well, you can test it externally, so different users can then test the same test, run it on different machines. So that’s what that Copy PlayLink is for. So you can see in this particular test, we start off with 15 rows and so we’re going to go to 16 rows. But my assert is going to fail because it wants 17 rows.

So let’s just see what happens. And let’s see what happens at the notify at the end. So there we can see the assertion failed. So it says different number of roles than expected. So the test failed at this step assert. So it’s probably useful if you have more than one assert to name them differently. And if you’re not at the top, we have got the notification of the number of roles before, the number of roles after and the assertion failure. So when would you use test studio? Well, you should determine which test cases should be automated, repetitive tests, high business impact functionality, tests features that are stable and not undergoing significant change, features that require multiple data sets and manual testing that take significant time and effort.

Now, I’ll keep test cases small so you can more easily identify the failures, keep expressions to a single test action. So I would suggest just having one big action per expression per step. Though sometimes, as you can see, I can join two together. Every test case should have an expected result that you can test and you should also use suites. So for maintenance you can group or categorize similar test cases together. And you can also, if I click on the suite and go to the top, you can enter a description for the suite and a description for the case, which is always useful.

So Test Studio, what you can do is you can create suites within suites. There are cases, you can have multiple cases and then you can record your steps. Once you’ve finished recording, then you can put in traces, you can set variables to see what before and after is, for instance, and you can then test a conclusion, an assertion using the assert function.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!