Live Coding Happy Hour for 2017-02-10 - Server Scripts with Automated Test Framework

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome to this belated edition of coding happy hour I am Dave Slusher thanks everybody for joining and let's go around the horn and introduce ourselves if you might want to move your camera up just a little bit or your head down we're getting here you're sort of anonymized by my problem yeah we had quite the challenge and the noble effort to try and get this the other way but I'm Chuck hamachi platform architect with the platform practices team working with solution consultants and wonderful people like Dave and Josh and I am Josh Nereus I'm a developer evangelist in the platform business unit here at ServiceNow I work on the same team as Dave and I also get to work with Chuck from time to time and I'm Dave Slusher a developer evangelist on the platform team developer service NomCom if you want to get yourself a free developer instance and do all of that fun stuff all right so we're about 15 minutes late here we had technical problems in the audio like and in fact I'm have more or less isolated it to my computer because I have figured out that I have actually had corruption on my disk and I went and repaired disk earlier and so I'm going to take the whole blame on this is that it's almost certainly my system for this is that when we go to do the audio I'm not routing it correctly and so our grand vision wasn't we were gonna do this both live to live coding we're gonna use OBS and stream it and go to live coding that TV as well as YouTube and it's just a good dump so what we're gonna do is go back the old-school way you guys cover me for a second while I get set up because I had to reboot and yeah you bet this is this is a continuation of the automated test framework am I correct Josh yep that is where we're gonna be picking up so we spent a bunch of time doing various things with ATF we played with some forms and did some lookups of data and learn fun things like you have to make sure your workflow is actually checked out I'm sorry not checked out it's got to be checked in before you gotta have been yes exactly the problem I was trying to test a non-published workflow which for some crazy reason does not work very well when you're when you go to be the different user they were yeah that makes sense that's the way workflows work you can test them when they're checked out but nobody else is using them until you check them in so if your if your test was impersonating a user that's effectively like logging in as another user and they can't use the unpublished version yeah yeah exactly okay so now we're looking more into the scripting activities yes so we'll talk about this and let me go ahead and lock the screen to myself yeah as I was doing a demo last week and somebody said well show me how you can script something and I said well there's about forty five lines of comments in here that tell you all the api's and I was struggling to throw something together on the fly yes learn as much as contribute as much today so we I played with this some last night so that our initial test you know an T test that worked fine last night was I spent about an hour last evening working on this and I found a couple a couple issues that I gutted through and I'll give you the fast-forward version actually before we do that since we're in the old school thing Josh do you want to do the API thing of the week where you want to just bag it because we're having so many problems you know let's save that for next week just because I lost some time and that way you can get through this okay so step number one as I kind of fast-forward through my my lessons learned is everything that I was doing up to this point we were doing in the same scope as the application that I was creating so the test tracker is what I was writing I travel tracker that was what I was writing the tests against and in that scope all the tests existed and all was well and good up until I got to where I was trying to do some Jasmine testing and lo and behold I was not able to get the Jasmine tests to run when they were running from inside the scope because I would get aspects of the Jasmine test were saying you know that they were just undefined so I said hmm let's take this off the table and I took the whole test and I cloned it into global and as soon as I did that those parts of that began working assisting step number one your so everything up to this point I did a in the same scope and it all worked so it's creating the tests in the scope when I got to the server-side scripting that did not work from my scope so I had to switch to go global for that so that was lesson number one lesson number two was that I didn't quite understand the syntax of how how to get to this so let me well kind of go bake off and I'll just show you what I did last night that that actually does run so the the context chuck that you brought up was you know to do so so the first you kids you brought to the table was when you've got your your test is running some code and as a side effect creates another record and you want to assert that the records there mm-hmm so we have there's other ways to do it but absolutely the Jasmine you know jasmine is capable of doing that so this is what I and this is what you're done about before there's all this boilerplate that comes when you create that with example code of how you you use this and so I I created this test last night and it took me a while to figure this out is for a little while there this is my this is K by the way again with all this ATF stuff I've more or less come to it with complete naivete right I know nothing about it and so I came down and I saw in this boilerplate you know example code up here that you can do this right that you can use this to get to get the output of previous steps right so this is the equivalent this is the programmatic equivalent of that little cannonball icon that you have when you're doing the you know when you gret using the UI to create the test so everything that had an output from the previous test which in our test here was steps one in four creates that now I was reading this and I'll be honest I thought that this right here was some sort of magic syntax and I did not realize I worked with us for about thirty minutes before I realized that this is not only magics intended it's not this is literal just description this is pseudo code uh-huh this is saying put this this ID of step one in here oh that makes me sad that you have to hard code it absolutely doesn't make me sad too so and the other thing is the again what I'm saying is it's the Society of the test step so that that's you know so you have to think about it for a little bit and so to do this this I had to go back to here right and get you know step four I had to get the SIS idea of this guy know so you know the just the other way so that reference to that record then can you you reference like the cannonball thing does the user that was referenced from writes that but this does yes so given that sis ID no oh and okay so given that sis ID I can come back here and in my server-side script and I'm gonna apologize to everybody there's gonna be more navigation in this one typically is partly this is a validation of like how nice it is to when you could do stuff in studio because this is a throwback to the old days when you had to navigate every time you did anything navigate something so that's the the SIS ID so the object that it creates for you out of here it's more or less like a look up into a hash table of outputs of previous steps given this you can get anything that's defined on that okay now the other thing is and this took I'm not sure if this is documented I haven't found the documentation in some ways we're kind of creating the documentation here is that I tried multiple bits of syntax to actually get this out and you'll notice that it took me a few tries if you watch the video last night what's the first thing so you've got this object so don't look at the thing just look at this you've done this and now you've got an object that represents the output mm-hmm what's the first thing and you know that you can dot walk to values of that what's the first thing that you would like naively try the principle of least surprise you don't dot like there's a dot property to get this this idea what's the first one you would try that's society exactly that doesn't work that's not it so I think that's a little bit of a violation of offense principle of least surprise yeah if surprised by that then I'd probably do a json.stringify on yoga I got back let's do that yeah we did not do that yet and let's let us see let's go ahead and we can do that so sort of my look under the hood and find out what properties do I have let us see if that works because it's wide record I'm curious to see if that's gonna do it it may or may not I don't think it is a glide record well let's see what this tells us I'm gonna go ahead and run this so you'll say that fast-forward it for that one record ID is the value that contains this society of one of our developers miss boot camp I don't know all right so I'm going to update this and I'm gonna rerun this and we can just talk about this while we you know cuz it's gonna the other thing is it's gonna take a little bit you'll notice too that it did all those server-side steps it's now waiting for a client test runner I'm gonna click here this will open a test runner which did it do it I'm in full-screen mode so I don't see you know and one of the interesting things about this if that is a record and not an object that would probably explain why it's record ID because the record itself will have a society because everything has a society but that's that's what yeah I'm sure it represents something other than your typical black record and what I might do in a second so you see over here in the script I just switched yeah I was talking last night about the length of time it takes to run these and so I may actually spent we may take 3 minutes and see if we can cut that down because I think there may be some if you remember from previous weeks we had that parameter that we pass in basically like the amount of time to wait for a thing to happen and we might try shaving that down because I think actually is settle on the high side and okay so we got it we got the test succeeded but in fact in this case we're not that's not our primary thing we're looking for what we want to do is now look at the log-dog of what this thing logged is as it was as it was running hmm interesting so there's a bunch of this stuff but back to what we talked about in previous ones will we see anything on the system long because of rollbacks is that going to only show up in the test log oh that's right that's right okay so that's not that this is actually not the log we want to look at we want to look at the - no actually I believe at 30 okay pack roll back so what we want to do is actually look at the test result because he's logging that to the test result as long this is not the longer you're looking for ah-ha-ha-ha much better so this is in fact what can we do to record watcher blacklist equals true serializers okay we're gonna have to hold on saying we're gonna need to copy copy this guy cuz it's too much to see what's that what's the one that you guys like Jason beautifier Jason beautifier is good one yeah Jason is a person I think Jason McKee needs to creator kannan and forget the a on his nametag all right so this is nice on McKee I think this is what was returned this is step four basically and so we got let's see what we got from the bottom and go up record ID wait a second record record ID false table Society is empty table is empty what did it give us what's that other ugh that makes me wonder if those are Oh meta stuff are those those things that we can't see if they're objects that Jason that string if I can't serialize maybe like trying to do a string if I on a glide record yeah something like that because yeah so that didn't know here's what so let's not we're not we don't care about the value we really only care about the keys so this tells us that table record ID sis ID are all they're all defined okay and those are the only three to five things that define on there other than system meta alright so that's we learned from this so what we've learned is that we've got we only have so sis ID theoretically should actually be working let us go back and see why this week which can search and replace with not really alright so let's go back down here so step four output so we're looking it up via the sis ID this is this ID so we string a fide that object yeah that doesn't actually show anything and so table name which intention table okay go ahead and let's do sis ID because we want to see is that was it just a Bogut bogosity of like my test that we weren't actually seeing it because according to that that audit this ought to be populated so we want to see so I'm gonna get rid of this I don't think we need that again so this and I'm gonna go ahead and get rid of this because we know actually that in the log just shows up empty probably for exactly the same reason is the other thing which is that our stringify is not descending it's not recursively descending into the objects okay which frankly it ought to be if I worth its salt you think would you'd think it would alright so we'll go ahead and go back to this I'm gonna update this and run it one more time actually before you that ID activate some of those other steps I off the top of my head we're gonna need some of these guys in there and number four yeah we're gonna need number four for sure let me see timeout there's only one second on that one let me see if any of these other two have timeouts that I can shorten that does not just open a new form have a timeout it's not submit this I know so really it's just yeah we'll just have to kind of suffer with this the way this okay I don't I thought maybe we could shave some stuff out and make that run faster but I don't see that happening testing your test all right so are things still running happening happening happening etc cetera I need to go back and watch the other ones but did you describe what the whole describe and and it function and what not work no so we'll get to that in one second so we really kind of jump to the middle of this so let me back up not I missed episodes one two and three when I walked into a new hope yeah this is in literary terms we're doing this in media rest flashback to the flashback to the yeah seriously so let's look and see so now actually now our table is populated our document ID is populated and our sis ideas populated and different they are different so so as record represent step fours society no because that was 0 ee 0 I think the document ID is that the related one and this is the actual record itself or is that the test I don't know is that the step no the step four will ended with 0 ee 0 it not the not the definition of the test step but maybe I don't know so so here's what we know we know that these things document ID and sis ID are not interchangeable which off the top of your head looks like looks like it might be that was record ID oh this is what yeah yeah record ID but this is my moment your your label my label on my luck and also it's not table name so this is all I didn't change these to match but if we use a dot table we do actually get the right so I think what this is is this is the SIS idea of the flight I created this is the table of the flight and then this is the record ID of the related record that we created that would make sense ok I think that's how that goes good to be wrong on that because now actually now that I think about it this has got to be the SIS ID of the because we're looking up the incident by but again let me let's go back and talk about what we're doing here so you know look at step four now let's let's actually just talk about us so so when you do you go in here and you create one of these server-side validation scripts first thing you'll see is this every time you create when you get a giant splat as check referred to of this boilerplate that this is you know a lot of the documentation that you have this is at this point 100% of the documentation I have because I haven't gone out and saw it anything else because part of the experience is of us seeing what you can do without having to look at it you know and now I think we figured out that this is one of the things that may reward a little run through thee whatever is published so this is kind of how you from the outermost level this is how you do the Jasmin tests see you do a describe you path you're passing it to parameters which is the name of the test you know the description of the test and then you're passing it a function to be executed then you have the it and I be honest I don't love this because this is I wish this was something more descriptive because what exactly I think it should be something I expect or I don't know what you know it to me this is not a great name for the thing but then you're kind of describing describing the unit of work in here mm-hm and then in that you're also giving it another description I don't off the top of my you know at this point I'm I don't really deeply grok the difference between the describing the it it seems like a second level of doing exactly the same thing right it's really organization it's really saying describe is like sweet and this is like a test that's D and this is like Jasmine specific stuff this isn't a service now's decision this is this is just the Jasmine framework like this is you know like ever since we started doing this you've ever know you notice if I have a drum to beat it is clarity over everything right so for me if it's longer or little more cumbersome I will I want this to be as clear as possible and that to me of this kind of a little problem the jet has been syntaxes it's not this is not clear but same kind of things you're describing the test and you're also giving it a function and that function is arbitrary code inside that arbitrary code you can have I'll work as we saw before you can have essentially you can do any kind of anything that your environment can do which means you have glide system you have glide record etc so at this point in this block you're doing service now work exactly as you're used to doing it in addition you have a few more you have some Jasmine functionality that has been injected into the scope and this is the main one that we're talking about this is the meat and potatoes of this thing which is expect and expect is you know this is using standards expect syntax you expect a condition and you this is like all this stuff you can use this like if honestly if you got rid of the not to be false it would be the exact same thing that I believe in expect and Josh you may know a little bit more about expected I do I believe that these are like mapped to no ops they so the not is mapped to a no op yeah I believe you are correct with that like yeah so so I said basically and expect your chaining things together it's kind of it's sort of that style where you know this is this returns an object and then when you do the dot your it's essentially not much different from the dot walking right expect it's basically dot walking this thing and calling each thing to the right is calling the thing left of that and you know so in this case just expect true is is equivalent to that but you can't again that you know i'm not i'm not one to poopoo this because this increases the clarity so yes so any and you could also do that you could so this is actually not this isn't the to be i think it's not a no op because it's not a to be there are other things in here that are no up so these are probably this is probably actually a negation operator and this is like a comparator probably but there are things in this expect syntax that if you actually go down and look at it you see that they're just mapped they're just there to make it kind of natural language II but they don't actually do anything so you know like expect not to be false its implicit that you're expecting to true but you see then if you look in the boilerplate so this is what we were playing with the first thing is retrieving the object that is the outputs of previous steps and as we said we don't none of us here I think everyone probably everywhere agrees we don't love this it's probably a thing that just had to be done to make it work on this timescale of the original release but you know I don't can't speak - I have no insight into anything that's happening on that before or since but that that kind of has that feel like that's the only way we can make this work so let's do it this way and so then now you hear you see in the boilerplate stand you know this is the kind of things that you create a create a glide record you can query on the glide record you know set value you create it in this one I'll show this a little a little bit of boilerplate code this is actually creating a record so you certainly have that available to you if you wanted to do that in there so this is you know this this bit of example code is actually doing an end run around all the stuff we're doing it's actually directly creating a task inserting it you know and then looking to see you know read it back it's actually not even doing that it's just setting an output and so it's setting a message saying that it successfully does it it's actually not even asserting on that it's just creative yeah because it's it's doing again yeah oh yeah you're right is doing it on the same table and saying try and get that society that you just got right and so this returns through yeah this return true is kind of the I think probably the failed success fail although I think probably the nature of these expects similarly is that yeah I think if you do an expect it probably changes the return value to false I'm guessing that I don't know that for a fact but it seems the same Ida curiosity here let's let's go ahead and let's experiment that what I would I get out of the return true and return false is that they also had some output messages yeah so let's go ahead and I don't know how you would do that with the expect that's that's interesting so let's go ahead and do this so we know that this test we ran this test earlier it passed right so I'm gonna go ahead and let's do this and this is just another so you get the steps you get the outputs and step result and these are kind of magic things that are in scope that are just being passed to it so I'm gonna set the output message here and to didn't really know notice you have another expect yeah yeah so I got to to expects in here equal you'll notice that I did this I did this last night when I was playing with this so am I on ie so this is actually how I figured out all this stuff about this is my naive first step at this we'll kind of talk about that is I did created this query so we wanted to verify that the output which is the output of step four when I'm verify we had an incident with a correlation ID that was the output from Step four so we did the query passed this in here and then I did this right here expect gr next okay so that asserts that this query in fact returned a record what and then I did this just to goof around I actually ridden put this 10 because I expected the ten would fail the the log messages that I saw was that 71 is not equal to ten and what I expected was something like one is not equal to 10 and then I said 71 how am I getting 71 and then I realized that this was empty and in fact what I was querying on is everything every incident in this you know out of the bottom wall sure it had no correlation ID so I was doing it the opposite query that I was doing almost so then that's when I that's when I put the second one in so in fact in this test this is basically superfluous right this doesn't this I that's still in there as an example but that's actually not doing anything realistic because then what I wanted to do is what I really realized is that this is kind of a bad assertion because it doesn't it doesn't go towards the badness of my query because I'm expecting one and only one and that returns anything greater than zero and so it's possible for a lot of this to be wrong and then you know so at that point that expect that there was anything returned by this query did not tell me anything that I expected or I did not tell me it did not tell me if this test passed because this test is verifying did I create one incident with this correlation ID because my step for output was broken I in fact returned the opposite of what I wanted and because of the way I was asserting on that I wasn't telling myself anything what I want to know is do I have one and only one so this is really the expect that I want for that yeah yeah okay so that kind of taught me an object lesson in construction of these assertions which is that you know asserting that anything is there is probably a bad way to do it because it's not going to catch a bad query that is too broad or wrong so so that that was kind of a lesson learned so I'm gonna change this to didn't really fail testing so now our expect is gonna pass we're gonna set an output message to the step result and we're just going to return false at the top level so I expected this would I'm gonna stop I'm trying to not use the word expect is overloaded in this context I would anticipate that this will now give us a failed result and it will give us this message at the top we're just kind of again we're going for principle of least surprise what exactly is gonna happen when we do that so we know that the expects call when you expect call fails I actually kind of know what that looks like and if I go back into the test results I can show you some failed ones from previously I feel like I'm talking a mile a minute so how many of these expect arguments the methods are available on the server-side code well let's go ahead and I just did a quick search for jasmine expect and I see things like taste expect date to be after other date are those applicable to glide date time dates or expect client-side dates I just threw a a thing in the chat for you Dave there's a jazz intro okay if you look for Jasmine's I think if you google Jasmine syntax I'll get you there as well but they actually have a nice breakdown of a lot of the things you can do because it's one of those things where there's so many different ways you can chain these things together you kind of have to see the examples young Oh interesting so I returned false that didn't it did we logged that it did not fail and I kind of think that makes sense I almost said expect because I think that makes sense because you know in essence the assertion I mean the expect is your assertion and what you return I don't believe has any bearing okay so then the question becomes and this is what Josh is start with so this is so this looks like you know this is the boilerplate that we're talking about and then as you scroll down you started getting to us all sorts of different situations where you can expect to be expect not to be equal to be defined you can actually do things like yeah something you've been called I mean it's pretty crazy to match reg ex expect to be defined so we're just looking at null not null or undefined to befall see I like those truthy so truthy we're talking about things that coerce to truth one you know any character value the word true and false II would be like zero the word false what else I can't remember tell Scott coerces to false no no undefined jerub-baal to contain so that's a that's in an array saying does some member of an array contain that nobody's o or substring kind of in Java Script you know strings and arrays have this kind of fuzzy Venn diagram where they overlap like to be close to be close to to be close to interesting so you can define how close that's pretty cool to throw yeah what's that so the second is that within two significant figures is that what that is saying that's what it looks like or [Music] expected digits I don't know yeah so that's why I'm sure there are individual have to look at the to throw to not throw I feel like I'm learning a foreign language to throw error be to see to play to two years to be here not to be contain any kind of to equal alright so you have this and this is you know so this is basically I'm gonna Exuma that is the this here is the test john Caruso's also put some good stuff into the into the YouTube chat okay cool and I think that's what we really isn't that the same thing we're looking at right here I guess I oh I believe that that is exactly what we're looking at yes it's the same thing sweets can be disabled with the X describe that is the opposite of clarity but okay it exists X destroy so do an X and that will skip it and there's an exit interesting so I guess I mean it's probably better than calming it out at least it it makes it makes it clearer that's there but it wasn't run right yeah it's hmm okay I'm gonna withhold I'm going to think about this before I jump spies look pretty cool by the way I was looking at eyes are basically let's see what spies are spies are observers is that what they are yeah so this is it's something to say you can you can spy on a function or method and come back later and say did something call it so maybe you have code and you don't know if anything's actually calling it you can check later now I wonder if that would work with our crazy call stack that's the thing I was thinking to I know that we finally have Beckman script five I know that things probably require Atmos script six or one of the depending versions which we don't have so that might be an interesting exercise is to determine which of these are compatible I would guess most of them are yeah I would like that would be really interesting to see let's say that you've got a function and script include that should ultimately be called like by a business rule could you assert yeah you could do it like you could maybe spy on it you know then insert a record and verify that that that function was called or the business rule was called potentially I think the key is that somewhere along the way you have to have a reference to the function that's actually getting called in order spy on it is I know that's an interesting one do you ever say it's not by name it's by reference yeah so when you define this by notice you've got before each so foo equals set bar so we're spying on foo on set bar so we're basically yeah we'll have to we'll have to dig into this a little bit yeah that's interesting because that could be really cool depending on yeah so now we're getting down to the more esoteric well we're basically we're mocking where you can delegate to other functions throw error stub so again the other mocking type mechanisms which you know if as you were going along at some point you're gonna get to where you hit code that you don't want to call the real code which either because it's too burdensome or let's say it hasn't it ultimately is gonna call to an integration that won't exist in the testing environment or somewhere in there you get to something that you don't want to really call and so this is kind of where you're beginning to beginning to get into that with these stubs and stubs and fakes and things like that okay so good set there's a lot of good stuff to be dug through on here again we do not at this moment know exactly which of this whole set works in the ServiceNow testing environment so that is a thing to be a thing to be aware of go ahead and get rid of some of this too guy right here I never snooze pushbullet so luckily nothing crazy jumped up now that we run this are there other examples on the server side of things the you know could have come shipped out of the box or there just wondering if there's anything interesting we can glean about specifically how it's running in service now so let me show you what I did let's see do I remember I thought we had some out-of-the-box Jasmin tests that we could throw I think there are a few oh it's not that okay what's the four tests step I'm looking to see what the class name of the test step is so I can sis ATF step ok this ATF step so let's do sis not I want to look at the individual steps sis yep this is every test step defined on this system mm-hmm and we only want the server-side code thing I want it's maybe that step configure I think yeah so you note that out of the box there's not a huge number because mm-hmm two of those are mine mm-hmm there's four there's a successful failing server-side script multi best test and let's look at the multi I think the multi batch test maybe was one of the ones I had more notice picked wrong looks like just an object definition yeah so this is one of those two and this is the one where I figured out Oh like looking at this is where I figured out oh those are literal IDs and that's how they're caught they know that's what they're calling two-step yep and you'll notice actually so in this one it's actually getting the username of some buddy that was impersonated so username is how they got that out of there interesting something that from step one right so it's idea of the step not the person that says this is this yeah this is ID of the test step right right okay right and this is the test that's test is the study of that test step and that's what gets you know you notice that this one it got dot value and out of curiosity so let's go to this guy so you know what's happening that step two I'm curious so let's go to this is the test that's happening there so we can custom screw custom scripted test config so this is this is even different from what we were talking about before this is so it's using yeah got the name of the user no sorry so this is the the code that thing is calling oh okay so this is one of those were we talked about how you could script so this is the step this is the step config you know so this is like when you create a test step that's impersonate a user right it's one of these is built already for you this is them creating one of those step configs themselves and then adding it as a test step so in this one they're doing an you know so this is kind of an arbitrary example code thing right where it's just saying assert the name of the user starts with a you'll note actually so this is actually the thing you know that we were talking before about the hard-coded descriptions when you add them you'll notice that these step configs have a description generation script got it so this thing is running every time to generate that I'll create yeah got it and so this is the actual code of the test step and so it's getting you know an input variable it's in their case you know it's getting it it's asserting here that it starts with and then if it if it doesn't it says failed and returns so that's that's like code of of so you could write your own step config you could do something like this so at the output let's find where it's setting the output so setting output message this is what it's doing right here user with sis ID oh and there's output stop value as well so it looks outputs so that's the yes so that's where it's setting essentially that's what it's putting into that hash and that's what it's being read later so output slot that value is what it's returning so you'll notice it's got inputs outputs and step result so it's setting the result which is like what the test Runner sees and the output is what it's making available to subsequent steps so in fact let's go and let's look at the it's going to look at the step config for impersonate oh yeah that'll be pretty interesting and so what we should see is when we go down here we should see outputs do we not have no we're just use read-only oh look at that read only based on protection policy and oh yeah I noticed too it says the class type was Java so this is not necessarily good we don't want people writing other scripts that impersonated I wonder if it's that way for every other one of those so let's see if we can do a so see if we can do submit form so I'm gonna go back to mine we're kind of going far field but actually this is I you guys are interested I'm interested yeah we're kind of exploring this so if we look at the step config for submit a form that will also read also read-only oh it's read-only be honest type of script yeah we can see it okay so what we want to look at is a step step result well I don't notice though is the output variable is there a related list on this one similar to the last one because I know that step result outputs so interesting you'll notice that the in the one it explicitly created output mm-hmm but it looks like step result dot outputs is the same thing because there's your there's our record ID there's our table record that's how they got there so it says we're in here let us figure out what in the heck this ID is what's being said on there is that the only that looks like the only oh wait there we go no somewhere down there that's the only two references to it the Society of the forum we were about to submit that's gotta be something else yeah I'm not seeing interesting how you can reference a test frame window though so I I feel like this is this is my theory is that the output so that's getting written to a table mm-hmm and the record of that output has to have a society because every table every record in every table has a society so that society is just the output it would be like this this idea of a of a syslog message lease it's fully alright as was I speculate all right so the object lesson is when you are reading these outputs do not get suckered into using society because it's almost certainly not meaningful for anything that you're trying to do mm-hmm if what you're trying to do is work unless you're trying to do some real meta thing if you're trying to work with the values that have existed through the chain of everything that you've done then they're probably not going to you know that that's not gonna be contained in that society it'll be something weird and different so getting all the way back to where we kind of started this no it was good that we dug down into the configs and see what no I didn't know how many that worked honestly so that's cool because now if you had no idea what it was you could actually go and look at this doctor bag and find out what's it writing to instead of write what that does is that gives us I'm making it assuming that it's a transparent enough that you can go see it it might be completely opaque like the impersonal it is but assuming that that's available to you you now have a way to you know these are not unknowable mm-hmm so we figured out the one way by string of fiying we could see the keys although we couldn't see the from stringify we could see the keys that were defined that is one mechanism we hadn't change this one in here because it forget him he's bugging me because if we run this again we probably won't even run it now but but so that was one way but we could go look at the code of the testa and if we were creating if we were coding our own test if I don't say this properly if we're cutting our own step config and then instantiating that as a test step we could we can put anything arbitrary that we want in step result dot outputs dot any value at that point it's like a you know at that point is like a scratch pad right it's it's just a JSON object that we can fill with anything we want mm-hmm and then at that point it's callable and I think probably that's also the definition of what would make a cannonball icon appear for subsequent ones that would make sense so that might be the thing we want to do so we're kind of wrapping up at this point at the that might be a thing that you next time we address this we probably not gonna do it next time so maybe you know at some point in few weeks or more we'll come back to this when we do that might be a thing worth doing is kind of figuring out something we want to build our own step config for and then do some of our own custom inputs and outputs and see what we can what we can do because almost certainly you know this is one of the things that we do know I mean we don't talk about roadmap be forward-looking things we do know that business units in the future are gonna be building their own test steps so you would have something like so the way out like all the all the step configs that exist now are very literal for the platform rack submit a form get a value at cetera cetera they may they would be a higher value like get a cart assert you know assert a cart value and so that you know the the team that develops service catalog would would deliver those test steps to the larger platform so it's gonna be or we know that it's gonna be organized that way right people that do the functionality will also deliver their own step configs to test that functionality that means but this is a long long journey right so in the interim if you found yourself needing something like that that doesn't exist you would have to build it yourself and so if that was the difference between you know getting some value out of this and not you're gonna have to kind of go the long way right now you know as of you know February 2017 Istanbul that's kind of what you have available if you need something outside of a delivered step config cool so one more thing to look at Dave so can't go back to that test step config for submit for sure because there there's one other thing we found it in the code but it looks like there is a related list for the outputs and I'm suspecting that this is what's driving the Cannonball because it would be hard to infer from the code but if you go down and see the related lists at the bottom let's output variables interesting yep and the output variables have those two things that we found in the code oh so it may not be purely from your script like a REST API you've got to read this oh this table and record ID yep so those are the few things there's the type that's probably even more well certainly a simpler way so you don't have to dig through the code but now the question is so we can look so when we create our own where you create our own step config now the question is and we'll have to figure out like our hypothesis and then kind of what order to do this stuff is if we put it in the code and we don't have it here mm-hmm my hypothesis would be you can use it programmatically but you can't see it in a cannonball I would agree with that and then we default to a string yeah yeah I don't even know this seems to have a definition type but I think that I think the definition type I think all of this my guess is gonna be everything about this is the cannibal not about filling the value so I think the value is gonna be whatever you put in it like when you do it up here yeah whatever value you pass in you can still use it still use it how the UI is to treat it it's probably based on this oh yeah that would make sense go with that I think it's a solid the things that we do we'll do it that way to test it a few times and then it'll be a theory yep so that's what we can do is we can do a simple step config without doing any of this stuff and see do we are we able to access that a Jasmin test and what do we see in the cannonball and then we'll add this in and and see what if it adds it yep yeah yeah I like it all right gentlemen okay so I apologized everyone for the dumpster fire of the first 15 minutes I have to figure out my figure out what's wrong with my system I which is um be honest to it and tell you that I'm extremely disappointed because I was very I was so very very excited about the first simulcast to - live coding TV but such is life que sera c'est L'Amour come to my world now the real question is can we define test configs that we can expect the audio to be true and test our setup no it's bad job what we just acquired I can't even figure that out I expect audio and by the way it was such a such a mess trying to get this together I never even got a beer do you guys have a beer tell me about your beers so I have the ballast point Commodore American stout it is still sealed I was at ballast point earlier this week but I didn't have that one I have nothing because I've been up since 2:00 a.m. local time to travel across the country so independently all three of us had zero beers amongst us I have maybe that's what went wrong I have Speedway coffee and my leftover iced tea from Outer Limits lunch yeah so I really truly want to get this on live coding TV we are alive edu TV by next week or next time which I think will be next week so I'm gonna figure out what's going wrong there so I am very bullish on that platform because you know as much as I like YouTube and what the beauty of restream is we don't have to pick one we can we can actually simulcast everything well I have to be able to subdue it's a bandwidth thing or no I have to be able to rtmp to anything and have my audio go that was the problem okay so I think my I think my sound flower is corrupted the fact that my office tools died earlier today and I had to f FS check my disk to make them work again it's gonna it smells to me like it's my own system that's uh it's uh it's like lupus of my lupus of my computer it's beginning to eat attacking alright so we'll end it there thank you everybody for attending and is there any lingering thing in the chat not really no doesn't look that way thanks again John for all the help wait for the links and things like that always appreciated thank you John thank you Craig step and thank you everybody who showed up and we will catch you again next time happy coding and have a great weekend everybody and this will be awkward because I don't have a normal setup where it's easy for me to stop them
Info
Channel: ServiceNow Dev Program
Views: 5,025
Rating: 4.757576 out of 5
Keywords: servicenow, automated testing framework, lchh, live coding happy hour
Id: zN91QeAziew
Channel Id: undefined
Length: 51min 50sec (3110 seconds)
Published: Fri Feb 10 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.