1

I looked into manual here: http://codeception.com/docs/07-AdvancedUsage and there is ability to set @depens annotation for method.

class InvoiceStatusCest
{
    public function testOne()
    {

    }

    /**
     * @depends testOne
     */
    public function testTwo()
    {
    }

}

But for my surprise my testTwo() always skips, even if testOne() if empty or passed...

i see in console

Running InvoiceStatusCest.testOne - Ok
 - Skipped
Dmitriy Apollonin
  • 1,418
  • 2
  • 16
  • 30

3 Answers3

3

I had issues with making a test depend on another test in another Cest. Using the just name of the test from the other Cest in the @depends annotation worked for me:

class InvoiceCest
{
    public function testCreate()
    {

    }
}

class InvoiceStatusCest
{
   /**
     * @depends testCreate
     */
    public function testChangeInvoiceStatus()
    {

    }
}
adeyemi
  • 123
  • 1
  • 7
2

In your version of codeception dependencies are not handles very well, but you can accomplish what you want using this annotation instead:

class InvoiceStatusCest
{
    public function testOne()
    {

    }

    /**
     * @depends Codeception\TestCase\Cest::testOne
     */
    public function testTwo()
    {
    }

}
repsah
  • 21
  • 5
2

Codeception has some seriously finicking annotation

For instance this

/*
 * @depends testOne
 */

will NOT work but this

/**
 * @depends testOne
 */

will work

NOTE the single * versus the ** at the beginning.

Just spent 4 hours of my life discovering this...

bagnap
  • 511
  • 7
  • 17
  • 2
    /* comment */ vs. /** PHPDoc block comment */ The double asterisk denotes a PHPDoc comment, which is required. – Kevin G. May 11 '15 at 15:14