A few months ago we introduced a new member of the UBot Studio team, Adam, who has been programming feverishly ever since he joined. He and I have been working quietly on a big update to UBot Studio that hugely increases what you can do with the software, regardless of the Edition you have. And we’re just a few days away from the release, so I can finally talk about it.

UBot Studio 5.7 will add a treasure trove of power for those who have a UBot Studio subscription.

How do I get the new version?

Like any version, just click the update option when you open your UBot Studio software, or simply login to the homepage and click the subscribe button.

What’s in this big update?

Of course, unit testing won’t work for every situation. In a bot, sometimes we need to perform actions that we don’t want to run over and over every time we want to run our tests. For instance, if your bot creates accounts on some website, you probably don’t want to create a bunch of accounts just for testing purposes. Don’t worry, UBot Studio still has you covered.

The Tao of Flow Testing

Flow testing has a similar purpose to unit testing, but it differs in execution. Flow tests will
occur in the main flow of your script. instead of running them separately, flow tests will run while your bot is running. Let me demonstrate.

In the previous blog post, we discussed UBot Studio’s new logging commands. I’d now like to explain further implications of the new logging commands, especially the power they give you to automatically test your code.

Writing automated tests is a practice used by the best coders in the world. But even if you’re not a coder at all, tests will make your bots able to withstand anything the internet throws at them. Automated testing is one of the single best practices you can do for keeping bots from breaking, especially when those bots are very large. There are two types of automated tests that we will look at: Unit Tests, and Flow Tests.

The Art of Unit Testing

Another important implication of the changes is that it is now very simple to write unit tests. What is a unit test, you ask? Only one of the most important ideas to come from computer science in the last 20 years or so.

A unit test is a short piece of code that has no purpose other than to ensure some other piece of code is working correctly. By putting a robust suite of unit tests into your code, you can always rest assured that your bot will be as stable and bug-free as possible. This is especially useful for those of us who have created large, complex bots. Trying to make a change in complex code can cause a ripple effect, where one change affects some other bit of code down the line, causing headaches every step of the way. But if you have a good test suite in place, you’ll know right away if something is ever out of place, and you can fix it before it becomes a big mess.

It’s a good idea to keep unit tests out of the main script. The best way to do this is to create a separate tab. Set it to invisible if you need to compile.

Let’s look at what unit testing looks like in UBot Studio. Say we have a simple function:

Over the years, the UBot team has watched in awe as the scripts our users created went from small, specific tools, to enormous, complex, multifaceted uBots. As software developers, this left us with an interesting problem: How should large scripts be organized in a way that allows UBotters to keep their sanity? In the latest update to UBot Studio, 5.5.12, we’ve taken a novel approach to begin addressing this question – by turning your scripts into a story.

The human brain is extremely good at managing stories. Our brains are notoriously bad at handling complex mathematical logic and data. So guess which path computer scientists decided to model programming after? The latter, of course.

At UBot Studio, our goal has been to make building applications easier for non-programmers, and also to create smarter ways to understand building programs overall. By introducing a set of smart logging commands, establish, purpose, activity, log, and ui log view, UBot Studio makes building your uBots less like math and more like a good book.