What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi Team Please give reference for test cases for Communication, Presentation and Persistence Layer.

U03TXRYL7U7
U03TXRYL7U7 Posts: 64 🧑🏻‍🚀 - Cadet

Hi Team
Please give reference for test cases for Communication, Presentation and Persistence Layer.
I am trying to create test cases taking reference from customer module.
Like this
<?php

/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace PyzTest\Zed\SeoTemplates\Communication\Controller;

use Codeception\Test\Unit;
use SeoTemplatesCommunicationTester;

/**
* Auto-generated group annotations
*
* @group PyzTest
* @group Zed
* @group Customer
* @group Communication
* @group Controller
* @group SeoTemplatesIndexTest
*
*/
class SeoTemplatesIndexTest extends Unit
{
protected const TEMPLATES_PAGE = '/seo-templates';
/**
* @param SeoTemplatesCommunicationTester $test
*
* @return void
*/
public function testBreadCrumbIsVisible(SeoTemplatesCommunicationTester $test): void
{
$test->amOnPage(static::TEMPLATES_PAGE);

    `$test->seeBreadcrumbNavigation('Merchandising / SEO Templates');`
`}`

}

But I am getting following error:
[ArgumentCountError] Too few arguments to function PyzTest\Zed\SeoTemplates\Communication\Controller\SeoTemplatesIndexTest::testBreadCrumbIsVisible(), 0 passed in /data/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1527 and exactly 1 expected

Please give reference for test cases from where I can take help for same.

Comments

  • michael.schmetter
    michael.schmetter Posts: 119 🧑🏻‍🚀 - Cadet

    Can you share your corresponding codeception.yml?

  • U03TXRYL7U7
    U03TXRYL7U7 Posts: 64 🧑🏻‍🚀 - Cadet

    Now I have made some changes while doing R&D.
    I have checked that for Controller files testcases file is ending with Cest.php.

    Can you please explain me what is the significance of file ending with Cest.php. In my experience in other frameworks, classes ending with test.php are used.

    <?php

    /**
    * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
    * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
    */

    namespace PyzTest\Zed\SeoTemplates\Communication\Controller;

    use Codeception\Test\Unit;
    use PyzTest\Zed\SeoTemplates\PageObject\SeoTemplatesIndexPage;
    use PyzTest\Zed\SeoTemplates\SeoTemplatesCommunicationTester;

    /**
    * Auto-generated group annotations
    *
    * @group PyzTest
    * @group Zed
    * @group Customer
    * @group Communication
    * @group Controller
    * @group SeoTemplatesIndexTest
    *
    */
    class SeoTemplatesIndexTestCest
    {
    protected const TEMPLATES_PAGE = '/seo-templates';

    `/**`
     `* @param SeoTemplatesCommunicationTester $test`
     `*`
     `* @return void`
     `*/`
    `public function testBreadCrumbIsVisible(SeoTemplatesCommunicationTester $test): void`
    `{`
        `$test->amOnPage(SeoTemplatesIndexPage::URL);`
    
        `$test->seeBreadcrumbNavigation('Merchandising / SEO Templates');`
    `}`
    

    }

    and following is the codeception.yml file:

    namespace: PyzTest\Zed\SeoTemplates
    paths:
    tests: .
    data: _data
    support: _support
    log: _output

    coverage:
    enabled: true
    remote: false
    whitelist: { include: ['../../../../src/*'] }

    suites:
    Communication:
    path: Communication
    class_name: SeoTemplatesCommunicationTester
    modules:
    enabled:
    - Asserts
    - \SprykerTest\Shared\Testify\Helper\Environment
    - \SprykerTest\Shared\Testify\Helper\ConfigHelper
    - \SprykerTest\Shared\Testify\Helper\LocatorHelper
    - \SprykerTest\Shared\Testify\Helper\DependencyHelper
    - \SprykerTest\Shared\Testify\Helper\DataCleanupHelper
    - \SprykerTest\Shared\Propel\Helper\TransactionHelper
    - \SprykerTest\Zed\ZedNavigation\Helper\BreadcrumbHelper
    - \SprykerTest\Shared\Application\Helper\ZedHelper
    - \SprykerTest\Zed\Testify\Helper\Business\BusinessHelper
    - \SprykerTest\Zed\Testify\Helper\Business\DependencyProviderHelper
    - \SprykerTest\Zed\Testify\Helper\Communication\DependencyProviderHelper
    - \SprykerTest\Zed\Testify\Helper\Communication\CommunicationHelper
    - \SprykerTest\Zed\Testify\Helper\Communication\Table\TableHelper
    - \SprykerTest\Service\Container\Helper\ContainerHelper
    - \SprykerTest\Zed\Validator\Helper\ValidatorHelper
    - \SprykerTest\Zed\Form\Helper\FormHelper:
    formPlugins:
    - \Spryker\Zed\Validator\Communication\Plugin\Form\ValidatorFormPlugin
    - \Spryker\Zed\Http\Communication\Plugin\Form\HttpFoundationFormPlugin
    - \SprykerTest\Zed\EventDispatcher\Helper\EventDispatcherHelper
    - \SprykerTest\Zed\Twig\Helper\TwigHelper:
    twigPlugins:
    - \Spryker\Zed\Translator\Communication\Plugin\Twig\TranslatorTwigPlugin
    - \Spryker\Zed\ZedNavigation\Communication\Plugin\Twig\ZedNavigationTwigPlugin
    - \SprykerTest\Zed\Gui\Helper\GuiTwigPluginHelper
    - \SprykerTest\Zed\Router\Helper\RouterHelper
    - \SprykerTest\Zed\Application\Helper\ApplicationHelper
    - \SprykerTest\Shared\Customer\Helper\CustomerDataHelper
    - \SprykerTest\Shared\Testify\Helper\DataCleanupHelper

  • U03TXRYL7U7
    U03TXRYL7U7 Posts: 64 🧑🏻‍🚀 - Cadet

    Now I am facing this issue:

  • U03TXRYL7U7
    U03TXRYL7U7 Posts: 64 🧑🏻‍🚀 - Cadet

    Can you please give reference from where I can take help in writing test cases.