2 min read

Siesta: Speeding up tests launched inside your IDE

At Bryntum we strongly believe in running our tests frequently. Doing so allows us to rapidly develop and debug tests […]

We strive to keep posts updated, but code samples may sometimes be outdated. Humans, see the Bryntum documentation; agents, https://mcp.bryntum.com for the latest info.

At Bryntum we strongly believe in running our tests frequently. Doing so allows us to rapidly develop and debug tests without involving a real browser. As mentioned in previous posts, we use the awesome PhantomJS for this since it is really really fast. Since we don’t care at all about the Siesta UI for tests launched from the command line, we can use a simpler version of the HTML harness file. The default harness usually looks like below:

<!DOCTYPE HTML> 
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" >
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">

        <link rel="stylesheet" type="text/css" href="../../extjs-4.1.1/resources/css/ext-all.css">
        <link rel="stylesheet" type="text/css" href="node_modules/siesta/resources/css/siesta-all.css">

        <script type="text/javascript" src="../../extjs-4.1.1/ext-all.js"></script>

        <script type="text/javascript" src="node_modules/siesta/siesta-all.js"></script>
        <script type="text/javascript" src="lib/Bryntum/Test.js"></script>

        <script type="text/javascript" src="index.js"></script>
    </head>

    <body>
    </body>
</html>

As you can see, it is loading the full Ext JS library which includes a 240 KB CSS file and a 1.3 MB JS file. This slows down the test start and consumes unnecessary memory. For our in-IDE testing we instead use this ‘index-no-ui.html‘ HTML harness file:

<!DOCTYPE HTML> 
<html>
    <head>
        <script type="text/javascript" src="node_modules/siesta/siesta-all.js"></script>
        <script type="text/javascript" src="lib/Bryntum/Test.js"></script>

        <script type="text/javascript" src="index.js"></script>
    </head>

    <body></body>
</html>

This is the absolute minimum for us to be able to run a test on the command line. Hopefully you can use the same trick to save a second or too each time you want to run a single test in your IDE. This trick is applicable any time you are running automated tests that should not involve the Siesta UI.

Happy testing!

Mats Bryntse

Mats Bryntse is the founder and CEO of Bryntum, where he leads the team building advanced scheduling and project planning components for the web. He has spent the past 15 years focused on component performance, developer experience, and making complex user interfaces feel simple. Bryntum's components cover Gantt charts, data grids, calendars, schedulers, and Kanban boards, and Mats works across all of them, from API design to the details of rendering large data sets in the browser. Away from work he plays chess and badminton.

Uncategorized

Try Bryntum components

Fast, framework-agnostic UI components for scheduling and project management.

Start a free trial

Related posts