Formatting Execution Times with TextSoap

As noted, I have a couple of tests that use the TimeDuration library to time how long certain actions take. For example, the time it takes to Save a large number of items. After running a whole series of test suites, I had a lot of information in the log files. As an experiment, I searched through all the logs and pulled out the “Execution Time:” marker. This gave me multiple instances of how long it took to save that large chunk of data.

I then decided to try out TextSoap to see what sort of formatting I could apply to this text. Could I make some sort of report that showed the really long save times and the longer than average save times?

Simply put, you absolutely can.

Using a bit of RegEx and then applying some formatting, I can call out the really long test that took 3 minutes. Clearly something went totally wrong there.

.*minutes.*

I can then highlight the times that took over 20 seconds.

.*\b[2-9][0-9]\b.*

I can then highlight the times between 10 and 19 seconds as pretty close to problematic.

.*\b[1][0-9]\b.*

In conjunction with these, I can apply text formatting to make a pretty cool little report. From the screenshot, the Minutes time gets red text and gets converted to uppercase.

The 20+ second condition also gets the same treatment.

For 10-19 seconds, get formatted in orange, but no change of case.

So in short order, I was able to use grep to find the Execution Time text and save that to a file. Then TextSoap applies a set of conditional filters and I have a pretty useful report of my automation testing. Now that the “cleaner” is built, this process takes less than 30 seconds to complete.

This could be done several ways and with several different tools. But it seemed like a fun exercise for TextSoap and a way to try out it’s features. And it totally worked.

By the way, my RegEx skills are nigh non-existent. I used regex101.com and comments from Stackoverflow to put these together.

Thanks for reading you majestic sausage.

Author Signature for Posts

0