18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to build Sahi source code using Eclipse IDE

millerKillermillerKiller Members
edited November -1 in Sahi - Open Source
The company I work with does a lot of website programming. I am the manager over 3 teams of programmers. We stumbled across this amazing product and are very interested in using it. We do things for very secure websites. I want my teams to use this product, but my superior will only let us use it if we can verify 100% that it doesn't compromise our clients security. Company policy is that I have to check the source code and verify that there isn't any malicious code hidden some where. Lucky for us, this program is open source, (thanks for sharing). I've looked on the website and haven't been able to find the source files. Can someone please tell me where they are at? Even more useful would be if someone could provide a step by step instruction to import and build the source files using the Eclipse IDE.

Thank you very much,
Steven Miller

Comments

  • narayannarayan Administrators
    Steven,

    This is the SVN branch from which V3 releases are made. https://sahi.svn.sourceforge.net/svnroot/sahi/branches/sahi_rhino_controller2

    If you checkout, it should have the eclipse project too.

    You can do "ant all" to compile and get a releasable build.

    Do report back if you find anything.

    Regards,
    Narayan
  • I pulled the code from the link that you gave and did an "ant - all" on the build.xml, I got a failure to build with the following responses:


    Buildfile: C:\Users\Steven\workspace\Sahi\build.xml
    all:
    clean:
    compile:
    [javac] Compiling 117 source files to C:\Users\Steven\workspace\Sahi\classes
    BUILD FAILED
    C:\Users\Steven\workspace\Sahi\build.xml:154: The following error occurred while executing this line:
    C:\Users\Steven\workspace\Sahi\build.xml:35: Error running javac.exe compiler

    Total time: 520 milliseconds


    Project 'Sahi' is missing required library: 'lib/sahi.jar' Sahi Build path Build Path Problem
    The project cannot be built until build path errors are resolved Sahi Unknown Java Problem


    It looks to me like a file is missing from the files I got from the repository or that I need to set a path variable somewhere. Could you tell me what I am doing wrong?
  • Hi,

    This error might be occurred due to the allocation of the insufficient memory to the java compiler. so, try replacing the parameter memoryMaximumSize="${compiler.max.memory}" as memoryMaximumSize="512m" in build.xml

    Thanks,
    Venky.
  • millerKillermillerKiller Members
    edited December 2009
    thanks for the reply, I tried changing that line of code and I still am getting the same error in the console:


    Buildfile: C:\Users\Steven\workspace\Sahi\build.xml
    all:
    clean:
    compile:
    [javac] Compiling 117 source files to C:\Users\Steven\workspace\Sahi\classes

    BUILD FAILED
    C:\Users\Steven\workspace\Sahi\build.xml:155: The following error occurred while executing this line:
    C:\Users\Steven\workspace\Sahi\build.xml:35: Error running javac.exe compiler
    Total time: 674 milliseconds


    under the problems tab I am still getting:
    Description Resource Path Location Type
    Project 'Sahi' is missing required library: 'lib/sahi.jar' Sahi Build path Build Path Problem





    When I go and look at the lines of code then
    line 155 is: <antcall target="test"/>
    line 35 is: memoryMaximumSize="512m" fork="true" srcdir="src">
    Here is what I am doing exactly:
    Step1: I right click on the file called build.xml
    Step2: I go to run as ant build and click this option.
    I am using eclipse galileo.

    I'm sure the problem is something simple, but I can't figure out what is wrong. Does anyone know what is wrong?
  • narayannarayan Administrators
    millerKiller,

    Eclipse is unable to find javac.exe because java/bin is not in your path. You can do one of these three things:

    1) Run the ant command from the a command line outside eclipse with java/bin in path
    2) Add java/bin to your system path and run it from eclipse
    3) In Eclipse, right click on build.xml -> Run As -> External Tools Configurations ... -> Environment tab. Add new environment variable PATH with value D:\your_java_path\bin . Make sure "Append environment to native environment" is checked.


    For people starting fresh,

    1) Checkout Sahi code from SVN from https://sahi.svn.sourceforge.net/svnroot/sahi/branches/sahi_rhino_controller2

    2) In Eclipse, do File -> Import -> Existing Projects into Workspace -> Next -> Select the above checked out directory as root directory. Project should now be imported.

    3) Right click build.xml -> Run As -> Ant Build. This will either work or fail.

    If it fails:

    4) Right click build.xml -> Run As -> External Tools Configurations ... -> Environment tab. Add new environment variable PATH with value D:\your_java_path\bin . Make sure "Append environment to native environment" is checked. Apply and Run.

    It should now pass.

    An ant configuration is created only if you have done Run As Ant at least once. So do step 3 before step 4.

    Regards,
    Narayan
  • millerKillermillerKiller Members
    edited December 2009
    I tried setting the environmental variable in eclipse as was explained in the previous post. I have the following:

    Name: Sahi
    Value: C:\Program Files\Java\jdk1.6.0_17\bin

    I apply it and run the ant build, but I get the same errors as mentioned above:
    C:\Users\Steven\workspace\Sahi\build.xml:154: The following error occurred while executing this line:
    C:\Users\Steven\workspace\Sahi\build.xml:35: Error running javac.exe compiler

    I even tried deleting what I got from the repository and followed the step by step instructions given in the forum.

    I know the path is correct because I open a command prompt and can cd into it with the exact path above. I also checked to make sure that the javac.exe was in the bin and it is. There's got to be something else that is out of place and needs to be set. I want to get this going and am not willing to give up just yet. Could you help me figure it out? (I would be glad to submit any configurations, step by step explanations, screen shots of what I am doing and how eclipse is set up)

    Here is some additional information if it helps at all:
    I have another environmental variable present, it is:
    name: ANT_HOME
    value: C:\Users\Steven\Downloads\Programming\Eclipse\Galileo\eclipse-SDK-3.5.1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20090120-1145

    I would like to get it working using option (3) from the above post, but if I can't then I have some questions about the other options. I am not as familiar with ant as I am with other build programs such as make and mauvern. For option (1) in the previous post, how would I run it from the command line since ant is embedded into eclipse without having to install a new installation of ant seperate from eclipse?
  • narayannarayan Administrators
    Hi millerKiller,

    The name should be "PATH" not "Sahi"

    Name: PATH
    Value: C:\Program Files\Java\jdk1.6.0_17\bin

    not

    Name: Sahi
    Value: C:\Program Files\Java\jdk1.6.0_17\bin

    1) To run from command line, create a batch file like this:

    sahi_env.bat
    set ANT_HOME=C:\Users\Steven\Downloads\Programming\Eclipse\Galileo\eclipse-SDK-3.5.1-win32\eclipse\plugins\org.apache.ant_1.7.1.v20090120-1145
    set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_17
    set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%
    cd C:\Users\Steven\workspace\Sahi
    cls

    Then on a command prompt, run sahi_env.bat, it will initialize your paths and environment variables correctly.

    Then run the various targets based on what you want:
    1) ant all: cleans, compiles, runs unit tests, generates a build in "deploy" folder
    2) ant start: starts the proxy
    3) ant quick: just compiles changed classes and builds jars. No tests.

    There is a demo.xml build file which has functional tests for sahi.
    1) ant -f demo.xml runfftests: will run all tests on firefox.
    2) ant -f demo.xml runietests: will run all tests on IE.
    similarly, runchrometests and runsafaritests

    Running ant from command line is much faster than running from Eclipse. (1min vs 2 mins on my machine)

    Btw, if you are unable to get javac.exe error removed, and if you are not getting a quick answer here because of timezone differences, please google for "eclipse ant Error running javac.exe compiler". It seems to be a common error, not specific to Sahi, and you get a lot of relevant results.

    Regards,
    Narayan
  • Thanks narayan for your quick responses, I am finally past the javac.exe problem, but now I am getting another problem with which I think it is a problem with the actual project. Here are the errors:

    BUILD FAILED
    C:\Users\Steven\workspace\Sahi\build.xml:154: The following error occurred while executing this line:
    C:\Users\Steven\workspace\Sahi\build.xml:452: JUnit tests failed. MAKE SURE THAT junit.jar AND log4j.jar ARE PRESENT IN {sahi}/extlib/ FOLDER

    I checked the extlib folder and these jars reside in the folder called test. I tried creating a folder called FOLDER and putting these jars in there. This still didn't work. I then created a folder called Folder (with a space in front of it) and I put these jars in it and it still didn't work. Do you know what the problem is? Below is my console output:
  • Buildfile: C:\Users\Steven\workspace\Sahi\build.xml
    all:
    clean:
    compile:
    [javac] Compiling 117 source files to C:\Users\Steven\workspace\Sahi\classes
    compile-test:
    [javac] Compiling 51 source files to C:\Users\Steven\workspace\Sahi\classes
    [copy] Copying 1 file to C:\Users\Steven\workspace\Sahi\classes
    test:
    [junit] Testsuite: net.sf.sahi.ProxyTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.25 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] >>>> Sahi started. Listening on port: 9999
    [junit] >>>> Configure your browser to use this server and port as its proxy
    [junit] >>>> Browse any page and CTRL-ALT-DblClick on the page to bring up the Sahi Controller
    [junit] Sahi OS properties file = C:\Users\Steven\workspace\Sahi\config\os.properties
    [junit] socket closed
    [junit]


    [junit]
    Standard Error
    [junit] Exception in thread "Thread-1" java.lang.NullPointerException
    [junit] at net.sf.sahi.util.Diagnostics.run(Diagnostics.java:32)
    [junit] at java.lang.Thread.run(Unknown Source)
    [junit]


    [junit] Testsuite: net.sf.sahi.RemoteRequestProcessorTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.123 sec
    [junit] Testsuite: net.sf.sahi.ant.RunSahiTaskTest
    [junit] Tests run: 6, Failures: 0, Errors: 0, Time elapsed: 4.388 sec
    [junit] Shutting down ...
    [junit] Shutting down ...
    [junit] Shutting down ...
    [junit] Shutting down ...
    [junit] Connection refused: connect
    [junit] Connection refused: connect
    [junit] Connection refused: connect
    [junit] Connection refused: connect
    [junit] Testsuite: net.sf.sahi.client.ElementStubTest
    [junit] Tests run: 11, Failures: 0, Errors: 0, Time elapsed: 0.078 sec
    [junit] Testsuite: net.sf.sahi.command.CommandExecuterTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.027 sec
    [junit] Testsuite: net.sf.sahi.command.CommandInvokerTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.01 sec
    [junit] Testsuite: net.sf.sahi.command.CustomResponseManagerTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.016 sec
    [junit] Testsuite: net.sf.sahi.config.ConfigurationTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.073 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.issue.IssueFormatterTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.017 sec
    [junit] Testsuite: net.sf.sahi.issue.IssueReporterTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.038 sec
    [junit] Testsuite: net.sf.sahi.issue.JiraIssueCreatorTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.344 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.playback.FileScriptTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.035 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.playback.SahiScriptHTMLAdapterTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.012 sec
    [junit] Testsuite: net.sf.sahi.playback.SahiScriptTest
    [junit] Tests run: 22, Failures: 0, Errors: 0, Time elapsed: 0.145 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.playback.ScriptHandlerTest
    [junit] Tests run: 6, Failures: 0, Errors: 0, Time elapsed: 0.071 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.playback.URLScriptTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.052 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.plugin.DBClientTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.019 sec
    [junit] Testsuite: net.sf.sahi.report.HtmlFormatterTest
    [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 0.078 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.report.HtmlReporterTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.029 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.report.JUnitFormatterTest
    [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 0.051 sec
    [junit] Testsuite: net.sf.sahi.report.JunitReporterTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.02 sec
    [junit] Testsuite: net.sf.sahi.report.LogViewerTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.171 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.report.ReportTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.045 sec
    [junit] Testsuite: net.sf.sahi.report.SahiReporterTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.062 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.request.HttpRequestTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.023 sec
    [junit] Testsuite: net.sf.sahi.request.MultiPartSubRequestTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.017 sec
    [junit] Testsuite: net.sf.sahi.response.HttpFileResponseTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.031 sec
    [junit] Testsuite: net.sf.sahi.response.HttpModifiedResponseTest
    [junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 0.093 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Defaulting to charset iso-8859-1
    [junit]


    [junit] Testsuite: net.sf.sahi.response.MimeTypeTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.018 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.rhino.ScriptRunnerTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 1.48 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] _sahi._cell("AA")
    [junit] document.forms[0]
    [junit] _sahi._cell("AA").parentNode.parentNode
    [junit] _sahi._link("abcd").getElementsByTagName("DIV")[0]
    [junit] _sahi._link("abcd").getElementsByTagName("DIV")[25]
    [junit] _sahi._link("abcd").getElementsByTagName("DIV")[99]
    [junit] _sahi._cell("AA").parentNode.childNodes[22].previousSibling
    [junit] _sahi._cell("AA").document.forms[0].elements[11].value
    [junit] _sahi._checkbox(0, _sahi._near(_sahi._spandiv("To: narayan.raman")))
    [junit] _sahi._textbox(0).value.substring(_sahi._textbox(0).value.indexOf("aa"), 12)
    [junit] _sahi._link(/hi/)
    [junit] _sahi._table("t1").rows[0].cells[1]
    [junit] Step took too long (<cmd>#1)
    [junit]


    [junit] Testsuite: net.sf.sahi.session.SessionTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.029 sec
    [junit] Testsuite: net.sf.sahi.ssl.SSLHelperTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.026 sec
    [junit]
    Standard Output
    [junit] keytool.exe
    [junit] -dname
    [junit] CN=www.sahi.co.in, OU=Sahi
    [junit]


    [junit] Testsuite: net.sf.sahi.stream.filter.HTMLModifierFilterTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.019 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.stream.filter.JSModifierFilterTest
    [junit] Tests run: 13, Failures: 0, Errors: 0, Time elapsed: 0.089 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.test.BrowserLauncherTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.02 sec
    [junit] Testsuite: net.sf.sahi.test.ProcessHelperTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.01 sec
    [junit] Testsuite: net.sf.sahi.test.SahiTestTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.03 sec
    [junit] Testsuite: net.sf.sahi.test.SuiteLoaderTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.057 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.util.FileUtilsTest
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.137 sec
    [junit] Testsuite: net.sf.sahi.util.OSUtilsTest
    [junit] Tests run: 4, Failures: 3, Errors: 1, Time elapsed: 0.074 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi OS properties file = C:\Users\Steven\workspace\Sahi\config\os.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testcase: testIdentifyOS(net.sf.sahi.util.OSUtilsTest): FAILED
    [junit] expected:<xp> but was:<null>
    [junit] junit.framework.ComparisonFailure: expected:<xp> but was:<null>
    [junit] at net.sf.sahi.util.OSUtilsTest.testIdentifyOS(OSUtilsTest.java:33)
    [junit] Testcase: testGetPIDListCommmand(net.sf.sahi.util.OSUtilsTest): FAILED
    [junit] expected:<tasklist /FI "IMAGENAME eq $imageName" /NH /FO TABLE> but was:<null>
    [junit] junit.framework.ComparisonFailure: expected:<tasklist /FI "IMAGENAME eq $imageName" /NH /FO TABLE> but was:<null>
    [junit] at net.sf.sahi.util.OSUtilsTest.testGetPIDListCommmand(OSUtilsTest.java:37)
    [junit] Testcase: testGetPIDKillCommand(net.sf.sahi.util.OSUtilsTest): FAILED
    [junit] expected:<taskkill /PID $pid> but was:<null>
    [junit] junit.framework.ComparisonFailure: expected:<taskkill /PID $pid> but was:<null>
    [junit] at net.sf.sahi.util.OSUtilsTest.testGetPIDKillCommand(OSUtilsTest.java:41)
    [junit] Testcase: testGetPIDListColumnNo(net.sf.sahi.util.OSUtilsTest): Caused an ERROR
    [junit] null
    [junit] java.lang.NumberFormatException: null
    [junit] at java.lang.Integer.parseInt(Unknown Source)
    [junit] at java.lang.Integer.parseInt(Unknown Source)
    [junit] at net.sf.sahi.util.OSUtils.getPIDListColumnNo(OSUtils.java:61)
    [junit] at net.sf.sahi.util.OSUtilsTest.testGetPIDListColumnNo(OSUtilsTest.java:45)
    [junit] Test net.sf.sahi.util.OSUtilsTest FAILED
    [junit] Testsuite: net.sf.sahi.util.SocketPoolTest
    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.028 sec
    [junit] Testsuite: net.sf.sahi.util.URLParserTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.064 sec
    [junit]
    Standard Output
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit] Sahi properties file = C:\Users\Steven\workspace\Sahi\config\sahi.properties
    [junit] Sahi user properties file = C:\Users\Steven\workspace\Sahi\userdata\config\userdata.properties
    [junit]


    [junit] Testsuite: net.sf.sahi.util.UtilsTest
    [junit] Tests run: 12, Failures: 0, Errors: 0, Time elapsed: 0.128 sec
    [junit]
    Standard Output
    [junit] includes/sahi_demo_include.sah
    [junit] http://localhost:9999/_s_/scripts/sahi_demo_include.sah
    [junit]



    BUILD FAILED
    C:\Users\Steven\workspace\Sahi\build.xml:154: The following error occurred while executing this line:
    C:\Users\Steven\workspace\Sahi\build.xml:452: JUnit tests failed. MAKE SURE THAT junit.jar AND log4j.jar ARE PRESENT IN {sahi}/extlib/ FOLDER

    Total time: 32 seconds
  • narayannarayan Administrators
    Which OS are you using? Win 2K or XP?

    The problem is not in the path. It is in OSUtilsTest. Comment out all tests in that for the time being. (Add a dummy passing test to keep junit happy).

    Let me know what you see.

    Regards,
    Narayan
  • I am using windows 7 Ultimate.
    Also, you said to add a dummy test, Should I add this in the OSUtilTest.java or in the ant build file? (could you give me a quick example)
  • narayannarayan Administrators
    Replace content of OSUtilsTest.java with this:

    public class OSUtilsTest extends TestCase {
    public void testDummy() throws Exception {
    }
    }
  • millerKillermillerKiller Members
    edited December 2009
    It worked! Thankyou narayan!
  • globalwormingglobalworming Moderators
    edited October 2011
    Hi narayan

    I'm stuck here with some errors like:
    UtilsTest.java:45: warning: unmappable character for encoding UTF8 
    assertEquals("Elephant", Utils.convertStringToASCII("?l?phant"));
    
    junitlog:
    net.sf.sahi.util.UtilsTest.testConvertStringToASCII caught junit.framework.ComparisonFailure: expected:<E...> but was:<e...>trace: 
    junit.framework.ComparisonFailure: expected:<E...> but was:<e...>
    
    I tried to change the workspaces encoding to US-ASCII, but the errors persist. Do you know what to do? I'm using Eclipse Helios on Kubuntu 11.10

    [Edit] when I skip these tests, it'll stop with:
    myhome/workspace/Sahi/build.xml:441: com.izforge.izpack.compiler.CompilerException: Invalid base directory: /home/wormi/Documents/temp/sahi
    


    Regards
    Wormi
  • Hi Wormi,

    I think you will have to set the encoding to UTF-8 and not US-ASCII.


    Regards,
    dkulkarni
  • globalwormingglobalworming Moderators
    edited October 2011
    Hi _dkulkarni

    the default encoding is UTF-8. and the error says "unmappable character for encoding UTF8". But other encodings (like ISO-8859-1 or UTF-16) wont work either...
    Where do I set the encoding for the ant build? Some other lines state, that I am still using US-ASCII
    Warning: encoding "US-ASCII" not supported, using UTF-8
    Warning:  The encoding 'US-ASCII' is not supported by the Java runtime.
    
  • globalwormingglobalworming Moderators
    edited October 2011
    well...
    i just tried a Sahi build with Eclipse Indigo and Ant Visualization 1.0.0..
    [javac] /home/wormi/workspace/Sahi/build.xml:38: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [junit] Testcase: testConvertStringToASCII(net.sf.sahi.util.UtilsTest):    FAILED
    [junit] expected:<E...> but was:<e...>
    [junit] junit.framework.ComparisonFailure: expected:<E...> but was:<e...>
    [junit]     at net.sf.sahi.util.UtilsTest.testConvertStringToASCII(UtilsTest.java:45)
    [junit] Test net.sf.sahi.util.UtilsTest FAILED
    [junitreport] Warning: encoding "UTF-8" not supported, using UTF-8
    [junitreport] Warning:  The encoding 'UTF-8' is not supported by the Java runtime.
    
    No encoding works... what did u use? Windows-1252? ISCII?
Sign In or Register to comment.