Comments (2)
No new annotations will be added, only attributes. That being said, "arbitrary" and "anything else" does not sound very useful. Please open more specific issues, one for each specific attribute that you would like to see supported. Including an explanation of the use case you want to solve and the semantic you expect from this attribute.
from phpunit.
Thanks for quick response. A quick example would be something like this:
<?php declare(strict_types=1);
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;
final class ExampleTest extends TestCase
{
#[TestDox('Patient Registration.')]
#[TestAnnotation('expectedTime', '3s')]
#[TestAnnotation('category', 'OQ - Operational Qualification')]
#[TestAnnotation('objective', 'The objective of this test is to ensure that patient is registered correctly..')]
#[TestAnnotation('steps', 'The steps are as follows: 1) Create a patient object with fake data (first name, last name etc), 2) Try to register the patient using our API, 3) Ensure that the API call succeeded, 4) Finally, ensure that the database was updated as expected with all the matching details generated in step 1.')]
public function testPatientRegistersCorrectly()
{
$patient = Patient::factory()->make(); // create a fake patient record
// call the registration API
$result = apiCall($patient);
// asert success response
$result->assertSuccess();
// assert the patient in the database
$this->asertDatabaseHas('...');
}
Having these annotations built in to every test would allow us to then generate compliance documentation such as this:
![Screenshot 2024-05-12 at 1 01 58 PM](https://private-user-images.githubusercontent.com/226976/329870733-dce92fc0-7ddd-4831-83e3-eeb0233e62e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTYxMTIzNTAsIm5iZiI6MTcxNjExMjA1MCwicGF0aCI6Ii8yMjY5NzYvMzI5ODcwNzMzLWRjZTkyZmMwLTdkZGQtNDgzMS04M2UzLWVlYjAyMzNlNjJlMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNTE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDUxOVQwOTQ3MzBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MWQ5OWZmMWY3OTAwMmI3ZGM4ZDkyMWNmZGRhMDRmMTgxYjRhMzdhY2RkOTJlM2Q3ZjcxODU5YzY0MWQ3NGM2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.bFV6_9xiur98H3LulOUnz75e3PUVQspTnI0hg8Q9Bqg)
And we could also support a derived test for the elapsedTime
for performance qualification (i.e. to ensure that the patient is registered in under <3s), since phpunit already collects timing information in the output.
from phpunit.
Related Issues (20)
- Newrelic causes error handlers loop to get stuck, tests run out of memory HOT 3
- Infinite recursion with test doubles in combination with a destructor HOT 6
- Reduce output of Constraint failure descriptions, when asserting against trivial data types
- `assertObjectNotEquals()` HOT 3
- Duplicate CI pipeline jobs HOT 2
- TestCase::createStubForIntersectionOfInterfaces returns a Stub without an expects() method, triggering an exception when calling ->method() HOT 3
- Calling `method()` on a test stub created using `createStubForIntersectionOfInterfaces()` throws an unexpected exception HOT 3
- Run code coverage without a phpunit.xml HOT 6
- [Question] returnCallback + willReturnOnConsecutiveCalls HOT 2
- Avoid abstract test warning HOT 3
- Too few arguments to function PHPUnit\Framework\TestCase::__construct(), 0 passed HOT 5
- Depends attribute and annotation only skip tests, but don't execute them on success HOT 2
- Test with dependencies and data provider fails HOT 3
- Testing a method in a Custom Extension class HOT 5
- Is it possible to remove final declaration HOT 2
- [DX] Massive deprecations when upgrading to 10.5.18 and 10.5.20 HOT 4
- advice on installing phpunit HOT 1
- Unknown option "--ansi" HOT 1
- Allow attributes for code coverage targeting to also be used on the test method level (instead of only on the test class level) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpunit.