Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.
How to run WebKing in commandline mode
LegacyForum
Posts: 1,664 ✭✭
Webking can be run from the command line with an argument of ?-cmd? following the wk.exe in command line. For example, go to command prompt under windows. Then go to the directory which webking was installed. Then type ?wk.exe ?cmd?, that will force webking to execute in command line mode.
With command line, one can use options for webking to load a project or script. For example:
run "wk.exe ?cmd ?run NameOfWebKingScript.scr" in command line. NameOfWebKingScript.scr is the name of the script to be executed.
WebKing supports three types of scripts: Webking command script, Javascript and Jython script. For more information regarding how webking supports each of these scripting language, please refer to "Webking documentation" under "Running Webking From the Command Line" <webking install root>/docs/commline.htm#1044151
Here is a sample Jython script that can be used to run all the project files within a single directory:
With command line, one can use options for webking to load a project or script. For example:
run "wk.exe ?cmd ?run NameOfWebKingScript.scr" in command line. NameOfWebKingScript.scr is the name of the script to be executed.
WebKing supports three types of scripts: Webking command script, Javascript and Jython script. For more information regarding how webking supports each of these scripting language, please refer to "Webking documentation" under "Running Webking From the Command Line" <webking install root>/docs/commline.htm#1044151
Here is a sample Jython script that can be used to run all the project files within a single directory:
CODE
CODE import os
from os import *
from com.parasoft.api import *
from java.lang import *
import sys
def find_tests(dir, tests):
for name in os.listdir(dir):
name = os.path.join(dir, name)
ext = os.path.splitext(name)[1]
if (os.path.isdir(name)):
find_tests(name, tests)
elif (ext == '.wkj'):
tests.append(name)
testdir = 'c:/path/to/tests/directory'
tests = []
find_tests(testdir, tests)
print 'Running test suites:'
for t in tests:
name = str(t)
print 'Running '+ name + ':'
Application.execute('runTest ' + t)
print 'All tests complete.'
0