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..

hello, do you know if any good documentation about glue api testing exists?

USZB5JN4W
USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

hello, do you know if any good documentation about glue api testing exists?

Comments

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    @valerii.trots could you please help in the functional/e2e testing? πŸ™‚ I’m trying to test properly glue api, but there is not much (or I can’t find) documentation in this topic

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited October 2021

    Sorry, I'm not aware if such documentation exists but I do know who could know or could help maybe. Let's check if they got notified: @UQKSAARKN and @U017BL99B1V? πŸ™‚

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    thank you πŸ™‚

  • Unfortunately, there are no docs

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    @U017BL99B1V could you please in that case send some examples, or tell how to start with it? πŸ™‚

  • U01A5ARAXP0
    U01A5ARAXP0 Posts: 119 πŸ§‘πŸ»β€πŸš€ - Cadet

    We test use just by using post/get requests. Here is an example:

    /**
         * @param \PyzTest\Glue\ModuleNameRestApi\ModuleNameRestApiTester $i
         *
         * @return void
         */
        public function testPostActionModuleNameRestApiTester $i): void
        {
            $i->sendPOST(
                '/' . ModuleNameRestApiConfig::RESOURCE_NAME,
                $this->getRequestData()
            );
    
            $i->seeResponseCodeIs(Response::HTTP_OK);
        }
    
        /**
         * @return array[]
         */
        private function getRequestData(): array
        {
            return [
                'data' => [
                    'type' => ModuleNameRestApiConfig::RESOURCE_PING,
                    'attributes' => [],
                ],
            ];
        }
    
  • U01A5ARAXP0
    U01A5ARAXP0 Posts: 119 πŸ§‘πŸ»β€πŸš€ - Cadet

    And we use seeResponseMatchesJsonType for more assertions

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    thank you

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    could you please also show yml configuration?

  • U01A5ARAXP0
    U01A5ARAXP0 Posts: 119 πŸ§‘πŸ»β€πŸš€ - Cadet
    modules:
          enabled:
            - REST:
                depends: PhpBrowser
                part: Json
    
    config:
            PhpBrowser:
              url: '%SPRYKER_GLUE_DOMAIN%'
              headers:
                Accept: application/json
                Content-Type: application/vnd.api+json
    
  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    hmm SPRYKER_GLUE_DOMAIN is standard url, same as for current env, or sth different?

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    ah ok, it works!

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    thank you @U01A5ARAXP0

  • @USZB5JN4W Also, take a look on useful helpers
    \SprykerTest\Glue\AuthRestApi\Helper\AuthRestApiHelper
    \SprykerTest\Glue\Testify\Helper\GlueRest

  • USZB5JN4W
    USZB5JN4W Posts: 112 πŸ§‘πŸ»β€πŸš€ - Cadet

    thanks πŸ™‚