-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First integration tests for provisioning api #18105
Conversation
nice 👍 |
@MorrisJobke please have a look since you did use behat already as well - THX |
@cmonteroluque @rperezb just FYI - this is what I was talking about in the past regarding integration testing of the OCS API |
*/ | ||
public function userExists($user) { | ||
throw new \Behat\Behat\Exception\PendingException(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation looks off compared with above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mimimi ... 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides me doing mimimimimi, this is cool 🚀 |
private $baseUrl = ''; | ||
|
||
/** @var ResponseInterface */ | ||
private $response = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indention :hides:
@Raydiation are you by chance aware of a way to collect coverage data of php dev server? |
@DeepDiver1975 what I've found: Behat/Behat#92 |
TL;DR: Not needed for integration tests. 100% code coverage is only usable for unit tests because it would take too long otherwise |
IMHO: write a simple parser for our API docs and run them against ownCloud :) |
As in provide an example API call and the result, run the example call against the API with test data and then compare it :) That way you generate API docs that are tested and also help you integration test stuff :) |
Or use Codeception which has an API tester http://codeception.com/docs/10-WebServices
|
I'm not talking about coverage on the behat process - but on the php -S localhost:8080 |
Well - there are plenty of tools - we finally simply need to get started ... |
@DeepDiver1975 does unit test coverage fail because of the test server? |
I have found that there were not that many, but I agree, tools should not slow down any effort to improve tests. What I've gathered so far for Codeception +
-
|
A new inspection was created. |
Jenkins is green 🎉 |
I was looking at codeception multiple times - I don't want to introduce another paradigm |
OK. Just know that, although I haven't tested with core tests yet, my PHPUnit tests in other projects run without any changes. You only need to familiarise yourself with the new syntax and setup if your intend on writing new kind of tests (behavioural, API). |
@Raydiation I wrote exactly this some weeks back for another project ;) But it's not in the shape I want it |
So @oparoz wrote one test with codeception - https://github.com/owncloud/gallery/blob/b84508a0b687b91b623c6f81ea99e5fe40daa846/tests/api/CreateUserCept.php Looks interesting as well .... which path to choose? |
For the API stuff, Codeception is easy to use and coders can quickly get going. It's literally about typing a couple of commands and writing your first test, the same way you write a scenario. If you need to show the steps involved to a BA or a PO, then you can convert the script to English. Example
becomes
Of course, with Behat, once the commonly used steps are written in PHP, then things can go very fast as well from scenario to test and it might be more flexible. Some potential problems
I've written some more (more!?! ;)) on my decision to use it for Gallery here: owncloud/gallery#264 (comment) |
FWIW I do prefer Gherkin (Behat) syntax. |
It might be worth getting some feedback via the mailing list? |
An older comparison of the two from 2 years ago. Things might have changed on both sides |
I also like the gherkin syntax more. |
03b0370
to
eb00ac2
Compare
Tested and the code looks good. 👍 |
5efe5f4
to
2d1f509
Compare
I'm merging this now @SergioBertolinSG any future test case via pull request please - THX |
First integration tests for provisioning api
@PVince81 @Raydiation @schiesbn @blizzz @karlitschek
So - before touching the provisioning api to implement V2 - I wanted to have integration tests to be sure nothing will be broken.
TODO: