简体   繁体   English

phpunit和selenium2中的非测试功能

[英]non test functions inside phpunit and selenium2

I got a function I want to be able to call from different functions in my selenium test. 我有一个函数,希望能够在硒测试中从不同的函数调用。 lets say it looks something like this: 可以说它看起来像这样:

class TestMyTest extends PHPUnit_Extensions_Selenium2TestCase {


    public function setUp()
    {
    $this->setHost('localhost');
    $this->setPort(4444);
    $this->setBrowser("chrome");
    $this->setBrowserUrl("https://XXXXXXXXXXXXXX");
    }


    public function foo()
    {
    $foo = array("foo", "bar", "foo_bar","bar_foo")
    return $foo;
    }

    public function testSelenium()
    {       
    var_dump(asd());
    }
}

I get undefined function foo when I run this. 运行此命令时会得到未定义的函数foo。 All my functions must start with the name test or they get undefined, is this just not possible? 我所有的函数都必须以名称test开头,否则它们将变得不确定,这是不可能的吗?

Okey,所以我解决了这个问题,我唯一需要做的就是添加$ this->,就像var_dump($this->asd());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM