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

  • SEARCH
  • Home
  • 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 6780231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:28:52+00:00 2026-05-26T16:28:52+00:00

I am trying to pass a variable to a Selenium PHPUnit script using the

  • 0

I am trying to pass a variable to a Selenium PHPUnit script using the command line.
Looking at the PHPUnit Help Documentation :

We can provide variables using an XML or PHP Config File, but ideally I would like to pass the variable without using an external file.
The reason I am looking for this is because I want to be able to modify Timeout values without having to modify my custom config.php file.

phpunit --help
PHPUnit 3.6.0 by Sebastian Bergmann.

Usage: phpunit [switches] UnitTest [UnitTest.php]
       phpunit [switches] <directory>

  --log-junit <file>        Log test execution in JUnit XML format to file.
  --log-tap <file>          Log test execution in TAP format to file.
  --log-json <file>         Log test execution in JSON format.

  --coverage-html <dir>     Generate code coverage report in HTML format.
  --coverage-clover <file>  Write code coverage data in Clover XML format.
  --coverage-php <file>     Serialize PHP_CodeCoverage object to file.
  --coverage-text <file>    Generate code coverage report in text format.

  --testdox-html <file>     Write agile documentation in HTML format to file.
  --testdox-text <file>     Write agile documentation in Text format to file.

  --filter <pattern>        Filter which tests to run.
  --group ...               Only runs tests from the specified group(s).
  --exclude-group ...       Exclude tests from the specified group(s).
  --list-groups             List available test groups.

  --loader <loader>         TestSuiteLoader implementation to use.
  --printer <printer>       TestSuiteListener implementation to use.
  --repeat <times>          Runs the test(s) repeatedly.

  --tap                     Report test execution progress in TAP format.
  --testdox                 Report test execution progress in TestDox format.

  --colors                  Use colors in output.
  --stderr                  Write to STDERR instead of STDOUT.
  --stop-on-error           Stop execution upon first error.
  --stop-on-failure         Stop execution upon first error or failure.
  --stop-on-skipped         Stop execution upon first skipped test.
  --stop-on-incomplete      Stop execution upon first incomplete test.
  --strict                  Run tests in strict mode.
  -v|--verbose              Output more verbose information.

  --skeleton-class          Generate Unit class for UnitTest in UnitTest.php.
  --skeleton-test           Generate UnitTest class for Unit in Unit.php.

  --process-isolation       Run each test in a separate PHP process.
  --no-globals-backup       Do not backup and restore $GLOBALS for each test.
  --static-backup           Backup and restore static attributes for each test.
  --syntax-check            Try to check source files for syntax errors.

  --bootstrap <file>        A "bootstrap" PHP file that is run before the tests.
  -c|--configuration <file> Read configuration from XML file.
  --no-configuration        Ignore default configuration file (phpunit.xml).
  --include-path <path(s)>  Prepend PHP's include_path with given path(s).
  -d key[=value]            Sets a php.ini value.

  -h|--help                 Prints this usage information.
  --version                 Prints the version and exits.

  --debug                   Output debugging information.
  • 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-05-26T16:28:53+00:00Added an answer on May 26, 2026 at 4:28 pm

    Use -d to set one of PHP’s configuration values and read it using ini_get() in your bootstrap.php file. Use define() to pass it to your test. This is a hack to be sure, but it works for your timeout scenario.

    As a test I used max_execution_time as the transfer point. If you use the same thing, you’ll want to reset it so PHPUnit doesn’t get killed if it takes too long. 😉

    // bootstrap.php
    
    $timeout = ini_get('max_execution_time');
    set_time_limit(0); // run forever
    

    Use -d to pass in your desired timeout.

    phpunit -d max_execution_time=5000
    

    Update: I first tried using a made up setting my_test_timeout, but the value didn’t come through. PHP or PHPUnit must be blocking values not in the INI file or that PHP simply doesn’t support. Given that the INI file can have values specific to modules that PHP cannot know about ahead of time, I wonder if you could add your custom setting to php.ini to get it to work. It’s worth a shot to avoid clobbering an otherwise useful setting. Plus it may allow you to use strings and other types.

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

Sidebar

Related Questions

I am trying to pass one variable to a jQuery function inline (i.e.: using
New to MVC, trying to pass a variable from Flash using FSCommand (works well
I am trying to pass custom variables to paypal IPN. I can manage to
I'm trying to pass a variable using the redirect function, but it is returning
I'm new to using classes and I'm trying to pass a variable to one
I'm trying to pass a c# variable as an argument to a java-script function
I'm trying to pass a variable to nawk in a bash script, but it's
I'm trying to pass a variable through a ssh connection, like this: working_dir=/home/user/some_dir/ ssh
I am trying to pass a variable to an ajax request via jquery. I
I am trying to pass a variable PIN2 that I am retrieving like below

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.