Best practice to test glue implementation.

Is there a spryker recommendation how to test my custom glue implementation with codception maybe?
Answers
-
0
-
Have you taken a look at one of the core API module ?
Here is an example of CustomerApi testing:
https://github.com/spryker/customer-api/tree/master/tests/SprykerTest/Zed/CustomerApi
0 -
Will have a look.
0 -
Are you serious about this?
I am sorry, but this is a good example of bad testing. What kind of tests are these supposed to be? Are these feature tests?Why is there no typing in these tests (or in the package in general)?
You could for example remove the first assertion completely if you'd just add proper typing.What is the first test supposed to be testing? I am known for being too lazy to write long names, but test names should reflect what they're supposed to test. This doesn't even include the name of the tested method "getCustomer". A better name would be something like "testCustomerCanBeRetrievedById".
After checking the content of that test, I still don't know what it is actually testing. It checks that the result has a non-empty ID and then it has an array in the "data" property that has a non-empty value for the key "CustomerApiTransfer::CUSTOMER_REFERENCE".
Why should it have these? And shouldn't I care more about the actual result that will be returned? Right now that test would succeed if it would just return a random ApiItemTransfer, as long as it has any value for the ID and array with a key "CustomerApiTransfer::CUSTOMER_REFERENCE" within the data attribute.
I could write a lot more about the other tests as well, but I think I made my point.
With tests like this, you get code coverage. But not actual value.
Looking at the original question again I also don't see the relation to API testing.
There I would expect something like
```
$response = $IโasCustomer($customerId)โvisit($route);
```
1 -
Sorry for the misunderstanding!
That was just a folder to show you the structure of the testing folder when testing the different layers with codecept.
As for your last example>
All tested Glue modules are located at project level in https://github.com/spryker-shop/b2c-demo-shop/tree/master/tests/PyzTest/GlueI'll forward your observations to the Core team.
Thanks!
0
Categories
- All Categories
- 38 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 32 Spryker News
- 534 Developer Corner
- 405 Spryker Development
- 54 Spryker Dev Environment
- 272 Spryker Releases
- 30 Propel ORM
- 46 Community Projects
- 6 Gacela Project
- 3 PHP Bridge
- 21 Hackathon
- 3.2K ๐ Slack Archives
- 115 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random
- 4 Code Testing
- 23 Product & Business Questions
- 40 Spryker Safari Questions
- 35 The Blackhole