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.

Sah to Junit

HadanMarvHadanMarv Members
edited November -1 in Sahi - Open Source
Hi,

Is there any way to "translate" sahi script to a junit test case ?
Thanks in adavance,
Regards,

Comments

  • Hi HardanMarv,

    There is no way to translate Sahi script to a junit test case.But you can run the javascripts using junit.

    Regards
    Sumitra
  • Calling the TestRunner class in a JUnit test case ?
    Rewrite the test, or changing sahi.properties (controller.mode=java) and using the interface ?
    Regards,
  • Is there a list of functions that are possible using sahi script but not in Java ?
    I explain why. I still want to convert sahi script to Junit test case to have reporting such as surefire (Maven plugin). So i writed a very basic java code that translate all my sahi script into JUnit Test Case. It's why i ask this question.

    Regards,
    HadanMarv
  • narayannarayan Administrators
    Hi HadanMarv,

    If you want reporting like in JUnit, you can ask Sahi to output the script results as JUnit log files.
    In your ant target, specify

    <report type="junit" logdir="${userdata.dir}/temp/junit"/>

    so that it would look something like this:
        <target name="runfftests">
            <sahi suite="../userdata/scripts/demo/demo.suite"
                    browserType="firefox"
                  baseurl="http://${urlbase}/demo/"
                  sahihost="localhost"
                  sahiport="9999"
                  failureproperty="sahi.failed"
                  haltonfailure="false"
                  threads="6">
                <report type="html"/>
                <report type="junit" logdir="${userdata.dir}/temp/junit"/>
            </sahi>
        </target>
    

    This will create a folder of JUnit logs for the different scripts, which you can plug into any of your JUnit reporting frameworks.

    Regards,
    Narayan
Sign In or Register to comment.