Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when test fails with junit formatter #1449

Open
mark-webster-catalyst opened this issue Nov 17, 2023 · 1 comment
Open

Exception thrown when test fails with junit formatter #1449

mark-webster-catalyst opened this issue Nov 17, 2023 · 1 comment

Comments

@mark-webster-catalyst
Copy link

This may or may not be an issue with behat itself, but I have to start somewhere.

When running behat tests with --format=junit, if a test fails, I'm getting the following exception:

Default exception handler: Exception - Call to a member function getPageSource() on null Debug: 
Error code: generalexceptionmessage
* line 456 of /vendor/oleg-andreyev/mink-phpwebdriver/src/WebDriver.php: Error thrown
* line 80 of /vendor/behat/mink/src/Exception/ExpectationException.php: call to OAndreyev\Mink\Driver\WebDriver->getContent()
* line 64 of /vendor/behat/mink/src/Exception/ExpectationException.php: call to Behat\Mink\Exception\ExpectationException->getContext()
* line ? of unknownfile: call to Behat\Mink\Exception\ExpectationException->__toString()
* line 102 of /vendor/behat/behat/src/Behat/Testwork/Exception/ExceptionPresenter.php: call to trim()
* line 57 of /vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php: call to Behat\Testwork\Exception\ExceptionPresenter->presentException()
* line 185 of /vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php: call to Behat\Behat\Output\Node\Printer\JUnit\JUnitStepPrinter->printStep()
* line 105 of /vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php: call to Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener->printFeatureOnAfterEvent()
* line 47 of /vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php: call to Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener->listenEvent()
* line 47 of /vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php: call to Behat\Testwork\Output\Node\EventListener\ChainEventListener->listenEvent()
* line 90 of /vendor/behat/behat/src/Behat/Testwork/Output/NodeEventListeningFormatter.php: call to Behat\Testwork\Output\Node\EventListener\ChainEventListener->listenEvent()
* line 230 of /vendor/symfony/event-dispatcher/EventDispatcher.php: call to Behat\Testwork\Output\NodeEventListeningFormatter->listenEvent()
* line 59 of /vendor/symfony/event-dispatcher/EventDispatcher.php: call to Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
* line 64 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php: call to Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
* line 48 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php: call to Behat\Testwork\EventDispatcher\TestworkEventDispatcher->bcAwareDispatch()
* line 90 of /vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php: call to Behat\Testwork\EventDispatcher\TestworkEventDispatcher->dispatch()
* line 64 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php: call to Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester->tearDown()
* line 73 of /vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php: call to Behat\Testwork\Tester\Runtime\RuntimeSuiteTester->test()
* line 75 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php: call to Behat\Testwork\Hook\Tester\HookableSuiteTester->test()
* line 71 of /vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester->test()
* line 73 of /vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php: call to Behat\Testwork\Tester\Runtime\RuntimeExercise->test()
* line 80 of /vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php: call to Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise->test()
* line 149 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Ordering\OrderedExercise->test()
* line 108 of /vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php: call to Behat\Testwork\Tester\Cli\ExerciseController->testSpecifications()
* line 63 of /vendor/behat/behat/src/Behat/Testwork/Cli/Command.php: call to Behat\Testwork\Tester\Cli\ExerciseController->execute()
* line 298 of /vendor/symfony/console/Command/Command.php: call to Behat\Testwork\Cli\Command->execute()
* line 1040 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Command\Command->run()
* line 301 of /vendor/symfony/console/Application.php: call to Symfony\Component\Console\Application->doRunCommand()
* line 124 of /vendor/behat/behat/src/Behat/Testwork/Cli/Application.php: call to Symfony\Component\Console\Application->doRun()
* line 171 of /vendor/symfony/console/Application.php: call to Behat\Testwork\Cli\Application->doRun()
* line 34 of /vendor/behat/behat/bin/behat: call to Symfony\Component\Console\Application->run()
* line 119 of /vendor/bin/behat: call to include()

If tests pass, everything runs smoothly. This is in Moodle, which uses v3.11

@mark-webster-catalyst mark-webster-catalyst changed the title Exception thrown when test fails with junit ouput Exception thrown when test fails with junit formatter Nov 17, 2023
@uuf6429
Copy link

uuf6429 commented Mar 2, 2024

You seem to be using v1.2 (or older) of oleg-andreyev/MinkPhpWebDriver, which isn't a part of the Behat:
https://github.com/oleg-andreyev/MinkPhpWebDriver/blob/1.2/src/WebDriver.php#L456
First of all, I'd suggest upgrading that package to v1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants