18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Reload exclude_inject.txt file / sahi configuration programmatically
Hello, I have been using a java based framework built around sahi to perform automated tests and test suites as part of the QA for company projects. I have run into a situation when running a set of smoke tests where I need to change the contents of the exclude_inject file i order for a specific test to work. The change breaks the other tests, so I am attempting to modify the exclude_inject file, run the test, then revert back to the original file and continue running other tests.
The problem is that sahi doesn't seem to register the changes that were made to the file, but if I shut it down and start it again to does work.
Is there a way to force sahi to reload the exclude_inject file or to shut it down and start it up again with out ending the test suite run?
I'm sure more information will be required, any help will be greatly appreciated.
Windows 7, IE 8, Build: 2011-07-19.
Please help!!
The problem is that sahi doesn't seem to register the changes that were made to the file, but if I shut it down and start it again to does work.
Is there a way to force sahi to reload the exclude_inject file or to shut it down and start it up again with out ending the test suite run?
I'm sure more information will be required, any help will be greatly appreciated.
Windows 7, IE 8, Build: 2011-07-19.
Please help!!
Comments
there is no way.. but maybe you can use http://sahi.co.in/w/url-mocks to send responses from specific urls into nirvana
regards
Wormi
I have some batch files that I have been trying to use that I got from this forum, however, the shutdown batch file also kills the process that was running the automated tests instead of just sahi.
So, do I need to modify the start up/tear down of tests in any way? Or really any thoughts / insights that could point me in the right direction would be great. I've had a lot of success with Sahi so far and we have a lot of tests designed to use it and it is too late in the project to switch to anything else. Again any thoughts or questions that could get the ball rolling would be great!
you won't get far without modifying the source code of sahi. The exclude_inject file is loaded only once when the first http request is processed. With some experience in java programming you could change the code to a more flexible list but with longer execution time. If you like, I could point you to the right directions in the class files.
Regards
Wormi
fast tutorial:
- use SVN and check out http://sahi.svn.sourceforge.net/viewvc/sahi/trunk/sahi/?pathrev=2265
- set up your IDE and add the scr and test folder to your buildpath
- add all jars in lib and extlib to your buildpath
watch out! the default build output folder must not be "sahi/bin"!!!
- go to the classfile src/net/sf/sahi/config/Configuration.java
- change the function getExclusionList to: Note: this will read a file on every http request, which will slightly increase execution time.
- run build.xml
- use the new sahi version in your deploy dir
when you are facing problems, just search this forum for "building sahi eclipse"
and when you have got some spare time, you can change this function in a way that the file is only processed when the contents have changed.. that should be faster
regards
wormi
[edit]
ok, didnt take long so here it is, use at own risk
Here is the solution I finally came up with: