def METHOD_NAME(self, imagename):
    """
    Test script writer.
    """
    # Test that the script is created
    self._window._window.setOptions(test=True, size=[600,600])
    self._widget.OutputPlugin.write.emit(self._repr_script)
    self.assertTrue(os.path.exists(self._repr_script))
    # Inject write command
    with open(self._repr_script, 'a') as fid:
        fid.write('\nwindow.write({})'.format(repr(imagename)))
    # Execute the script
    subprocess.call(['python', self._repr_script], stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT)
    self.assertTrue(os.path.exists(imagename))
    # Diff the image from the script
    differ = mooseutils.ImageDiffer(os.path.join('gold', imagename), imagename)
    print(differ.message())
    self.assertFalse(differ.fail())