예제 #1
0
 /**
  * Méthode permettant de générer le jeu de test.
  *
  * @param sfWebRequest $request
  * @return sfView
  */
 public function executeGenerateTestSet(sfWebRequest $request)
 {
     $this->getResponse()->setContentType('application/json');
     $this->setLayout(false);
     $chronometre1 = new Chronometre();
     $chronometre2 = new Chronometre();
     $chronometre3 = new Chronometre();
     $chronometre4 = new Chronometre();
     $chronometre5 = new Chronometre();
     $keyword = "PERFORMANCE JDT - ";
     // Début mesure.
     $chronometre1->lancerChrono($keyword . "LANCEMENT GENERATION DU JEU DE TEST");
     /** @var EiCampaignExecutionGraphTable $tableExecutionGraph */
     $tableExecutionGraph = Doctrine_Core::getTable("EiCampaignExecutionGraph");
     /** @var EiTestSetTable $tableTestSet */
     $tableTestSet = Doctrine_Core::getTable("EiTestSet");
     // Récupération des éléments relatifs à la campagne (si existe).
     $executionId = $request->getParameter("execution_id");
     $stepId = $request->getParameter("graph_id");
     try {
         $this->getUrlParameters($request);
         // Choix du navigateur.
         $deviceChoice = $request->getParameter("device");
         $testSet = new EiTestSet();
         $testSet->setEiScenarioId($this->ei_scenario->getId());
         $testSet->setEiVersionId($this->ei_version->getId());
         $testSet->setProfileId($this->profile_id);
         $testSet->setProfileRef($this->profile_ref);
         $testSet->setModeByIde($request->getParameter("exec_mode"));
         $testSet->setAuthorId($this->user->getGuardId());
         $testSet->setDevice($deviceChoice == null || !DevicesConst::isValid($deviceChoice) ? DevicesConst::SELENIUM_IDE : $deviceChoice);
         $testSet->setEiIteration($this->getRequestActiveIteration());
         if ($this->ei_data_set instanceof EiDataSet) {
             $testSet->setEiDataSetId($this->ei_data_set->getEiDataSetTemplate()->getEiDataSetRefId());
             // Début mesure.
             $chronometre2->lancerChrono($keyword . "COMPLETION JDD");
             // Complétion du jeu de données.
             $testSet->getEiDataSet()->completeDataSet();
             // Fin mesure
             $chronometre2->arreterEtAfficherChrono();
         }
         $testSet->save();
         $tableTestSet->searchRelatedEiExecutionStackAndTaggedIt($testSet, $this->ei_project);
         $this->getLogger()->info("-----   Jeu de données à créer.");
         //*******************************************************************//
         //**********     AFFECTATION TEST SET ID A LA CAMPAGNE     **********//
         //*******************************************************************//
         if ($executionId != null && $stepId != null && $executionId != 0 && $stepId != 0) {
             /** @var EiCampaignExecutionGraph $executionGraph */
             $executionGraph = $executionId != null ? $tableExecutionGraph->findOneByExecutionIdAndGraphId($executionId, $stepId) : null;
             // On vérifie que l'étape de l'exécution a bien été trouvée et que l'id du scénario correspond à l'ID
             // du scénario du JDT.
             if ($executionGraph != null && $executionGraph->getEiScenario()->getId() == $testSet->getEiScenarioId()) {
                 $executionGraph->setEiTestSetId($testSet->getId());
                 $executionGraph->save();
             }
         }
         // Génération du jeu de données pour le jeu de test.
         // Début mesure.
         $chronometre3->lancerChrono($keyword . "GENERATION JDD");
         $testSet->generateTestSetDataSet();
         // Fin mesure
         $chronometre3->arreterEtAfficherChrono();
         $this->getLogger()->info("-----   Jeu de données créé.");
         $this->getLogger()->info("-----   Paramètres de blocks à créer.");
         // Début mesure.
         $chronometre5->lancerChrono($keyword . "GENERATION PARAMS BLOCK");
         // Fin mesure
         $chronometre5->arreterEtAfficherChrono();
         $this->getLogger()->info("-----   Paramètres de blocks créés.");
         // Fin mesure.
         $chronometre1->arreterEtAfficherChrono();
         $JSONResponse['ei_test_set_id'] = $testSet->getId();
         $JSONResponse['ei_data_set_id'] = $testSet->getEiDataSetId() != "" ? $testSet->getEiDataSetId() : 0;
     } catch (Exception $e) {
         $JSONResponse['error'] = $e->getMessage();
     }
     return $this->renderText(json_encode($JSONResponse));
 }
예제 #2
0
    /**
     * Permet d'afficher la liste des devices et drivers à côté du play
     * @param type $user_id
     */
    public static function displayDevicesList($user_id)
    {
        $driversTab = array();
        $myDevicesId = EiDeviceUserTable::getMyDevicesId($user_id);
        ?>
        <li class="titleChoice titleChoiceDevices">
            <strong>Devices</strong>
            <?php 
        if (count($myDevicesId) > 0) {
            echo ei_icon('ei_add_square', null, 'iconExpand');
        }
        ?>
        </li>
        <?php 
        foreach ($myDevicesId as $myDeviceId) {
            $device_user = Doctrine_Core::getTable('EiDeviceUser')->findOneBy('id', $myDeviceId['id']);
            $device = $device_user->getEiDevice();
            $device_type = $device->getEiDeviceType();
            $device_drivers = $device->getEiDeviceDriver();
            ?>
            <li class="titleChoice titleChoiceBrowsers">
                &nbsp;&nbsp;
                <img src="<?php 
            echo sfConfig::get($device_type['logo_path']);
            ?>
" width="20" height="20" />&nbsp;
                <strong><?php 
            echo $device_user['name'];
            ?>
</strong>
                <?php 
            if (count($device_drivers) > 0) {
                echo ei_icon('ei_add_square', null, 'iconExpand');
            }
            ?>
            </li>
            <?php 
            foreach ($device_drivers as $device_driver) {
                $driver = $device_driver->getEiDriverType();
                $driverBrowsers = $device_driver->getEiDriverBrowser();
                foreach ($driverBrowsers as $driverBrowser) {
                    $browser = $driverBrowser->getEiBrowserType();
                    ?>
                <li class="choice">
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="checkbox" name="webdriversChoice[]" value="<?php 
                    echo $device['id'];
                    ?>
/<?php 
                    echo $driver['id'];
                    ?>
/<?php 
                    echo $browser['id'];
                    ?>
" id="<?php 
                    echo $device['id'];
                    ?>
/<?php 
                    echo $driver['id'];
                    ?>
/<?php 
                    echo $browser['id'];
                    ?>
" class="hide" />&nbsp;
                    <?php 
                    if ($driver['hidden_name'] == 'selenium_ide') {
                        ?>
                        <label for="<?php 
                        echo $device['id'];
                        ?>
/<?php 
                        echo $driver['id'];
                        ?>
/<?php 
                        echo $browser['id'];
                        ?>
"><?php 
                        echo $driver['name'];
                        ?>
</label>
                        <img class="driverBrowserLogo" src="<?php 
                        echo sfConfig::get($driver['logo_path']);
                        ?>
" width="24" height="24" />&nbsp;
                        <?php 
                    } else {
                        ?>
                        <label for="<?php 
                        echo $device['id'];
                        ?>
/<?php 
                        echo $driver['id'];
                        ?>
/<?php 
                        echo $browser['id'];
                        ?>
"><?php 
                        echo $browser['name'];
                        ?>
</label>
                        <img class="driverBrowserLogo" src="<?php 
                        echo sfConfig::get($browser['logo_path']);
                        ?>
" width="24" height="24" />&nbsp;
                        <?php 
                    }
                    ?>
                </li>
                <?php 
                    $driverRow = array($driver['id'], $browser['id']);
                    if (!in_array($driverRow, $driversTab)) {
                        $driversTab[] = $driverRow;
                    }
                }
            }
        }
        ?>
        <li class="titleChoice titleChoiceDrivers">
            <strong>Browsers</strong>
            <?php 
        if (count($driversTab) > 0) {
            echo ei_icon('ei_add_square', null, 'iconExpand');
        }
        ?>
        </li>
        <?php 
        foreach ($driversTab as $driverRow) {
            $driver = Doctrine_Core::getTable('EiDriverType')->findOneBy('id', $driverRow[0]);
            $browser = Doctrine_Core::getTable('EiBrowserType')->findOneBy('id', $driverRow[1]);
            ?>
                <li class="choice">
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="checkbox" name="webdriversChoice[]" value="null/<?php 
            echo $driver['id'];
            ?>
/<?php 
            echo $browser['id'];
            ?>
" id="null/<?php 
            echo $driver['id'];
            ?>
/<?php 
            echo $browser['id'];
            ?>
" class="hide" />&nbsp;
                    <?php 
            if ($driver['hidden_name'] == 'selenium_ide') {
                ?>
                        <label for="null/<?php 
                echo $driver['id'];
                ?>
/<?php 
                echo $browser['id'];
                ?>
"><?php 
                echo $driver['name'];
                ?>
</label>
                        <img class="driverBrowserLogo" src="<?php 
                echo sfConfig::get($driver['logo_path']);
                ?>
" width="24" height="24" />&nbsp;
                        <?php 
            } else {
                ?>
                        <label for="null/<?php 
                echo $driver['id'];
                ?>
/<?php 
                echo $browser['id'];
                ?>
"><?php 
                echo $browser['name'];
                ?>
</label>
                        <img class="driverBrowserLogo" src="<?php 
                echo sfConfig::get($browser['logo_path']);
                ?>
" width="24" height="24" />&nbsp;
                        <?php 
            }
            ?>
                </li>
            <?php 
        }
        ?>
        <li id="selLi" class="choice">
            <input type="checkbox" name="webdriversChoice[]" value="<?php 
        echo DevicesConst::SELENIUM_IDE;
        ?>
" id="<?php 
        echo DevicesConst::SELENIUM_IDE;
        ?>
" class="hide">&nbsp;
            <label for="<?php 
        echo DevicesConst::SELENIUM_IDE;
        ?>
">Local <?php 
        echo DevicesConst::getTitle(DevicesConst::SELENIUM_IDE);
        ?>
</label>
            <img class="driverBrowserLogo" src="<?php 
        echo DevicesConst::getImgPath(DevicesConst::SELENIUM_IDE);
        ?>
" class="btnSwitchDevice" for="<?php 
        echo DevicesConst::SELENIUM_IDE;
        ?>
" width="24" height="24">
        </li>
        <?php 
    }