Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8490273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:04:11+00:00 2026-06-10T22:04:11+00:00

I want to measure code coverage of an HTML test suite for selenium. Therefore

  • 0

I want to measure code coverage of an HTML test suite for selenium. Therefore I want to use PHPUnit in order to execute the suite, because PHPUnit has nice support for code coverage analysis.

Therefore: Is it possible to run an HTML test suite from PHPUnit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:04:12+00:00Added an answer on June 10, 2026 at 10:04 pm

    Short answer

    Running individual HTML test files is not a problem, running HTML suites files however does not seem to work. As long as you put all the HTML test files from a suit in a directory by themselves you can just run runSelenese($folderName)

    Long answer

    I had no idea that running Selenium HTML files directly was even possible until I did some more digging.

    What I used to do is convert/export them first with the Selenium IDE PHP Formatter plugin for Firefox.

    Apparently this is not necessary. All the way at the bottom of Chapter 17. PHPUnit and Selenium the manual states:

    Using the runSelenese($filename) method, you can also run a Selenium test from its Selenese/HTML specification. Furthermore, using the static attribute $seleneseDirectory, you can automatically create test objects from a directory that contains Selenese/HTML files. The specified directory is recursively searched for .htm files that are expected to contain Selenese/HTML. Example 17.5 shows an example.

    Example 17.5: Use a directory of Selenese/HTML files as tests

    <?php
    require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
    
    class SeleneseTests extends PHPUnit_Extensions_SeleniumTestCase
    {
        public static $seleneseDirectory = '/path/to/files';
    }
    ?>
    

    Once you have your Tests in PHPUnit you can use it to get code coverage from the Selenium Server.

    Again, from the manual:

    PHPUnit_Extensions_SeleniumTestCase can collect code coverage
    information for tests run through Selenium:

    1. Copy PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php into your webserver’s document root directory.
    2. In your webserver’s php.ini configuration file, configure PHPUnit/Extensions/SeleniumTestCase/prepend.php and PHPUnit/Extensions/SeleniumTestCase/append.php as the auto_prepend_file and auto_append_file, respectively.
    3. In your test case class that extends PHPUnit_Extensions_SeleniumTestCase, use
      protected $coverageScriptUrl = 'http://host/phpunit_coverage.php';
      to configure the URL for the phpunit_coverage.php script.

    As this can be a bit of a hassle to set up, I’ve always just used the Page Coverage plugin to get an insight into HTML page coverage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to measure the code coverage of an unit test with aqtime. The
I want to measure time memory allocation using this code: long AForMemory = DateTime.Now.Ticks;
I have a normal asp.net page containing some code that I want to measure
I want to be able to measure the time it take to execute an
I have a pretty big Java project with very low code coverage, and want
Suppose I want to measure the time that a certain piece of code takes.
I've several Selenium tests and want to know their coverage (measured with Cobertura). I'm
I want to measure the execution of a piece of code and I'm wondering
I want to measure the time taken by my C++ program however, if I
I want to measure API evolution for a given Java project, in particular new/renamed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.