-
Notifications
You must be signed in to change notification settings - Fork 15
Testkit lite for Windows Device Solution
This solution is for executing test cases on Windows device. main components:
- testkit-lite is the command line interface(CLI) of Testkit-lite. Which provides comprehensive options for web/core testing and supports cross platform. comm-module and test-engine are included in testkit-lite.
- testkit-stub is a native process running on test target, which work as proxy between test suite and testkit-lite.
- Apache TcpMon is a HTTP proxy. which work on automatically forward HTTP require and response between different port and host.
- stub-demon is a powershell script to provide single-thread HTTP server for managing stub operations including checking, launching and killing.
testkit-stub provide additional rest API:
- execute_cmd and execute_async_cmd: for executing "xwalk.exe" and corresponding command for checking "xwalk.exe" status.
- powershell_install and powershell_uninstall: for executing powershell scripts to download and install/uninstall test suite msi files.
On Ubuntu host, below components have to be installed.
- testkit-lite
- tinyweb
### Testkit-lite Deployment Please refer testkit-lite installation command for executing test suites on Windows device:
$testkit-lite -f <TEST_DEFINITION_XML_PATH>/tests.xml --comm windowshttp --deviceid <WINDOWS_DEVICE_IP_ADDRESS>
Please refer Tinyweb installation on Ubuntu Host for installing tinyweb on Ubuntu. After the tinyweb is installed, docroot should be deployed.
- Get the docroot package webapi-server-docroot-tests from test suites release packages
- Unzip the package webapi-service-docroot-tests
For automatically install/uninstalling test suites, the test suites packages should be deploy in tinyweb docroot folder.
- Create a new folder "packages" in the unzipped docroot folder.
- Copy all suites packages into the new folder "packages".
- Unzip these suites packages. Once Windows device is ready (testkit-stub and powershell are executing), execute the "inst.py" in each suites to install/uninstall.
Command example for launching tinyweb:
$tinyweb -ssl_certificate <CERTIFICATE_FILE_PATH>/server.pem -document_root <DOC_ROOT_PATH>/docroot -listening_ports 8080, 80801,8082,8083,8443s
For checking if the tinyweb works:
- open browser on Ubuntu host
- enter address http://127.0.0.1:8080/, the web runner should be shown.
- enter address http://127.0.0.1:8080/packages, the suite packages should be listed.
- the suites are unziped, the suite folder list and corresponding msi file should be available on http://127.0.0.1:8080/packages/opt/ and http://127.0.0.1:8080/packages/opt/<SUITE_NAME>
3 components should be deployed on Windows device.
- testkit-stub
- TcpMon
- Powershell script including stub-demon
below is the deployed folder structure.
Get the distribute binary from the testkit-lite release packages, or stub
Get the dll "pthreadGC2.dll".
- Dowload the release package of “pthread-w32” from https://www.sourceware.org/pthreads-win32/
- Extract the release package, the dll is in <PTHREAD-W32_HOME>\Pre-built.2/dll\x86\pthreadGC2.dll
Copy the stub binary and dll into c:\stub
command for launching testkit-stub:
c:\stub\>testkit-stub.exe
- Get the script from download.ps1, uninstall.ps1 and stub_demon.ps1
- Copy the 3 scripts into c:\stub\powershell\
- Create a new package c:\stub\packages\
-
Installing Java SE Runtime Environment
-
Download the jar from https://code.google.com/p/tcpmon/
-
Launching TcpMon with command
c:\<TCP_MON_HOME>\>java -cp .\tcpmon-1.1.jar com.codegoogle.tcpmon.MainWindow
-
Config the TcpMon to add 8080, 8081, 8082, 8083, 8084, 8443 port, the server name should be the host ip.
-
Config the TcpMon to forward 127.0.0.1:9090 on local port 9000. This connection work for stub-demon. Validating if the TcpMon works correctly.
-
open browser on Windows device
-
enter address http://127.0.0.1:8080/, the web runner should be shown.
-
enter address http://127.0.0.1:8080/packages, the suite packages should be listed.
-
the suites are unziped, the suite folder list and corresponding msi file should be available on http://127.0.0.1:8080/packages/opt/ and http://127.0.0.1:8080/packages/opt/<SUITE_NAME>
-
Step 1: Launch TcpMon on Windows device, and configure the forward connection 127.0.0.1:9090 --> localhost:9000 for stub-demon
-
Step 2: If the test suites need tinyweb supports. configure the forward for tinyweb_host:8080, 8081, 8082, 8083 and 8443.
-
Step 3: Launch stub-demon as administrator on Windows device
-
Step 4: Validate stub-demon works correctly via browser with address "http://127.0.0.1:9000/launch_stub". testkit-stub is supposed to be launched by this step.
-
Step 5: Launch tinyweb on Ubuntu host
$tinyweb -ssl_certificate <CERTIFICATE_FILE_PATH>/server.pem -document_root <DOC_ROOT_PATH>/docroot -listening_ports 8080, 80801,8082,8083,8443s
-
Step 6: Deploy the corresponding msi/zip file under docroot folder
-
Step 7: Execute the "inst.py" script in suite package to install test suite
$python inst.py -i -d <DEVIE_IP> -m <HOST_IP>
-
Step 8: execute testkit-lite
$testkit-lite -f <TEST_DEFINITION_XML_PATH>/tests.xml --comm windowshttp --deviceid <WINDOWS_DEVICE_IP_ADDRESS>
-
The first 6 steps are same with the scenario of Single Web test suite.
-
Step 7 need to be repeated to install all involved test suites.
-
Step 8: execute testkit-lite
$testkit-lite -f <TEST_DEFINITION_XML_1_PATH>/tests1.xml <TEST_DEFINITION_XML_2_PATH>/tests2.xml ... --comm windowshttp --deviceid <WINDOWS_DEVICE_IP_ADDRESS>
The native test suite could be executed in the Web testing context. For only executing Native test suites, above steps can be simplied as below.
-
Step 1: Launch TcpMon on Windows device, and configure the forward connection 127.0.0.1:9090 --> localhost:9000 for stub-demon
-
Step 2: Launch stub-demon as administrator on Windows device
-
Step 3: Validate stub-demon works correctly via browser with address "http://127.0.0.1:9000/launch_stub". testkit-stub is supposed to be launched by this step.
-
Step 4: execute testkit-lite
$testkit-lite -f <TEST_DEFINITION_XML_PATH>/tests.xml --comm windowshttp --deviceid <WINDOWS_DEVICE_IP_ADDRESS>
For some cases which need load extensions library when launching crosswalk, a new attribute should be defined in the element set in 'tests.xml' like below:
<suite ...>
<set name="SET_NAME" type="js" extension="EXTENSION_RELATIVE_PATH">
<testcase ...>
...
The environment deployment is same with the Web testing on Windows. The execution command is below:
$testkit-lite -f <TEST_DEFINITION_XML_PATH>/tests.xml --comm windowshttp --deviceid <WINDOWS_DEVICE_IP_ADDRESS>