TYPO3 6.2 functional testing error - typo3-6.2.x

I want to run typo3 functional tests for my extension, but I get the following error:
Call to a member function admin_query() on a non-object in /x/y/z/TYPO3.DIR/typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php on line 493
What's wrong?

Use the following command to run functional tests of your extension:
typo3conf/ext/phpunit/Composer/vendor/bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml typo3conf/ext/<YOU_EXT_DIR>/Tests/Functional/

Related

Can not run Clojure project with Cursive using Leiningen

I am unable to run a simple test project using the intellij plugin cursive. I am able to open a REPL without any problems and can even call functions defined in the core.clj file.
Running the project directly however yields this error message:
Error running 'new-project.core': failed to access class com.intellij.execution.impl.ProcessStreamsSynchronizer from class com.intellij.execution.impl.ConsoleViewRunningState (com.intellij.execution.impl.ProcessStreamsSynchronizer is in unnamed module of loader com.intellij.util.lang.UrlClassLoader #402f32ff; com.intellij.execution.impl.ConsoleViewRunningState is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader #c9a79eb)
Intellij run configuration here. Changing How to run it and What to run does nothing.
Starting the project via the Leiningen tab yields the same error message.
There is an issue open about it.
https://github.com/cursive-ide/cursive/issues/2350
Also I tried to do lein run Let me know if this work for you.

Debug Configuration in WebStorm for CucumberJS and TestCafe based project

I am trying to set up WebStorm for one of the TestCafe project integrated with CucumberJS (Link: https://github.com/rquellh/testcafe-cucumber).
I am able to sort the debug configuration so far using WebStorm help, however, when I debug the project, it throws the following error to the console:
I am passing the following cucumber.js arguments:
--require testlab/**/step_definitions/*.js --tags #debug
And while I debug, I get the following error:
ReferenceError: testController is not defined
at World.<anonymous>
Test ignored.
Test ignored.
Failures:
1) Scenario: Searching for TestCafe on GitHub #
testlab\features\finAPIDemo.feature:6
× Given I open the GitHub page # testlab\step_definitions\github.js:5
ReferenceError: testController is not defined
I am expecting the debug to execute correctly, however, it is not working, the alternative I believe would be to write a js config and pass through as mentioned in the CucumberJS document page, however, I am not sure how to achieve that.
Any input or help will be appreciated.
This error only occurs when running cucumber with --tags #debug, and it's not specific to the IDE - you will face the same issue when starting your tests in terminal with node node_modules/cucumber/bin/cucumber-js --tags #debug:
node node_modules/cucumber/bin/cucumber-js --tags #debug
0 scenarios
0 steps
0m00.000s
E:\WebstormProjects\testcafe-cucumber\features\support\hooks.js:77
if (testController.testRun.lastDriverStatusResponse === 'test-done-confirmation') {
^
ReferenceError: testController is not defined
at Timeout.checkLastResponse [as _onTimeout] (E:\WebstormProjects\testcafe-cucumber\features\support\hooks.js:77:9)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
I'm not sure why you need this option... There are no scenarios marked with #debug in your project, as far as I can see.
I'd suggest using a standard Cucumber.js run configuration for debugging. It works fine for me - tests are run, and breakpoints are hit:
You need to add the #debug directive for the scenario that you want to debug.
See the full setup in this help topic.
I would recommend using cucumber profiles and call that profile instead of using cli commands. Looking at the error you are receiving it looks like you are missing more required directories such as a custom world directory?
Under the hooks.js I have updated the import statements with const assignment and that worked for me:
Replaced:
'import errorHandling from "./support/errorHandling.js";\n' +
'import testControllerHolder from "./support/testControllerHolder.js";\n\n' +
with
'const errorHandling = require("./support/errorHandling.js");\n' +
'const testControllerHolder = require("./support/testControllerHolder.js");\n\n' +

PHP Fatal error: Interface 'PHPUnit\Framework\TestListener' not found

I'm working on a CakePHP 3.x project on a Vagrant VM. My project has a single Test for a Controller. Project was setup using composer and phpunit is installed in vendor directory.
Running ./vendor/bin/phpunit Tests throws the following error:
[vagrant#devenv-lamp ~/www]$ ./vendor/bin/phpunit Tests
PHP Fatal error: Interface 'PHPUnit\Framework\TestListener' not found in /vagrant/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php on line 30
Fatal error: Interface 'PHPUnit\Framework\TestListener' not found in /vagrant/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php on line 30
I tried running PHPUnit for a single Controller as well - with the same results...
[vagrant#devenv-lamp ~/www]$ ./vendor/bin/phpunit tests/TestCase/Controller/QuestionsControllerTest.php
PHP Fatal error: Interface 'PHPUnit\Framework\TestListener' not found in /vagrant/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php on line 30
Fatal error: Interface 'PHPUnit\Framework\TestListener' not found in /vagrant/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php on line 30
I'm very new to PHPUnit and am running into a wall even without taking off the ground. Any help here will be greatly appreciated.
It looks like autoloading is not set up correctly.
In your phpunit.xml you need to specify a bootstrap file. This can either be a custom script based on your project or in some cases it's as easy as using composer's autoload.php:
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd"
bootstrap="vendor/autoload.php"
>
...
</phpunit>

Fatal error: Class 'PHPUnit_Extensions_Selenium2TestCase' not found in *.php

I am completely new to Seleniu, and am trying to set up PHPUnit with Selenium 2, following this tutorial https://www.youtube.com/watch?v=zva_GETXimI
So far this is what I've done:
Installed PHPUnit using PHAR as instructed here https://phpunit.de/manual/current/en/installation.html
Installed Selenium Server
Upgraded to PHP5.6 (but my Apache is still 2.22 instead of 2.4)
Installed PHPUnit_selenium package using Composer
Created a testLogin.php file:
<?php
class testLogin extends PHPUnit_Extensions_Selenium2TestCase{
public function setUp()
{
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowser('firefox');
$this->setBrowserUrl('http://localhost/Achievers');
}
}
When I run testLogin.php using 'phpunit testLogin.php' I get an error:
Class 'PHPUnit_Extensions_Selenium2TestCase' not found in /home/osadmin/projects/Sel/testLogin.php on line 5
Since I am just starting out, I have no idea how to fix this. On googling the error, it shows to add this line to my php file:
require_once('PHPUnit/Extensions/Selenium2TestCase.php');
But I'm not sure how I can use this since there is no PHPUnit folder, just a file linked to the PHAR.
Could someone please shed some light on how to fix this issue?
Thanks.
EDIT:
As per Ushakov's suggestion, I tried /path/to/phpunit.phar testLogin.php
But it gives the same error.
If I add this line to the testLogin.php: require_once('/usr/local/bin/phpunit');
and run /path/to/phpunit.phar testLogin.php
I get this:
#!/usr/bin/env php
PHP Notice: Constant __PHPUNIT_PHAR__ already defined in /usr/local/bin/phpunit on line 18
PHP Notice: Constant __PHPUNIT_PHAR_ROOT__ already defined in /usr/local/bin/phpunit on line 19
PHP Fatal error: Cannot redeclare class DeepCopy\DeepCopy in phar:///usr/local/bin/phpunit/myclabs-deep-copy/DeepCopy/DeepCopy.php on line 15
Solved it by adding this line to the PHP file:
require_once 'vendor/autoload.php';
No tutorial I have seen mentions this, but it can be found in github projects
For anyone else coming late to the party - this worked for me:
class testLogin extends \PHPUnit\Extensions\Selenium2TestCase
(Using PHP 7.0.3 and installing Selenium package with Composer ).

Fatal error: Cannot redeclare class WebTestCase in C:\wamp\www\testapp\protected\tests\WebTest ase.php on line 17

i am using phpunit with selenium in yii to test default created testing cases.
when i am trying to run SiteTest.php file from tests folder then its giving error like
Fatal error: Cannot redeclare class WebTestCase in C:\wamp\www\testapp\protected\tests\WebTest ase.php on line 17
and when i am trying to run from functional folder then its showing CWebTestCase not defined
i am running this command from command line
protected\test>phpunit functional/SiteTest.php
system configuration
window 7 64 bit
phpunit is installed
selenium is installed
pear is installed
latest version of all with latest version of yii as well. please help me asap.
regards
anil