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.

Questions about _include

tpdietztpdietz Members
edited November -1 in Sahi - Open Source
I have a couple of questions about the _include() function(?).

I have a couple levels of files (like a top-level test file that includes lower-level files containing various functions). I also have a file in which I keep common utilities. Each of the test files may include the utilities file. I'm noticing that if I view the script from the controller that each time the file is included, all of the code is brought in to the script as well. Is there a way that I can somehow wrap the include so that the code is brought in only once? (like the #if-#endif directives in C++)

I also use block comments for large descriptions, or to comment-out chunks of code that I don't want executing. I have noticed that if I have a file with block comments _included into another file, THEN I use a block comment to comment out
that _include statement, that block comment will actually close after the first closing block comment it encounters in the included file. Is there any way around this, or should I just use line-comments only?


Thanks again.

Tim

Comments

  • narayannarayan Administrators
    Great points:
    1) Right now there is no way you can do the #if primarily because the _include executes as an inplace expansion in the Sahi parser. I will see if there is some way of checking on the proxy side before including.
    2) This is a bug and I think, you will have to live with single line comments in these cases till it gets fixed. Thanks for highlighting.
Sign In or Register to comment.