私はphpunitでseleniumを使用してWebのものの一部をテストしていますが、失敗したスクリーンショットでテストしているテキストを確認できても失敗するようです-私のテストは以下のとおりです
<?php
include('setupclass.php');
class AddNewPicStationTest extends setupclass
{
protected function setUp()
{
parent::setUp();
}
public function testMyTestCase()
{
$this->open($this->apppath);
$this->click("css=a > img");
$this->waitForPageToLoad("30000");
$this->type("name=username", "");
$this->type("name=password", "");
$this->click("name=submit");
$this->waitForPageToLoad("30000");
$this->click("link=ADD LIKESTATION");
$this->waitForPageToLoad("30000");
$this->click("link=HOME");
$this->waitForPageToLoad("30000");
$this->click("link=ADD PICSTATION");
$this->waitForPageToLoad("30000");
$this->type("id=title", "Test title 2");
$this->type("id=message", "test description 2");
$this->click("id=tip5");
$this->type("id=album_title", "test album title 2");
$this->type("id=album_description", "test album description 2");
$this->click("//input[@value='Login']");
$this->click("xpath=(//input[@name='group1'])[2]");
$this->type("name=station_pic_upload", "C:\\Users\\chris laptop\\Desktop\\Logo.png");
$this->click("name=g");
$this->waitForPageToLoad("30000");
**$this->assertTrue($this->isTextPresent("Test title 2"),"object created");**
$this->assertFalse($this->isTextPresent("Error"),"Error is present");
$this->assertFalse($this->isTextPresent("Profiler"),"PRofiler is running");
$this->click("link=LOGOUT");
$this->waitForPageToLoad("30000");
}
}
?>
画面グラブにアスタリスク行が表示されていても失敗します。これは初めてです。助けていただければ幸いです。
これは、テストが探している以下の私のページです-ステーションタイトル
<table width="620px" align="left" style="text-align:left;">
<tr style="font-weight:bold;background-color:#f1f1f1">
<td colspan="5" STYLE="text-align:center;font-weight:bold">FACEBOOK PIC STATIONS</td>
</tr>
<tr style="font-weight:bold;background-color:#f1f1f1">
<td width="15%">STATION ID</td>
<td width="50%">STATION TITLE</td>
<td width="10%">STATION STATS</td>
<td width="15%">LAST POST</td>
<td width="10%"></td>
</tr>
<?foreach($picstations->result() as $row){?>
<tr>
<td><?=anchor('socialmedia/edit_picstation/'.$row->station_id,$row->station_id);?> </td>
<td><?=anchor('socialmedia/edit_picstation/'.$row->station_id,$row->title);?> </td>
<td><?=anchor('stats/home/station_stats/'.$row->station_id,'STATS');?> </td>
<td><?=$this->upd8r_date->get_last_post_from_station_time($row->station_id)?></td>
<td><?=anchor('socialmedia/delete/'.$row->station_id,'delete');?></td>
</tr>
<?}?>
</table>
そしてここに私のphpunit出力-
1) AddNewPicStationTest::testMyTestCase
Current URL: http://localhost/upd8r_new/socialmedia/add_picstation
Screenshot: http://localhost/upd8r_new/tests/screenshots/692eb179f8146d2a8491442
68dd2a99a.png
object created
Failed asserting that false is true.
C:\xampplite\php\phpunit:46
FAILURES!
Tests: 1, Assertions: 1, Errors: 1.