PHP code example of qase / pest-reporter

1. Go to this page and download the library: Download qase/pest-reporter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

qase / pest-reporter example snippets


use function Qase\PestReporter\qase;

it('logs in successfully', function () {
    qase()
        ->caseId(123)
        ->title('Login Test')
        ->suite('Auth', 'Login')
        ->field('priority', 'high')
        ->parameter('browser', 'chrome')
        ->step('Open login page')
        ->step('Submit credentials', function () {
            expect(true)->toBeTrue();
        })
        ->comment('Testing login functionality')
        ->attach('/path/to/screenshot.png');
});

use Qase\PestReporter\Qase;

it('logs in successfully', function () {
    Qase::caseId(123);
    Qase::title('Login Test');
    Qase::comment('Testing login');

    expect(true)->toBeTrue();
});

qase()->attach('/path/to/file.png');

qase()->attach(['/path/to/file1.png', '/path/to/file2.log']);

qase()->attach((object)[
    'title' => 'response.json',
    'content' => json_encode($response),
    'mime' => 'application/json'
]);

qase()->step('Open login page');
qase()->step('Enter credentials');
qase()->step('Click submit');

qase()->step('Fill login form', function () {
    // step body — auto-timed, status set to passed/failed
    expect(true)->toBeTrue();
});

qase()->step('Login flow', function () {
    qase()->step('Enter credentials', function () {
        // nested step
    });
    qase()->step('Click submit');
});

qase()->step('Click login', expectedResult: 'Dashboard page loads');

use Qase\PestReporter\Qase;

Qase::step('Open page', function () { /* ... */ });
Qase::step('Verify footer', expectedResult: 'Footer is visible');

qase()
    ->caseId(123)
    ->step('Open page')
    ->step('Fill form', function () { /* ... */ })
    ->step('Submit', expectedResult: 'Success message shown')
    ->comment('All steps passed');

it('adds numbers', function (int $a, int $b, int $expected) {
    qase()->caseId(100);
    expect($a + $b)->toBe($expected);
})->with([
    'one plus one' => [1, 1, 2],
    'two plus two' => [2, 2, 4],
]);

describe('Authentication', function () {
    describe('Login', function () {
        it('logs in with valid credentials', function () {
            qase()->caseId(1)->comment('Testing login');
            expect(true)->toBeTrue();
        });
    });
});

// Or set manually:
it('test with custom suite', function () {
    qase()->suite('API', 'Users', 'Create');
    expect(true)->toBeTrue();
});