F
F
fso2018-08-20 15:53:51
PHP
fso, 2018-08-20 15:53:51

How to add new tests to PHPUnit right at runtime?

Hey!
I set up an environment for testers in the form of a bunch of phpunit + selenium (selenoid) . The idea of ​​a simple "smoky" test came up - bypassing all active elements on the page and "clicking" on them in search of javascript and http status errors.
This test turned out in the form of a set of methods for collecting, bypassing links (in particular) and navigating through the page tree.
The entry point is, by default, a public method named `test*` , so all checks are obtained in one test, by multiple `assert` s. This is inconvenient, progress is not visible, and the number of errors is not visually clear in the reports - the first unsuccessful `assert`fails the entire test. It would be desirable to issue transition under each link in the form of the separate test.
Maybe someone solved a similar problem? `@dataProvider` is not suitable here, since it is executed BEFORE the tests start, and in the current case, the data occurs right during testing.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
catanfa, 2018-08-30
@catanfa

maybe the @depends annotation will do ? You break a large test into a bunch of small methods, and pass data to the next method using returnthe previous one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question