https://www.spryker.com logo
Join Slack
Powered by
# testing
  • f

    fresh-belgium-62598

    02/24/2023, 12:25 PM
    set the channel description: This channel is all about testing (e.g. using Codecept)
  • f

    fresh-belgium-62598

    02/24/2023, 12:30 PM
    Regarding b2c-demo-marketplace I did the following steps initially:
    Copy code
    git clone <https://github.com/spryker-shop/b2c-demo-marketplace.git> ./
    git clone git@github.com:spryker/docker-sdk.git docker
    docker/sdk boot deploy.dev.yml
    docker/sdk console cache:class-resolver:build
    docker/sdk up
    āœ… 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:33 PM
    Then I run a specific category of tests:
    Copy code
    docker/sdk cli -t -x
    codecept run -c codeception.acceptance.yml
    The result is: ERRORS! Tests: 42, Assertions: 22, Errors: 7, Failures: 7, Skipped: 4.
    Copy code
    docker/sdk cli -t -x
    codecept run -c codeception.functional.yml
    The result is: OK, but incomplete, skipped, or useless tests! Tests: 154, Assertions: 298, Skipped: 16.
    Copy code
    docker/sdk cli -t -x
    codecept run -c codeception.api.yml
    The result is: No tests executed! So this is an uncomfortable sitation for a developer to start with (broken tests). Is there any trick I am missing? Otherwise I hereby ask kindly the core developers to fix their tests...
    šŸ‘€ 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:38 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Yves/Availability
    This one is broken: [ConnectionException] Can't connect to WebDriver at http://0.0.0.0:4444/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running.
    šŸ‘€ 1
    s
    • 2
    • 9
  • f

    fresh-belgium-62598

    02/24/2023, 12:41 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Yves/Customer
    I am getting these errors multiple times: [ConnectionException] Can't connect to WebDriver at http://0.0.0.0:4444/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running.
    šŸ‘€ 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:43 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Yves/Newsletter
    I am getting these errors multiple times: [ConnectionException] Can't connect to WebDriver at http://0.0.0.0:4444/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running.
    šŸ‘€ 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:45 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Zed/Availability
    This one is broken: Suite '' could not be found
    šŸ‘€ 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:45 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Zed/CmsGui
    I am getting these errors multiple times: [ConnectionException] Can't connect to WebDriver at http://0.0.0.0:4444/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running.
    šŸ‘€ 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:47 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Zed/NavigationGui
    This is the error: PHP Fatal error: Uncaught Error: Call to a member function closeConnections() on null in /data/vendor/propel/propel/src/Propel/Runtime/Propel.php:240 Stack trace: #0 /data/vendor/spryker/propel/tests/SprykerTest/Shared/Propel/_support/Helper/ConnectionHelper.php(55): Propel\Runtime\Propel::closeConnections() #1 /data/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php(80): SprykerTest\Shared\Propel\Helper\ConnectionHelper->_after(Object(Codeception\Test\Cest)) #2 /data/vendor/symfony/event-dispatcher/EventDispatcher.php(230): Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #3 /data/vendor/symfony/event-dispatcher/EventDispatcher.php(59): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'test.after', Object(Codeception\Event\TestEvent)) #4 /data/vendor/codeception/codeception/src/Codeception/Test/Test.php(284): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Codeception\Event\TestEvent), 'test.after') #5 /data/vendor/codeception/codeception/src/Codeception/Test/Test.php(230): Codeception\Test\Test->fire('test.after', Object(Codeception\Event\TestEvent)) #6 /data/vendor/codeception/codeception/src/Codeception/Suite.php(130): Codeception\Test\Test->realRun(Object(Codeception\ResultAggregator)) #7 /data/vendor/codeception/codeception/src/Codeception/SuiteManager.php(148): Codeception\Suite->run(Object(Codeception\ResultAggregator)) #8 /data/vendor/codeception/codeception/src/Codeception/Codecept.php(260): Codeception\SuiteManager->run(Object(Codeception\ResultAggregator)) #9 /data/vendor/codeception/codeception/src/Codeception/Codecept.php(216): Codeception\Codecept->runSuite(Array, 'Presentation', NULL) #10 /data/vendor/codeception/codeception/src/Codeception/Command/Run.php(646): Codeception\Codecept->run('Presentation')#11 /data/vendor/codeception/codeception/src/Codeception/Command/Run.php(467): Codeception\Command\Run->runSuites(Array, Array) #12 /data/vendor/symfony/console/Command/Command.php(298): Codeception\Command\Run->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /data/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 /data/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Codeception\Command\Run), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 /data/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 /data/vendor/codeception/codeception/src/Codeception/Application.php(112): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 /data/vendor/codeception/codeception/app.php(45): Codeception\Application->run() #18 /data/vendor/codeception/codeception/app.php(46): {closure}() #19 /data/vendor/codeception/codeception/codecept(7): require('/data/vendor/co...') #20 /data/vendor/bin/codecept(120): include('/data/vendor/co...') #21 {main} thrown in /data/vendor/propel/propel/src/Propel/Runtime/Propel.php on line 240
    šŸ‘€ 1
    s
    • 2
    • 4
  • f

    fresh-belgium-62598

    02/24/2023, 12:48 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Zed/ProductRelation
    This one is broken: [ConnectionException] Can't connect to WebDriver at http://0.0.0.0:4444/wd/hub. Make sure that ChromeDriver, GeckoDriver or Selenium Server is running.
    šŸ‘€ 1
  • f

    fresh-belgium-62598

    02/24/2023, 12:50 PM
    Then I run one specific module test:
    Copy code
    docker/sdk cli -t -x
    codecept run -c tests/PyzTest/Zed/Tax
    This is the error: PHP Fatal error: Uncaught Error: Call to a member function closeConnections() on null in /data/vendor/propel/propel/src/Propel/Runtime/Propel.php:240 Stack trace: #0 /data/vendor/spryker/propel/tests/SprykerTest/Shared/Propel/_support/Helper/ConnectionHelper.php(55): Propel\Runtime\Propel::closeConnections() #1 /data/vendor/codeception/codeception/src/Codeception/Subscriber/Module.php(80): SprykerTest\Shared\Propel\Helper\ConnectionHelper->_after(Object(Codeception\Test\Cest)) #2 /data/vendor/symfony/event-dispatcher/EventDispatcher.php(230): Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #3 /data/vendor/symfony/event-dispatcher/EventDispatcher.php(59): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'test.after', Object(Codeception\Event\TestEvent)) #4 /data/vendor/codeception/codeception/src/Codeception/Test/Test.php(284): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Codeception\Event\TestEvent), 'test.after') #5 /data/vendor/codeception/codeception/src/Codeception/Test/Test.php(230): Codeception\Test\Test->fire('test.after', Object(Codeception\Event\TestEvent)) #6 /data/vendor/codeception/codeception/src/Codeception/Suite.php(130): Codeception\Test\Test->realRun(Object(Codeception\ResultAggregator)) #7 /data/vendor/codeception/codeception/src/Codeception/SuiteManager.php(148): Codeception\Suite->run(Object(Codeception\ResultAggregator)) #8 /data/vendor/codeception/codeception/src/Codeception/Codecept.php(260): Codeception\SuiteManager->run(Object(Codeception\ResultAggregator)) #9 /data/vendor/codeception/codeception/src/Codeception/Codecept.php(216): Codeception\Codecept->runSuite(Array, 'Presentation', NULL) #10 /data/vendor/codeception/codeception/src/Codeception/Command/Run.php(646): Codeception\Codecept->run('Presentation') #11 /data/vendor/codeception/codeception/src/Codeception/Command/Run.php(467): Codeception\Command\Run->runSuites(Array, Array) #12 /data/vendor/symfony/console/Command/Command.php(298): Codeception\Command\Run->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 /data/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 /data/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Codeception\Command\Run), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 /data/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 /data/vendor/codeception/codeception/src/Codeception/Application.php(112): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 /data/vendor/codeception/codeception/app.php(45): Codeception\Application->run() #18 /data/vendor/codeception/codeception/app.php(46): {closure}() #19 /data/vendor/codeception/codeception/codecept(7): require('/data/vendor/co...') #20 /data/vendor/bin/codecept(120): include('/data/vendor/co...') #21 {main} thrown in /data/vendor/propel/propel/src/Propel/Runtime/Propel.php on line 240
    šŸ‘€ 1
  • h

    hallowed-dentist-19902

    03/09/2023, 3:08 PM
    @fresh-belgium-62598 as a matter of interest, try this instead inside the cli, I am able to run tests that are written as groups inside the annotation, otherwise if I try to run it as -c tests/PyzTest/Zed/Tax as in your example I get the same error. I don't know why this happens, I'll do abit of digging. But your work around is using the below:
    Copy code
    ╭─/data | Store: DE | Env: docker.dev | Debug: (X) | Testing: (X)
    ╰─$ codecept run -g MyModuleFacadeTest
    šŸ‘ 1
    āœ… 1
    f
    • 2
    • 3
  • h

    hallowed-dentist-19902

    03/09/2023, 3:12 PM
    Copy code
    /**
     * Auto-generated group annotations
     *
     * @group PyzTest
     * @group Zed
     * @group CustomFields
     * @group Business
     * @group Facade
     * @group MyModuleFacadeTest
    āœ… 1
  • h

    hallowed-dentist-19902

    03/09/2023, 3:12 PM
    I add to that annotation ^^
  • h

    hallowed-dentist-19902

    03/09/2023, 4:11 PM
    For anyone else, I think the error happens when the getDatabaseMap() function tries to get the mapper from the service container, so to write the tests and avoid the problem if you run
    Copy code
    codecept run -c vendor/spryker/wishlist/tests/SprykerTest/Zed/Wishlist
    It works, but only because of some configuration difference, putting Wishlist into PyzTest namespace and then re-configuring it creates issues too.
  • h

    hallowed-dentist-19902

    03/16/2023, 1:16 PM
    A neat part about the testing framework is Spryker have created helpers
    Copy code
    - \SprykerTest\Shared\Customer\Helper\CustomerDataHelper
    Lets you use
    have customer
    which creates a customer for you to test, then cleans it up for you rather than having to invoke the SpyCustomer facade or model yourself.
    Copy code
    public function haveCustomer(array $override = []): \Generated\Shared\Transfer\CustomerTransfer {
            return $this->getScenario()->runStep(new \Codeception\Step\Action('haveCustomer', func_get_args()));
        }
    Example:
    vendor/spryker/wishlist/tests/SprykerTest/Zed/Wishlist/Business/WishlistFacadeTest.php
    Copy code
    $this->customer = $this->tester->haveCustomer();
    šŸ™Œ 1
  • a

    ancient-arm-53696

    04/14/2023, 8:33 AM
    Hi all. Can someone please clarify how database access works within testing? The data does not really get persisted to the database, at least not in my setup. For example the Discount tests like
    vendor/spryker/discount/tests/SprykerTest/Zed/Discount/Business/DiscountFacadeCalculateTest.php
    . I am asking this, because I try to persist discounts to the database like that, but actually test the
    CalculationFacade
    . There is a point where the Discount Model
    vendor/spryker/discount/src/Spryker/Zed/Discount/Business/Calculator/Discount.php
    reads active discounts from the database, but the previously inserted discounts can not be found. Also I can not find the previously inserted discounts in the database, I must be looking at the wrong place. What am I missing?
    • 1
    • 3
  • a

    aloof-doctor-18410

    07/20/2023, 3:03 PM
    archived the channel