Skip to main content

Posts

Showing posts with the label java system properties

Working with File Path Separators

Something I learned very recently.  Have you ever written code which involved file path's? If yes then this post might be helpful...Even otherwise knowing something unknown or brushing up concepts known won't hurt - would they? :) So here I go, I have my Selenium Scripts which might run on both Linux and Windows machines. I don't store my test files on a central location which can be accessed over the network/internet, so when my script runs on a Linux machine it would look locally on the linux file system for the test files. Same is the case when I run my tests on Windows.  Here is what I used to do :)  My Initial Approach:  If ( Test_Running_On_Linux ){ return System . getProperty ( "user.dir" ) + "/" + TestProperties . strFilePathPart1 + "/"+ TestProperties.strFilePathPart2; } else if( Test_Running_On_Windows ){ return System . getProperty ( "user.dir" ) + "\\" + TestProperties . strFilePathPa...