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

expressive

#1

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.


#2

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


#3

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.


#4

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


#5

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

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


#6

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


#7

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.


#8

I’m using codecption in a project.