Table of contents

Before writing real tests, it might be helpful to add some helper files to provide test data and upload your plugin. You must not understand all elements of the files at this point, simply copy/paste them into your plugin and customize them.

Upload your plugin 

First of all you might want to upload your plugin. Therefore you can use helper methods from the CPB. The UniversalPluginManager page object provides everything you need. Simple change the pluginPath and the pluginName.


Prepare Test Data 

After your plugin is installed you might want to add som test data to your instance.

Shared page objects

This might be users, spaces or pages as well as plugin specific data. It is best practice to encapsulate these data in a sharedPageObjects.js file, where they can be accessed in every test.


(warning) Note that this file does not really create these objects (e.g. Confluence spaces), but holds the data to do so.

Create test data

For the real creation there's a second file: prepareTestSetup.spec.js


(warning) If something fails while preparation, the tests will stop immediately. This is why we recommend not to something worth testing in this file.

Clean up Your Instance 

After running all tests, you might want your instance to be clean again. Therefore you can implement all cleanup tasks in this file and run it after all.

(warning)  As specs (as well as unit tests) should not have any dependencies on each other, every spec should cleanup its own data. This is why the cleanupTestSetup.spec.js should only remove the data produced in the prepareTestSetup.spec.js.


Take away

Four common files can be used to setup your instance and prepare an data structure to write useful tests (not all files are required).


< Part 2: Infrastructure | Part 4: Test Files >

  • No labels

This content was last updated on 02/19/2018.

This content hasn't been updated in a while. That doesn't have to be a problem. Some of our pages live for years without becoming obsolete.

Old content can be incorrect, misleading or outdated. Please get in contact with us via a form on this page, our live chat or via email with if you are in doubt, have a question, suggestion, or want changes from us.