I have had PHPUnit installed on both local Windows machine and remote Linuxserver. I am able to run PHPUnit locally from Netbeans. My next step is, using Netbeans to trigger PHPUnit.bat script to: - SSH to the remote server - Run PHPUnit from there
Manually, I can use PLink to SSH and get back the output from the remote server's PHPUnit run.
Any ideas on how to configure the PHPUnit.bat script to do that?
If this can help : a windows script for running phpunit remotely from netbeans 7.4:
phpunit.bat
@echo off
:: =============================================================
:: Remote execute phpunit command to VM and downloading result
:: =============================================================
:: - assuming project is replicated remotely (WinSCP ?)
:: - assuming NetBeansSuite.php file somewhere in remote VM
:: - using
:: * PuTTY tools - http://www.chiark.greenend.org.uk/~sgtatham/putty/
:: * sed.exe - http://gnuwin32.sourceforge.net/packages/sed.htm
:: remote serveur PuTTY silent connection (auto-login, key authentication with pageant)
set REMOTE_SERVER=your_putty_saved_session_name
:: root path of all local netbeans projects, despecialized for sed
set LOCAL_WORKSPACE=C:\/Apps\/Wamp\/www
:: remote path of all projects, despecialized for sed
set REMOTE_WORKSPACE=\/var\/www\/projects
:: remote location of NetBeansSuite.php, despecialized for sed
set REMOTE_NETBEANSSUITE=\/usr\/local\/share\/php\/phpunit\/NetBeansSuite.php
:: Location of junit log
set REMOTE_LOG_JUNIT=nb-phpunit-log.xml
:: Patch params : \ to /, clean log path, change workspace, change NetBeansSuite
echo %* | sed -e "s/\\/\//g" -e "s/[^ ]*nb-phpunit-log.xml/%REMOTE_LOG_JUNIT%/g" -e "s/%LOCAL_WORKSPACE%/%REMOTE_WORKSPACE%/g" -e "s/[^ ]*NetBeansSuite.php/%REMOTE_NETBEANSSUITE%/g" > %TMP%\res.txt
set /p PARAMS=<%TMP%\res.txt
:: Launch phpunit and revert remote path in the output
echo plink -batch %REMOTE_SERVER% "phpunit %PARAMS% | sed -e 's/%REMOTE_WORKSPACE%/%LOCAL_WORKSPACE%/g' -e 's/\//\\/g'"
plink -batch %REMOTE_SERVER% "phpunit %PARAMS% | sed -e 's/%REMOTE_WORKSPACE%/%LOCAL_WORKSPACE%/g' -e 's/\//\\/g'"
:: Download result
set LOCAL_LOG_JUNIT=%3%
pscp -q -batch %REMOTE_SERVER%:%REMOTE_LOG_JUNIT% %TMP%\res.txt
:: Revert remote path to local path in log file (beware of XML ending tag which must not be translated).
sed -e "s/%REMOTE_WORKSPACE%/%LOCAL_WORKSPACE%/g" -e "s/\([^<]\)\//\1\\/g" %TMP%\res.txt > %LOCAL_LOG_JUNIT%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With