sure it gets pretty intensive the way I set it up so I can reuse everything. All my test cases have a master file I import so when I change environments or screenshot locations I change it in one method and it affects all my test cases.
I’ll edit out our company data below and replace it with “program”
String programName_FilePath = program_FilePath.getProgramNameScreenShotFilePath()
String screenShotPath = programName_FilePath + 'nameForSection\\nameOfThisTest\\'
by importing that method above I can call my method which basically has a hard coded path of where I want to store my screenshots. Then I amend this in the test case with the name of the test and a folder for the suite. So after this I have “screenShotPath” which include the universal path and the name of the test case. I do this in every test case.
next I use the capture driver:
String currentWebDriver = MiscMethods.getCurrentWebDriver()
Then I do this whenever I capture a screenshot (again company data removed).
WebUI.takeScreenshot(screenShotPath + currentWebDriver + ' - 01 name of screen shot.jpg', FailureHandling.OPTIONAL)
so by combining my two strings I end up create all screenshots in a single folder with the webdriver in the name. I start with webdriver so all the chrome ones are together and all the firefoxes etc. I also use a number at the start of each screenshot to keep these in order. though I use the report that gets emailed I can also see that driver in those emails and I like to keep these screenshots in a location I can reference after a run. So I can use them for defects or test artifacts. Here is an example of the out put from some of these.
First the suite, I create a master suite with all tests and then add each of these suite into an all environment suite like this:
Then the screenshots are saved as follows:
That is three tests. Here is one set of three screenshots for a test in both chrome and firefox
Now I could add in a
If I wanted to see it during. Looks like though with the emails it tells you the browser and sends it out per set which is nice. This is mostly for if you want it in the saved screenshots. Which I do.