Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium test case returns Process finished with exit code 0

I have installed phpunit on windows and have coppied the example program. Changing the url to google.com

<?php
require_once 'PHPUnit/Autoload.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp()
    {
        $this->setBrowser('*firefox');
        $this->setBrowserUrl('http://www.google.com/');
    }

    public function testTitle()
    {
        $this->open('http://www.google.com/');
        $this->assertTitleEquals('Example Web Page');
    }
}
?>

The seleinum jar is running :

20:37:24.855 INFO - Java: Sun Microsystems Inc. 20.0-b11
20:37:24.918 INFO - OS: Windows 7 6.1 x86
20:37:25.042 INFO - v2.0 [rc2], with Core v2.0 [rc2]
20:37:27.554 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
20:37:27.570 INFO - Version Jetty/5.1.x
20:37:27.585 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
20:37:27.601 INFO - Started HttpContext[/selenium-server,/selenium-server]
20:37:27.601 INFO - Started HttpContext[/,/]
20:37:27.913 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@a981ca

20:37:27.913 INFO - Started HttpContext[/wd,/wd]
20:37:27.960 INFO - Started SocketListener on 0.0.0.0:4444
20:37:27.991 INFO - Started org.openqa.jetty.jetty.Server@1c29ab2

When I run the code from the command line I get Process finished with exit code 0

like image 343
Will Avatar asked Jun 09 '11 06:06

Will


People also ask

How do I get the process finished with exit code 0?

Whenever I run any code, my console always ends with Process finished with exit code 0 . Solution: It means that there is no error with your code. You have run it right through and there is nothing wrong with it.

What does finished with exit code 0 mean?

As you can see from the above example, our code printed the string successfully, and after that, it finished the process without any error. Exit code 1 occurs whenever there is an error in our code, but exit code 0 means that there is no error and our code has run entirely without any problem.

What is process finished with exit code 1?

Exit Code 1 indicates that a container shut down, either because of an application failure or because the image pointed to an invalid file. In a Unix/Linux operating system, when an application terminates with Exit Code 1, the operating system ends the process using Signal 7, known as SIGHUP.


1 Answers

Did you use "phpunit yourTestCase.php" and not "php yourTestCase.php"?

I ran your testfile with phpunit (3.5.14) and "selenium-server-standalone-2.0rc2.jar", no Problems (except that the test itself fails):

PHPUnit 3.5.14 by Sebastian Bergmann.

E

Time: 10 seconds, Memory: 3.50Mb

There was 1 error:

1) WebTest::testTitle BadMethodCallException: Method assertTitleEquals not defined.

C:\Users\x\Desktop\sel\php\______phptest.php:16 C:\Users\x\Desktop\sel\php\______phptest.php:16

FAILURES! Tests: 1, Assertions: 0, Errors: 1.

.

C:\SELENIUM>java -jar C:\SELENIUM\selenium-server-standalone-2.0rc2.jar
10:27:29.802 INFO - Java: Sun Microsystems Inc. 20.1-b02
10:27:29.803 INFO - OS: Windows 7 6.1 x86
10:27:29.805 INFO - v2.0 [rc2], with Core v2.0 [rc2]
10:27:29.904 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
10:27:29.905 INFO - Version Jetty/5.1.x
10:27:29.906 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
10:27:29.906 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:27:29.907 INFO - Started HttpContext[/,/]
10:27:29.935 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@186d4c
1
10:27:29.935 INFO - Started HttpContext[/wd,/wd]
10:27:29.938 INFO - Started SocketListener on 0.0.0.0:4444
10:27:29.938 INFO - Started org.openqa.jetty.jetty.Server@ec16a4
10:28:21.756 INFO - Checking Resource aliases
10:28:21.757 INFO - Command request: getNewBrowserSession[*firefox, http://www.g
oogle.com/] on session null
10:28:21.759 INFO - creating new remote session
10:28:21.773 INFO - Allocated session 80e73d7f9ea94244a3c0a40ebdcb9110 for http:
//www.google.com/, launching...
10:28:21.820 INFO - Preparing Firefox profile...
10:28:25.358 INFO - Launching Firefox...
10:28:29.413 INFO - Got result: OK,80e73d7f9ea94244a3c0a40ebdcb9110 on session 8
0e73d7f9ea94244a3c0a40ebdcb9110
10:28:29.420 INFO - Command request: setTimeout[30000, ] on session 80e73d7f9ea9
4244a3c0a40ebdcb9110
10:28:29.451 INFO - Got result: OK on session 80e73d7f9ea94244a3c0a40ebdcb9110
10:28:29.456 INFO - Command request: open[http://www.google.com/, ] on session 8
0e73d7f9ea94244a3c0a40ebdcb9110
10:28:31.015 INFO - Got result: OK on session 80e73d7f9ea94244a3c0a40ebdcb9110
10:28:31.020 INFO - Command request: testComplete[, ] on session 80e73d7f9ea9424
4a3c0a40ebdcb9110
10:28:31.020 INFO - Killing Firefox...
10:28:31.344 INFO - Got result: OK on session 80e73d7f9ea94244a3c0a40ebdcb9110
like image 161
Loxik Avatar answered Oct 28 '22 05:10

Loxik