Script03differences

SCRIPTING 03: SPOT DIFFERENCES 2 CORRELATE

Scripting Diferences

Now on the third delivery of the scripting series, we will find a better way to correlate. The technique uses the capacity to spot differences from our two scripts. It is recommended to work on copies of the original two scripts as we mentioned in the last post.

With the help of comparison software we will be able to spot the differences. From there, we must determine if it is a parameter or a correlation that is needed.

Finally we will know exactly when our script is completely correlated. Every difference on the back end code will be almost transparent. Easier than spotting Wally on those crowded images.

This gives a ‘fool proof process’ for scripting. It will help you to not to do the rookie mistake. I did that mistake myself on a beginning. I would record only one script and run it until it broke. Then I would try to find where was that it may need a correlation. Try to see if it passes after correlating something. And iterate like that until it finished.

It was time consuming and a very bad practice. Let’s see this best practice instead.

CHOOSE A COMPARISON TOOL

Weapon of choiceThe first step is to gather the COPIES of the recorded scripts and run them through a comparison tool. I insist again, use the copies, please.

To do the comparison there are multiple tools out there. Most probably your scripting tool has a comparison function too! But to my taste I recommend the plugin on notepad++. It is a plugin, so you will need the notepad++ software itself.

Most of the tools will show you the lines where there is a difference. That is cool if your code is not that wide and you can scroll and compare just that line. But the best tools will tell you also the characters that are different.

It would be like Waldo glowing in those pictures where the multitude confuses you. So many people or characters making it feel like a needle in a haystack. But thanks to this it will be like a glowing, buzzing and 3 feet long needle!

KEEP THE DIFFERENCES MARKED

While you compare and search for those differences it is important to keep them all marked for the rest of the steps. Further down the scripting road, you will need to easily identify them.

This one is quick and easy. But the reason for me to mention it is that it happens often. You loose  where you marked the differences and it makes you pass it again through the scripting tool.

We want to keep that needle in the haystack glowing and easily identified. Even if we come back for it the next day. Even if you start to change little things keep the markers.

CATALOG THE DIFFERENCES

The following step will be to identify from the three possible types of differences that you will spot. I define them an those three as they are the most common that you will find. They are:

Script differencesThe first type is the parameter. This type is all of the information that appears clearly in the recording. You will know them because you are familiar with them by now. You know that you typed certain different user credentials. Or you typed different amounts on a text box. Maybe the amounts that you typed are plainly showing. These are the easier because you will just create a variable for them to be changed while the script executes.

The second group is for the ones that will require correlation. They are not so easy to identify as they will look like everything that is different. Most of the code with differences will fall into this type. Some times it will be easy to identify as it will look like a value generated by the server that you must catch. Other times it will be just a bunch of crazy characters that you have no idea what they mean or why they are changing. Mark those.

Last, will be everything else. I almost did not create this category, but there are other weird things that fall into this. Such as client generated values, time stamps, uploads and other things that will not always be there. Few of them happen but it is important to mark them. Especially because you must figure a way to generate them later.

This is teaching you to see in the matrix code the differences. Without seeing the front end of the solution you will see the cute girl in the simulation. Trust me, you will get to a point where you will start to see them by yourself. Here we will tell them apart. Lady in the red dress, lady in black dress, a brunette and a señorita carrying some tacos!

READY SET GO

Now that you have the differences identified and divided you are ready to move on. The next step on the best practice is the most entertaining one. Some would say the most time consuming as well. Finally you will be ready to correlate and parameterize the script.

But with the steps we have followed for now, that is going to be way easier than ever. You will have the certainty that your script will never fail. Of course, as long as no one changes the solution.

But for now we are done. Get ready and for now… Vamonos!

To be continued

Besos! <3

-Señor Performo