allure-phpunit icon indicating copy to clipboard operation
allure-phpunit copied to clipboard

@Step annotation is not available

Open ostrovanka opened this issue 9 years ago • 2 comments

Hi! Just wanted to know if you are planning to implement @Step annotation functionality like in java for phpunit adapter? Existing mechanism of markings step in phpunit is very inconvenient.

Please, tell me if you planning to update this any time soon?

Thank you!

ostrovanka avatar Aug 05 '16 06:08 ostrovanka

I don't know if it's of any help, but I found a workaround to manage test steps in my test cases. The setup file contains this:

    use StepSupport;

    public $stepCounter = 0;
    /**
     * @param $command
     * 'The selenium command to be used'
     * @param $title
     * 'The name or title of the step (will be displayed in the report')
     */
    public function executeTestStep($command, $title) {
        $stepCounter = $this->stepCounter;
        $stepCounter++;
        $this->stepCounter = $stepCounter;
        $step = $command;
        $stepName = "step".$stepCounter;
        if(is_array($step)){
            foreach($step as $stepValue){
                $stepTitle = $title;
                $this->executeStep($stepName,$stepValue, $stepTitle);
            }
        }
        else{
            $stepTitle = $title;
            $this->executeStep($stepName,$step, $stepTitle);
        }

    }

And the actual test steps look something like:

        $step = $this->click("link=Add a Client");
        $stepTitle = "After the page loads, click on the 'Add a Client' button";
        $this->executeTestStep($step,$stepTitle);

        $step = $this->waitForPageToLoad("30000");
        $stepTitle = "Wait for the page to load";
        $this->executeTestStep($step,$stepTitle);

At the end, the generated report converts nicely to an allure HTML report with steps.

cryptton2004 avatar Aug 17 '16 11:08 cryptton2004

@cryptton2004 Thank you for your code. I've used it in my project - it really looks nice in allure reports, but the code itself unfortunately looks not so nice :( But I guess it's the situation where you have to choose - pretty code or pretty report :)

ostrovanka avatar Aug 19 '16 10:08 ostrovanka