Codeception / Codeception/c3

New idea for remote CC

Ouverte
#93 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
PHP
Étoiles
73
Forks
46
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

After reviewing #85 (good work keep it going!) I thought of a different approach to code coverage that might work cleanly as well.

The idea:
1. Before a test starts, connect to C3, this is a "long lived" connection. C3 creates a file temp file with a fixed name and watches it for data, this data is streamed back to the coverage module.
2. During the test each request to the server is profiled and the serialized result (php-codecoverage library supports serialization) is atomically written to the local temp file.
3. After the test ends we disconnect the stream from 1 and this prompts the remote coverage file to be removed

This could simplify things:
- We no longer need to mark each request with a cookie, which needs to be set in the browser module (Selenium, REST, or Php)
- We no longer have edge cases where fetch requests might not send cookies for example
- We cannot support parallel tests since we won't be able to know to which test the coverage belongs

## Streaming coverage
We can stream coverage for each request like this using the PHP report class (copied below since its short)
```php
final class PHP
{
public function process(CodeCoverage $coverage, ?string $target = null): string
{
$coverage->clearCache();

$buffer = "append($unserializedCoverage)`

Optionally we could do some automatic path detection which in most cases should actually be trivial.

Thoughts?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.