How to set up a Synthetic Monitoring project

[0:00:00] Welcome back to the Checkmk Synthetic Monitoring series. In the last video, we met our hero Bob, and learned how Robot Framework and Robotmk can help him to test his complaint portal like a real user.
[0:00:13] Today, we set the stage for his first test by covering the fundamentals of Python environments, installation of RCC, project setup and environment activation, getting started with Visual Studio Code, and the robot file creation.
[0:00:39] Robot Framework is written entirely in Python, and the same goes for its libraries.
[0:00:45] So technically Bob could just install everything into his system-wide Python right there on his machine, but that's not a good idea.
[0:00:56] What if he wants to develop different robot tests with different library versions, or what if he wants to run all these tests on the same test machine?
[01:05:20] This is impossible with only one single Python installation. Robotmk uses a smart tool called RCC for this problem.
[0:01:15] For each robot test, it creates a dedicated, isolated Python environment.
[0:01:25] RCC is just a small binary that needs to be saved in a folder where the operating system can find it.
[0:01:32] We can download RCC directly from the Robotmk GitHub release page. There are pre-compiled binaries for Linux, macOS, and Windows.
[0:01:42] Here I am on an Ubuntu system, so we download the first of the three files.
[0:01:52] Then we rename it to RCC and move it into a new folder called bin inside our user profile.
[0:02:00] Next, we need to make sure that your system is aware of the bin folder.
[0:02:06] For that, we open a new terminal and open the file .bashrc with an editor. And at the very end we append this line: export PATH="$PATH:$HOME/bin".
[0:02:22] This tells the operating system that when I type rcc on the command line, it should also search in the new bin folder for the binary.
[0:02:30] Windows users must adjust the user variable PATH in the advanced system settings.
[0:02:37] Once bin is in the PATH variable, we can test it. For that, we need to close the current terminal.
[0:02:44] Open a new one and type: "rcc version."
[0:02:51] Ah, permission denied. On Linux, a file must always be made executable first.
[0:02:56] To do this, we switch to the bin folder and use the chmod command: chmod +x rcc
[0:03:05] Now it should work. If you see the version 17.29.1, you're good to go.
[0:03:16] I always recommend organizing Robot Framework projects in folders. Let's start such a new project by creating a new folder, "Supermarket complaints."
[0:03:28] In order for RCC to know how to build the environment, it needs a blueprint.
[0:03:34] This is contained in two YAML files, which you can download as a template from Checkmk’s GitHub account in the Robotmk examples repository.
[0:03:44] Just open each file in a new tab and download them directly into the project folder.
[0:03:51] We will talk about the contents of the files later. I accidentally forgot a conda file here, so let's delete it quickly.
[0:04:11] Now we want to create and activate the environment. To do that, open a new terminal inside the project folder.
[0:04:21] It's very important that we are in exactly the folder where the two YAML files are located, because they are the blueprint for creating and activating the environment.
[0:04:32] And now we type: "rcc task shell." This tells the RCC tool to create the environment according to the specification in the YAML file.
[0:04:44] It also activates the environment for us. On your system this can take up to 2 or 3 minutes; just be patient.
[0:04:53] And by the way, activation means, even though it is not visible, we are now inside of the environment and can use the Python that was installed right here.
[0:05:03] I can quickly prove this by typing: "which python" in Linux.
[0:05:07] The operating system tells me then that it finds Python in the newly created environment.
[0:05:17] Have you ever struggled with setting the right Python interpreter in VS Code? Here's a trick.
[0:05:23] Just run code . and hit enter.
[0:05:35] Now we are in VS Code and can install the RobotCode extension.
[0:05:39] This extension is free and helps enormously with the development of Robot Framework. I can highly recommend it.
[0:05:47] Just open the extension panel on the left and search for RobotCode. Be sure to select the correct one.
[0:05:57] It's not the GherkinParser extension. And lastly, create a new robot file.
[0:06:09] For that, we right-click to create such an empty file. We will fill it with the sections we need right away.
[0:06:17] They are settings, variables, test cases, and keywords.
[0:06:30] When the file on the left displays the robot symbol and the sections are suggested when writing, you know that everything is working correctly.
[0:06:41] Now we are set with an isolated portable environment and VS Code ready for testing.
[0:06:48] If anything didn't work on your end, there is an RCC troubleshooting article linked below or drop a comment here.
[0:06:58] In the next video, we will write Bob's first real Robot Framework test clicking through the form just like a real user.
[0:07:07] See you there!

Interested in learning more? Register for a dedicated Synthetic Monitoring training course.

Check the schedule

More Checkmk Videos