Does anyone have a good test component for integration test in expressive?

Expressive have not a integration test component like as zend-test.

So I wrote this component zfegg/expressive-test.

Usage:

     public function testHome() {
        // $response = $this->runApp('GET', '/');  //  Test "GET /"
        $response = $this->runApp(
            'POST',
            '/?test=1',
            ['body' => '2'],
            ['HTTP_CONTENT_TYPE' => 'application/json'],
            '{"a":"b"}',
            ['cookie' => '3']
        );

        $this->assertEqual(200, $response->getStatusCode()));
    }

I do not know how about my component.

May be you have a better test components or tools.

So I want to know how do you integration test to your expressive project.

That can help me refactor. Or may be can change me to use another components or tools.

I’d suggest e2e testing it, rather than integration-testing it.

About e2e, it is hard to mock some api and objects.

e.g.:

  • oauth2/callback.
  • Authenticated session/token.

How do you solve this.

PHPUnit can create mock object for ignore authentication.

In an e2e scenario, you do not mock anything at all. That’s why it is called end-to-end.

So that how to testing oauth2 callback API? when the provider have a captcha.

What you said e2e tools ? Is it postman, jmeter etc.?

Anything that can fire an HTTP request and can be run in automation.

I usually run a selenium+behat setup that is completely unaware of the application implementation (separate autoloader, almost separate project, certainly separate/independent Docker container).

1 Like

Thanks for reply.

I get a good information. selenium + behat and docker.

I don’t known what’s selenium. May be I need some time to learn it.

I’m using codecption in a project.