Giter VIP home page Giter VIP logo

Comments (2)

sebastianbergmann avatar sebastianbergmann commented on July 17, 2024

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.

amanpatel avatar amanpatel commented on July 17, 2024

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

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.