@Override
    public void run() {
        BmTestManager bmTestManager = BmTestManager.getInstance();
        FileServer fileServer = FileServer.getFileServer();
        String projectPath = null;
        if (fileServer.getScriptName() != null) {
            projectPath = fileServer.getBaseDir() + "/" + fileServer.getScriptName();
        } else if (!JMeter.isNonGUI()) {
            projectPath = GuiPackage.getInstance().getTestPlanFile();
        }
        try {
            String filename = new File(projectPath).getName();
            BlazemeterApi.getInstance().uploadJmx(bmTestManager.getUserKey(), bmTestManager.getTestInfo().getId(), filename, projectPath);
        } catch (NullPointerException npe) {
            BmLog.error("JMX was not uploaded to server: test-plan is needed to be saved first ");
        } catch (Exception ex) {
            BmLog.error(ex);

        }
    }