├── README.md └── SAF ├── .classpath ├── .gitignore ├── .gitignore.txt ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── ExtentReports └── Test Report.html ├── docker-compose.yaml ├── dockerDown.bat ├── dockerUp.bat ├── output.txt ├── pom.xml ├── scaleChrome.bat ├── scaleFirefox.bat ├── src ├── main │ └── java │ │ └── com │ │ ├── browser │ │ ├── Driver.java │ │ ├── DriverManager.java │ │ └── RemoteConfiguration.java │ │ ├── constants │ │ └── Constants.java │ │ ├── listener │ │ ├── AnnotationTransformer.java │ │ ├── ListenerClass.java │ │ └── RetryFailedTestCases.java │ │ ├── pages │ │ ├── BasePage.java │ │ ├── HomePage.java │ │ └── LoginPage.java │ │ ├── reports │ │ ├── ExtentManager.java │ │ ├── ExtentReport.java │ │ └── LogStatus.java │ │ └── utils │ │ ├── DynamicXpath.java │ │ ├── EventCapture.java │ │ ├── ReadPropertyFile.java │ │ ├── SeleniumUtils.java │ │ └── TestUtils.java └── test │ ├── java │ └── com │ │ └── testcases │ │ ├── BaseTest.java │ │ ├── FacilityViewTests.java │ │ └── HomePageTests.java │ └── resources │ ├── TestRunDetails.properties │ ├── chromedriver.exe │ ├── extentreport.xml │ ├── geckodriver.exe │ └── testdata.xlsx ├── test-output ├── Suite │ ├── AQCC Parallel Test.html │ ├── AQCC Parallel Test.xml │ ├── Test.html │ ├── Test.xml │ ├── methods.html │ ├── methods.xml │ └── testng-failed.xml ├── bullet_point.png ├── collapseall.gif ├── emailable-report.html ├── failed.png ├── index.html ├── jquery-1.7.1.min.js ├── junitreports │ ├── TEST-com.testcases.FacilityViewTests.xml │ └── TEST-com.testcases.HomePageTests.xml ├── navigator-bullet.png ├── old │ ├── Suite │ │ ├── AQCC Parallel Test.properties │ │ ├── Test.properties │ │ ├── classes.html │ │ ├── groups.html │ │ ├── index.html │ │ ├── main.html │ │ ├── methods-alphabetical.html │ │ ├── methods-not-run.html │ │ ├── methods.html │ │ ├── methods.properties │ │ ├── reporter-output.html │ │ ├── testng.xml.html │ │ └── toc.html │ └── index.html ├── passed.png ├── skipped.png ├── testng-failed.xml ├── testng-reports.css ├── testng-reports.js ├── testng-results.xml └── testng.css ├── testng.xml ├── zaleniumDown.bat └── zaleniumUp.bat /README.md: -------------------------------------------------------------------------------- 1 | # MavenTestNG 2 | 3 | Features Supported by Framework : 4 | 1. Parallel execution with multiple browsers. 5 | 2. Capability to run in docker with selenium grid 6 | 3. Capability to run in Zalenium. 7 | 4. Data driven tests from Excel using testng dataprovider. 8 | 5. Integrated with Jenkins effortlessly. 9 | 6. Extent reporting which works in parallel runs. 10 | 11 | Other Details: 12 | An simple robust framework for selenium build with java. It will generate the extent report with the screenshots appended to the report. 13 | Easily customisable according to an project need from config.properties. 14 | 15 | Test Cases Run Mode can be selected easily from Excel. 16 | 17 | TestData from the excel sheet is fetched with the help of dataprovider and storing it in hashmap for easier processing. 18 | 19 | Annotation transformer helps in setting the annotations for the test cases at run time including the ability to re-run the failed scripts 20 | 21 | Easily usable framework with all the reusable methods were stored inside com.utils package 22 | 23 | How to use this framework? 24 | 1. Clone the repository to your workspace. 25 | 2. Open the testdata.xlsx under the src/test/resources folder 26 | 3. In the RunManager sheet -->Choose the test cases you want to run by choosing yes 27 | 4. In the testdata sheet --->Choose the test data you want to pass to the testcase from excel sheet. 28 | 5. The data from the excel sheet will be passed to the test method as a hashtable. 29 | 6. Run the testng.xml file. You can even run as mvn test which will trigger the testng.xml 30 | 31 | How the framework works? 32 | 33 | 1. AnnotationTransformer class which implements IAnnotationTransformer is reponsible for reading the data from RunManager sheet in testdata.xlsx. It sets the annotation of the test methods like description,enabled, priority, dataprovider values read from the excel dynamically. 34 | 35 | Things to note : Test name in the first column of the excel sheet should match with atleast an @Test available in test classes mentioned in the testng.xml 36 | 37 | All the tests will have the same dataprovider in the TestUtils class. For example the test1 in RunManager sheet of testdata.xlsx will take the data from TestData sheet which have row where the testname is test1. If there are multiple rows with test1 as test name , framework will consider it as this as multiple iterations for a test case. 38 | 39 | How to run my scripts in local? 40 | 1. Open the TestRunDetails.properties file under src/test/resources and change the run mode to local. 41 | 42 | How to run my scripts in Docker which is hosted in my local system? 43 | 1. Open the TestRunDetails.properties file under src/test/resources and change the run mode to remote and RemoteMode as Selenium or Zalenium. 44 | 45 | How to run my scripts in Docker which is hosted in some system connected in the same network in office? 46 | 1. Open the TestRunDetails.properties file under src/test/resources and change the RemoteUrl to the ipaddress. So your remote URL should look like http://ipaddressofthemachine:4444/wd/hub 47 | 48 | To get trainings on how to create this framework from scratch or to get recordings on sessions , contact mech.amuthansakthivel@gmail.com 49 | Please feel free to raise issues/PR for improving the framework. 50 | -------------------------------------------------------------------------------- /SAF/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SAF/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /SAF/.gitignore.txt: -------------------------------------------------------------------------------- 1 | *.html 2 | *.png -------------------------------------------------------------------------------- /SAF/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SAF 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /SAF/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding//src/test/resources=UTF-8 5 | encoding/=UTF-8 6 | -------------------------------------------------------------------------------- /SAF/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.release=disabled 6 | org.eclipse.jdt.core.compiler.source=1.8 7 | -------------------------------------------------------------------------------- /SAF/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /SAF/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | # To execute this docker-compose yml file use `docker-compose -f up` 2 | # Add the `-d` flag at the end for detached execution 3 | version: "3" 4 | services: 5 | selenium-hub: 6 | image: selenium/hub:latest 7 | container_name: selenium-hub 8 | ports: 9 | - "4444:4444" 10 | chrome: 11 | image: selenium/node-chrome-debug:latest 12 | volumes: 13 | - /dev/shm:/dev/shm 14 | depends_on: 15 | - selenium-hub 16 | environment: 17 | - HUB_HOST=selenium-hub 18 | - HUB_PORT=4444 19 | firefox: 20 | image: selenium/node-firefox-debug:latest 21 | volumes: 22 | - /dev/shm:/dev/shm 23 | depends_on: 24 | - selenium-hub 25 | environment: 26 | - HUB_HOST=selenium-hub 27 | - HUB_PORT=4444 -------------------------------------------------------------------------------- /SAF/dockerDown.bat: -------------------------------------------------------------------------------- 1 | docker-compose down -------------------------------------------------------------------------------- /SAF/dockerUp.bat: -------------------------------------------------------------------------------- 1 | docker-compose -f docker-compose.yaml up >>output.txt -------------------------------------------------------------------------------- /SAF/output.txt: -------------------------------------------------------------------------------- 1 | Docker binary already present, will use that one. 2 | Docker version 18.09.0, build 4d60db4 3 | -- LOG 07:22:08:222332600 Ensuring docker works... 4 | -- LOG 07:22:08:292692100 Ensuring docker-selenium is available... 5 | haveged: haveged starting up 6 | Copying files for Dashboard... 7 | cp: cannot create regular file '/home/seluser/videos/dashboard.html': No such file or directory 8 | Starting Nginx reverse proxy... 9 | Starting Selenium Hub... 10 | ...07:22:09.444 [main] INFO o.o.grid.selenium.GridLauncherV3 - Selenium server version: 3.141.59, revision: unknown 11 | 07:22:09.520 [main] INFO o.o.grid.selenium.GridLauncherV3 - Launching Selenium Grid hub on port 4445 12 | .07:22:09.828 [main] INFO d.z.e.z.c.DockerContainerClient - About to clean up any left over DockerSelenium containers created by Zalenium 13 | ....07:22:10.554 [AutoStartProxyPoolPoller] INFO d.z.e.z.proxy.AutoStartProxySet - Starting poller. 14 | .07:22:11.000 [main] INFO d.z.ep.zalenium.aspect.HubAspect - Registering custom Zalenium servlets 15 | .07:22:11.117 [main] INFO org.openqa.grid.web.Hub - Selenium Grid hub is up and running 16 | 07:22:11.117 [main] INFO org.openqa.grid.web.Hub - Nodes should register to http://172.17.0.2:4445/grid/register/ 17 | 07:22:11.117 [main] INFO org.openqa.grid.web.Hub - Clients should connect to http://172.17.0.2:4445/wd/hub 18 | Selenium Hub started! 19 | Sauce Labs not enabled... 20 | Browser Stack not enabled... 21 | TestingBot not enabled... 22 | CBT not enabled... 23 | LambdaTest not enabled... 24 | Zalenium is now ready! 25 | *************************************** Data Processing Agreement *************************************** 26 | By using this software you agree that the following non-PII (non personally identifiable information) 27 | data will be collected, processed and used by Zalando SE for the purpose of improving our test 28 | infrastructure tools. Anonymisation with respect of the IP address means that only the first two octets 29 | of the IP address are collected. 30 | 31 | See the complete license at https://github.com/zalando/zalenium/blob/master/LICENSE.md 32 | *************************************** Data Processing Agreement *************************************** 33 | 07:22:18.884 [Thread-10] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.3:40000 34 | 07:22:19.783 [Thread-11] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.4:40001 35 | 07:22:27.133 [qtp109069556-24] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 36 | 07:22:27.135 [qtp109069556-20] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 37 | 07:22:27.136 [qtp109069556-21] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 38 | 07:22:27.147 [qtp109069556-24] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 39 | 07:22:27.149 [qtp109069556-20] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 40 | 07:22:27.151 [qtp109069556-21] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 41 | 07:22:27.157 [http://172.17.0.3:40000] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=e508cb04-1727-4bc9-a8f8-1e182b0b247c, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 42 | 07:22:27.166 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key 4f04a58b-ba86-4266-805c-7c6a66a80574 assigned to remote (http://172.17.0.3:40000) after 0 seconds (145 ms). 43 | 07:22:27.171 [http://172.17.0.4:40001] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=0b3d08f0-c365-4a19-8080-fe40035113a4, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 44 | 07:22:27.173 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key 0daa0eab-c0c7-431a-8027-744aaaea4c5c assigned to remote (http://172.17.0.4:40001) after 0 seconds (151 ms). 45 | 07:22:39.432 [Thread-15] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.5:40002 46 | 07:22:39.437 [http://172.17.0.5:40002] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=76a6bd6d-f4b2-4688-a3f4-da467aaa050f, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 47 | 07:22:39.445 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key a4b7785d-25c0-4290-a4a5-cbfc19b2b8ce assigned to remote (http://172.17.0.5:40002) after 12 seconds (12422 ms). 48 | Docker binary already present, will use that one. 49 | Docker version 18.09.0, build 4d60db4 50 | -- LOG 07:33:19:736348800 Ensuring docker works... 51 | -- LOG 07:33:19:836306300 Ensuring docker-selenium is available... 52 | haveged: haveged starting up 53 | Copying files for Dashboard... 54 | Starting Nginx reverse proxy... 55 | Starting Selenium Hub... 56 | ...07:33:21.102 [main] INFO o.o.grid.selenium.GridLauncherV3 - Selenium server version: 3.141.59, revision: unknown 57 | 07:33:21.180 [main] INFO o.o.grid.selenium.GridLauncherV3 - Launching Selenium Grid hub on port 4445 58 | .07:33:21.500 [main] INFO d.z.e.z.c.DockerContainerClient - About to clean up any left over DockerSelenium containers created by Zalenium 59 | ...07:33:22.184 [AutoStartProxyPoolPoller] INFO d.z.e.z.proxy.AutoStartProxySet - Starting poller. 60 | ..07:33:22.663 [main] INFO d.z.ep.zalenium.aspect.HubAspect - Registering custom Zalenium servlets 61 | 07:33:22.740 [main] INFO org.openqa.grid.web.Hub - Selenium Grid hub is up and running 62 | 07:33:22.741 [main] INFO org.openqa.grid.web.Hub - Nodes should register to http://172.17.0.2:4445/grid/register/ 63 | 07:33:22.741 [main] INFO org.openqa.grid.web.Hub - Clients should connect to http://172.17.0.2:4445/wd/hub 64 | Selenium Hub started! 65 | Sauce Labs not enabled... 66 | Browser Stack not enabled... 67 | TestingBot not enabled... 68 | CBT not enabled... 69 | LambdaTest not enabled... 70 | Zalenium is now ready! 71 | *************************************** Data Processing Agreement *************************************** 72 | By using this software you agree that the following non-PII (non personally identifiable information) 73 | data will be collected, processed and used by Zalando SE for the purpose of improving our test 74 | infrastructure tools. Anonymisation with respect of the IP address means that only the first two octets 75 | of the IP address are collected. 76 | 77 | See the complete license at https://github.com/zalando/zalenium/blob/master/LICENSE.md 78 | *************************************** Data Processing Agreement *************************************** 79 | 07:33:29.625 [Thread-10] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.3:40000 80 | 07:33:30.791 [Thread-11] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.4:40001 81 | 07:33:38.340 [qtp109069556-20] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 82 | 07:33:38.342 [qtp109069556-24] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 83 | 07:33:38.343 [qtp109069556-17] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 84 | 07:33:38.357 [qtp109069556-20] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 85 | 07:33:38.360 [qtp109069556-24] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 86 | 07:33:38.360 [qtp109069556-17] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 87 | 07:33:38.366 [http://172.17.0.3:40000] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=b4e49054-2cae-4252-9c25-7f9cf23a7855, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 88 | 07:33:38.399 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key e50d5bae-dff9-42de-80aa-bc76ddf156fa assigned to remote (http://172.17.0.3:40000) after 0 seconds (177 ms). 89 | 07:33:38.424 [http://172.17.0.4:40001] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=1ee7fcf8-d48e-4981-a1f2-14454de30572, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 90 | 07:33:38.437 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key e76b7319-e2ee-40f5-8897-6903c82d3078 assigned to remote (http://172.17.0.4:40001) after 0 seconds (214 ms). 91 | 07:33:51.461 [Thread-16] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.5:40002 92 | 07:33:51.465 [http://172.17.0.5:40002] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=137b90ae-8f94-4d3e-b5c1-e526766605bc, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 93 | 07:33:51.468 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key 044992b0-a8f6-4c41-8808-1c54bdd187e1 assigned to remote (http://172.17.0.5:40002) after 13 seconds (13246 ms). 94 | 07:34:10.023 [Thread-18] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.6:40003 95 | Trapped SIGTERM/SIGINT so shutting down Zalenium gracefully... 96 | Stopping Hub... 97 | *************************************** Data Processing Agreement *************************************** 98 | By using this software you agree that the following non-PII (non personally identifiable information) 99 | data will be collected, processed and used by Zalando SE for the purpose of improving our test 100 | infrastructure tools. Anonymisation with respect of the IP address means that only the first two octets 101 | of the IP address are collected. 102 | 103 | See the complete license at https://github.com/zalando/zalenium/blob/master/LICENSE.md 104 | *************************************** Data Processing Agreement *************************************** 105 | 07:34:18.914 [DockerContainerClient shutdown hook] INFO d.z.e.z.c.DockerContainerClient - About to clean up any left over DockerSelenium containers created by Zalenium 106 | 07:34:18.955 [Saving dashboard.] INFO d.z.ep.zalenium.dashboard.Dashboard - Saving dashboard... 107 | Docker binary already present, will use that one. 108 | Docker version 18.09.0, build 4d60db4 109 | -- LOG 07:38:40:406444100 Ensuring docker works... 110 | -- LOG 07:38:40:516488900 Ensuring docker-selenium is available... 111 | haveged: haveged starting up 112 | Copying files for Dashboard... 113 | Starting Nginx reverse proxy... 114 | Starting Selenium Hub... 115 | ......07:38:42.738 [main] INFO o.o.grid.selenium.GridLauncherV3 - Selenium server version: 3.141.59, revision: unknown 116 | 07:38:42.835 [main] INFO o.o.grid.selenium.GridLauncherV3 - Launching Selenium Grid hub on port 4445 117 | ...07:38:43.326 [main] INFO d.z.e.z.c.DockerContainerClient - About to clean up any left over DockerSelenium containers created by Zalenium 118 | ...07:38:44.064 [AutoStartProxyPoolPoller] INFO d.z.e.z.proxy.AutoStartProxySet - Starting poller. 119 | ...07:38:44.747 [main] INFO d.z.ep.zalenium.aspect.HubAspect - Registering custom Zalenium servlets 120 | 07:38:44.866 [main] INFO org.openqa.grid.web.Hub - Selenium Grid hub is up and running 121 | 07:38:44.866 [main] INFO org.openqa.grid.web.Hub - Nodes should register to http://172.17.0.2:4445/grid/register/ 122 | 07:38:44.866 [main] INFO org.openqa.grid.web.Hub - Clients should connect to http://172.17.0.2:4445/wd/hub 123 | Selenium Hub started! 124 | Sauce Labs not enabled... 125 | Browser Stack not enabled... 126 | TestingBot not enabled... 127 | CBT not enabled... 128 | LambdaTest not enabled... 129 | Zalenium is now ready! 130 | *************************************** Data Processing Agreement *************************************** 131 | By using this software you agree that the following non-PII (non personally identifiable information) 132 | data will be collected, processed and used by Zalando SE for the purpose of improving our test 133 | infrastructure tools. Anonymisation with respect of the IP address means that only the first two octets 134 | of the IP address are collected. 135 | 136 | See the complete license at https://github.com/zalando/zalenium/blob/master/LICENSE.md 137 | *************************************** Data Processing Agreement *************************************** 138 | 07:38:52.939 [Thread-10] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.3:40000 139 | 07:38:53.371 [Thread-11] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.4:40001 140 | 07:38:59.136 [qtp109069556-19] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 141 | 07:38:59.137 [qtp109069556-21] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 142 | 07:38:59.139 [qtp109069556-20] INFO o.o.g.w.s.handler.RequestHandler - Got a request to create a new session: Capabilities {browserName: chrome, version: } 143 | 07:38:59.151 [qtp109069556-19] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 144 | 07:38:59.152 [qtp109069556-21] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 145 | 07:38:59.152 [qtp109069556-20] INFO d.z.e.z.registry.ZaleniumRegistry - Adding sessionRequest for {browserName=chrome, version=} 146 | 07:38:59.155 [http://172.17.0.3:40000] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=a75ccc77-a35e-4f82-a597-1997a45107a1, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 147 | 07:38:59.158 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key 634fcf00-8e7f-4444-8b86-a70e829f0ea5 assigned to remote (http://172.17.0.3:40000) after 0 seconds (145 ms). 148 | 07:38:59.167 [http://172.17.0.4:40001] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=a0106a1b-d6f8-4a51-bd42-7dd4e69bf322, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 149 | 07:38:59.168 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key e00a5445-a56a-4a45-9b90-8fc8e9e8f701 assigned to remote (http://172.17.0.4:40001) after 0 seconds (157 ms). 150 | 07:39:11.172 [Thread-15] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.5:40002 151 | 07:39:11.176 [http://172.17.0.5:40002] INFO org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {server:CONFIG_UUID=ce5aae8f-44ef-43e0-9157-0c6402ff1918, seleniumProtocol=WebDriver, zal:tz=Europe/Berlin, version=78.0.3904.87, platform=LINUX, acceptSslCerts=true, zal:screenResolution=1920x1080, zal:screen-resolution=1920x1080, browserName=chrome, zal:resolution=1920x1080, maxInstances=1, platformName=LINUX} 152 | 07:39:11.186 [Matcher thread] INFO d.z.e.z.registry.ZaleniumRegistry - Test session with internal key abfc5352-c054-4a06-acf1-ab4a6ea36fd5 assigned to remote (http://172.17.0.5:40002) after 12 seconds (12173 ms). 153 | 07:41:46.175 [Thread-17] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.3:40003 154 | 07:41:54.739 [Thread-18] INFO d.z.e.z.registry.ZaleniumRegistry - Registered a node http://172.17.0.4:40004 155 | -------------------------------------------------------------------------------- /SAF/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 001 6 | SeleniumCodingChallenge2MMTRupam 7 | 0.0.1-SNAPSHOT 8 | SeleniumCodingChallenge2MMTRupam 9 | 10 | 11 | 12 | 13 | maven-compiler-plugin 14 | 3.3 15 | 16 | 1.8 17 | 1.8 18 | 19 | 20 | 21 | org.apache.maven.plugins 22 | maven-surefire-plugin 23 | 2.18.1 24 | 25 | 0 26 | 27 | testng.xml 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | UTF-8 36 | 1.6 37 | 1.6 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.testng 45 | testng 46 | 6.14.3 47 | compile 48 | 49 | 50 | 51 | io.github.bonigarcia 52 | webdrivermanager 53 | 3.7.1 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.seleniumhq.selenium 62 | selenium-java 63 | 3.141.59 64 | 65 | 66 | 67 | org.apache.directory.studio 68 | org.apache.commons.io 69 | 2.4 70 | 71 | 72 | 73 | 74 | org.apache.poi 75 | poi 76 | 3.16-beta2 77 | 78 | 79 | 80 | 81 | org.apache.poi 82 | poi-ooxml 83 | 3.9 84 | 85 | 86 | org.apache.poi 87 | poi-ooxml-schemas 88 | 3.9 89 | 90 | 91 | org.apache.poi 92 | poi-scratchpad 93 | 3.9 94 | 95 | 96 | org.apache.poi 97 | ooxml-schemas 98 | 1.1 99 | 100 | 101 | 102 | org.apache.poi 103 | openxml4j 104 | 1.0-beta 105 | 106 | 107 | org.apache.poi 108 | poi 109 | 3.9 110 | 111 | 112 | org.apache.poi 113 | poi-ooxml 114 | 3.9 115 | 116 | 117 | org.apache.poi 118 | poi-ooxml-schemas 119 | 3.9 120 | 121 | 122 | org.apache.poi 123 | poi-scratchpad 124 | 3.9 125 | 126 | 127 | org.apache.poi 128 | ooxml-schemas 129 | 1.1 130 | 131 | 132 | 133 | org.apache.poi 134 | openxml4j 135 | 1.0-beta 136 | 137 | 138 | 139 | org.apache.commons 140 | commons-email 141 | 1.5 142 | 143 | 144 | 145 | javax.mail 146 | javax.mail-api 147 | 1.6.0 148 | 149 | 150 | 151 | com.relevantcodes 152 | extentreports 153 | 2.41.2 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /SAF/scaleChrome.bat: -------------------------------------------------------------------------------- 1 | docker-compose scale chrome=5 -------------------------------------------------------------------------------- /SAF/scaleFirefox.bat: -------------------------------------------------------------------------------- 1 | docker-compose scale firefox=5 -------------------------------------------------------------------------------- /SAF/src/main/java/com/browser/Driver.java: -------------------------------------------------------------------------------- 1 | package com.browser; 2 | 3 | import java.net.MalformedURLException; 4 | import java.net.URL; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import org.openqa.selenium.Platform; 8 | import org.openqa.selenium.WebDriver; 9 | import org.openqa.selenium.chrome.ChromeDriver; 10 | import org.openqa.selenium.firefox.FirefoxDriver; 11 | import org.openqa.selenium.remote.DesiredCapabilities; 12 | import org.openqa.selenium.remote.RemoteWebDriver; 13 | import org.openqa.selenium.support.events.EventFiringWebDriver; 14 | 15 | import com.constants.Constants; 16 | import com.reports.LogStatus; 17 | import com.utils.EventCapture; 18 | import com.utils.ReadPropertyFile; 19 | 20 | import io.github.bonigarcia.wdm.WebDriverManager; 21 | 22 | 23 | /** 24 | * 25 | * @author asakthiv 26 | * Driver class is used to start browsers based on the property file input. 27 | * User gets the option to work on firefox and chrome browser. 28 | * Private constructor to avoid external initialisation - SingletonPattern is achieved 29 | */ 30 | 31 | public class Driver { 32 | 33 | 34 | 35 | public WebDriver driver=null; 36 | public DesiredCapabilities capability; 37 | 38 | private Driver() throws MalformedURLException 39 | { 40 | if(ReadPropertyFile.get("RunMode").equalsIgnoreCase("local")) { 41 | startBrowserForLocal(); 42 | } 43 | else if(ReadPropertyFile.get("RunMode").equalsIgnoreCase("Remote")) 44 | { 45 | startBrowserForRemote(); 46 | } 47 | else { 48 | try { 49 | throw new Exception("Please set up the run mode properly in TestRunDetails.properties"); 50 | } catch (Exception e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | 55 | driver.manage().window().maximize(); 56 | driver.manage().timeouts().implicitlyWait(Integer.parseInt(ReadPropertyFile.get("WaitTime")), TimeUnit.SECONDS); 57 | EventHandlerInit(); 58 | driver.get(ReadPropertyFile.get("url")); 59 | driver.manage().deleteAllCookies(); 60 | DriverManager.setWebDriver(driver); 61 | } 62 | 63 | private void startBrowserForLocal() { 64 | String browser=ReadPropertyFile.get("Browser"); 65 | try { 66 | if(browser.equalsIgnoreCase("chrome")) { 67 | //WebDriverManager.chromedriver().setup(); //WebDriverManager some time wont work because of proxy issues 68 | System.setProperty("webdriver.chrome.driver", Constants.CHROMEDRIVERPATH); 69 | driver=new ChromeDriver(); 70 | } 71 | else if(browser.equalsIgnoreCase("firefox")) 72 | { 73 | //WebDriverManager.firefoxdriver().setup(); //WebDriverManager some time wont work because of proxy issues 74 | System.setProperty("webdriver.gecko.driver", Constants.GECKODRIVERPATH); 75 | System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE,"true"); 76 | System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"C:\\temp\\logs.txt"); 77 | driver= new FirefoxDriver(); 78 | } 79 | } 80 | catch (Exception e) { 81 | LogStatus.fail(e); 82 | } 83 | } 84 | 85 | private void startBrowserForRemote() throws MalformedURLException { 86 | String browser=ReadPropertyFile.get("Browser"); 87 | switch(browser){ 88 | 89 | case "chrome": 90 | capability = DesiredCapabilities.chrome(); 91 | capability.setBrowserName("chrome"); 92 | capability.setPlatform(Platform.ANY); 93 | driver=new RemoteWebDriver(new URL(ReadPropertyFile.get("RemoteURL")),capability); 94 | break; 95 | case "firefox": 96 | capability = DesiredCapabilities.firefox(); 97 | capability.setBrowserName("firefox"); 98 | capability.setPlatform(Platform.ANY); 99 | driver=new RemoteWebDriver(new URL(ReadPropertyFile.get("RemoteURL")),capability); 100 | break; 101 | default: 102 | capability = DesiredCapabilities.firefox(); 103 | capability.setBrowserName("firefox"); 104 | capability.setPlatform(Platform.ANY); 105 | driver=new RemoteWebDriver(new URL(ReadPropertyFile.get("RemoteURL")),capability); 106 | break; 107 | } 108 | } 109 | 110 | public static void initialize() { 111 | if(DriverManager.getDriver()==null) 112 | try { 113 | new Driver(); 114 | } 115 | catch(Exception e) { 116 | 117 | } 118 | } 119 | 120 | public static void quit() { 121 | if(DriverManager.getDriver()!=null) { 122 | DriverManager.getDriver().quit(); 123 | } 124 | } 125 | 126 | 127 | /* 128 | * Used to listen to driver events 129 | */ 130 | 131 | private void EventHandlerInit() { 132 | EventFiringWebDriver eventhandle = new EventFiringWebDriver(driver); 133 | EventCapture capture= new EventCapture(); 134 | eventhandle.register(capture); 135 | driver=eventhandle; 136 | } 137 | 138 | 139 | 140 | } 141 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/browser/DriverManager.java: -------------------------------------------------------------------------------- 1 | package com.browser; 2 | 3 | import org.openqa.selenium.WebDriver; 4 | 5 | public class DriverManager { 6 | 7 | public static ThreadLocal dr = new ThreadLocal(); 8 | 9 | public static WebDriver getDriver() { 10 | 11 | return dr.get(); 12 | 13 | } 14 | 15 | public static void setWebDriver(WebDriver driver) { 16 | 17 | dr.set(driver); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/browser/RemoteConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.browser; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileReader; 7 | 8 | import org.testng.SkipException; 9 | 10 | import com.utils.ReadPropertyFile; 11 | 12 | public class RemoteConfiguration { 13 | 14 | 15 | 16 | public static void setUpRemote() { 17 | 18 | Runtime runtime=Runtime.getRuntime(); 19 | if(ReadPropertyFile.get("RemoteMode").equalsIgnoreCase("Selenium")){ 20 | try { 21 | runtime.exec("cmd /c start dockerUp.bat"); 22 | verifyDockerIsUp(); 23 | runtime.exec("cmd /c start scaleChrome.bat"); 24 | Thread.sleep(10000); 25 | runtime.exec("cmd /c start scaleFirefox.bat"); 26 | Thread.sleep(10000); 27 | runtime.exec("taskkill /f /im cmd.exe") ; 28 | } 29 | catch(Exception e) { 30 | e.printStackTrace(); 31 | } 32 | } 33 | else if(ReadPropertyFile.get("RemoteMode").equalsIgnoreCase("Zalenium")){ 34 | try { 35 | runtime.exec("cmd /c start zaleniumUp.bat"); 36 | verifyDockerIsUp(); 37 | Thread.sleep(10000); 38 | } 39 | catch(Exception e ) { 40 | 41 | } 42 | } 43 | else { 44 | try { 45 | throw new Exception("Please set up the remote mode in TestRunDetails.properties correctly. " 46 | + "Selenium or Zalenium is the options available"); 47 | } catch (Exception e) { 48 | e.printStackTrace(); 49 | } 50 | } 51 | } 52 | 53 | 54 | 55 | private static void verifyDockerIsUp() throws FileNotFoundException, Exception { 56 | Thread.sleep(10000); 57 | boolean flag=false; 58 | String file="output.txt"; 59 | BufferedReader reader= new BufferedReader(new FileReader(file)); 60 | String currentline=reader.readLine(); 61 | 62 | while(currentline!=null) { 63 | if((currentline.contains("The node is registered to the hub and ready to use"))||(currentline.contains("Zalenium is now ready!"))) { 64 | flag=true; 65 | break; 66 | } 67 | currentline=reader.readLine(); 68 | } 69 | reader.close(); 70 | 71 | if(!flag) { 72 | throw new SkipException("Docker have not started. Please try again or try manually."); 73 | } 74 | } 75 | 76 | 77 | 78 | public static void shutDownRemote() { 79 | Runtime runtime=Runtime.getRuntime(); 80 | if(ReadPropertyFile.get("RemoteMode").equalsIgnoreCase("Selenium")){ 81 | try { 82 | runtime.exec("cmd /c start dockerDown.bat"); 83 | } 84 | catch(Exception e) { 85 | e.printStackTrace(); 86 | } 87 | } 88 | else if(ReadPropertyFile.get("RemoteMode").equalsIgnoreCase("Zalenium")){ 89 | try { 90 | runtime.exec("cmd /c start zaleniumDown.bat"); 91 | //verifyDockerIsUp(); 92 | Thread.sleep(10000); 93 | } 94 | catch(Exception e ) { 95 | 96 | } 97 | } 98 | else { 99 | try { 100 | throw new Exception("Please set up the remote mode in TestRunDetails.properties correctly. " 101 | + "Selenium or Zalenium is the options available"); 102 | } catch (Exception e) { 103 | e.printStackTrace(); 104 | } 105 | } 106 | File file=new File("output.txt"); 107 | if(file.exists()) { 108 | System.out.println("file deleted"); 109 | file.delete(); 110 | } 111 | try { 112 | Thread.sleep(20000); 113 | runtime.exec("taskkill /f /im cmd.exe") ; 114 | } 115 | catch(Exception e) { 116 | 117 | } 118 | } 119 | 120 | 121 | 122 | } 123 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/constants/Constants.java: -------------------------------------------------------------------------------- 1 | package com.constants; 2 | 3 | public class Constants { 4 | 5 | public static final String PROJECTPATH=System.getProperty("user.dir"); 6 | public static final String CHROMEDRIVERPATH = System.getProperty("user.dir")+"\\src\\test\\resources\\chromedriver.exe"; 7 | public static final String GECKODRIVERPATH = System.getProperty("user.dir")+"\\src\\test\\resources\\geckodriver.exe"; 8 | public static final String RESOURCESPATH = System.getProperty("user.dir")+"\\src\\test\\resources"; 9 | public static final String EXTENTCONFIGPATH = System.getProperty("user.dir")+"\\src\\test\\resources\\extentreport.xml"; 10 | public static final int EXPLICITWAIT=10; 11 | public static final String TESTDATASHEETNAME= "TestData"; 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/listener/AnnotationTransformer.java: -------------------------------------------------------------------------------- 1 | package com.listener; 2 | 3 | import java.lang.reflect.Constructor; 4 | import java.lang.reflect.Method; 5 | 6 | import org.testng.IAnnotationTransformer; 7 | import org.testng.annotations.ITestAnnotation; 8 | 9 | import com.utils.TestUtils; 10 | 11 | public class AnnotationTransformer implements IAnnotationTransformer{ 12 | int count=0; 13 | 14 | @Override 15 | public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) { 16 | 17 | 18 | try { 19 | if(count==0) { 20 | TestUtils.getRunStatus(); 21 | } 22 | } catch (Exception e) { 23 | e.printStackTrace(); 24 | } 25 | 26 | for(int i=0;i winHandles = DriverManager.getDriver().getWindowHandles(); 78 | for(String temp:winHandles) { 79 | if(!temp.equalsIgnoreCase(parentWinHandle)) { 80 | DriverManager.getDriver().switchTo().window(temp); 81 | LogStatus.pass("Switched to new Window : " +temp); 82 | } 83 | } 84 | } 85 | 86 | public static void selectByValue(WebElement element,String text) { 87 | new Select(element).selectByValue(text); 88 | LogStatus.pass("Selected dropdown " +element + "with value " +text); 89 | } 90 | 91 | public static void selectByVisibleText(WebElement element,String text) { 92 | new Select(element).selectByVisibleText(text); 93 | LogStatus.pass("Selected dropdown " +element + "with text " +text); 94 | } 95 | 96 | public static void selectByIndex(WebElement element,int index) { 97 | new Select(element).selectByIndex(index); 98 | LogStatus.pass("Selected dropdown " +element + "with index " +index); 99 | } 100 | 101 | 102 | 103 | } 104 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/pages/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import org.openqa.selenium.By; 4 | import org.openqa.selenium.WebElement; 5 | import org.openqa.selenium.support.FindBy; 6 | import org.openqa.selenium.support.PageFactory; 7 | 8 | import com.browser.Driver; 9 | import com.browser.DriverManager; 10 | import com.relevantcodes.extentreports.LogStatus; 11 | import com.reports.ExtentReport; 12 | import com.utils.DynamicXpath; 13 | import com.utils.TestUtils; 14 | 15 | public class HomePage extends BasePage { 16 | 17 | @FindBy(xpath="//span[text()='Global View']") 18 | WebElement lnk_globalview; 19 | 20 | @FindBy(xpath="//span[text()='Facility View']") 21 | WebElement lnk_facilityview; 22 | 23 | @FindBy(xpath="//span[text()='Movement']") 24 | WebElement lnk_movement; 25 | 26 | @FindBy(xpath="//span[text()='Account View']") 27 | WebElement lnk_accountview; 28 | 29 | @FindBy(xpath="//a[@data-toggle='dropdown']/div[text()='asakthiv']") 30 | WebElement lnk_asakthiv; 31 | 32 | @FindBy(xpath="//a[text()='Logout']") 33 | WebElement lnk_logout; 34 | 35 | @FindBy(xpath="//button[@type='submit']") 36 | WebElement btn_logoutonframe; 37 | 38 | @FindBy(xpath="//span[text()='EXCEPTION PER COUNTRY FOR']") 39 | WebElement txt_exceptionpercountryfor; 40 | 41 | 42 | 43 | @FindBy(name="q") 44 | WebElement searchBox; 45 | 46 | 47 | 48 | public static String txtbox_searchbox="//*[@name='%replaceable%']"; 49 | 50 | 51 | 52 | 53 | 54 | public void logout() { 55 | String a="abcd"; 56 | click(lnk_asakthiv); 57 | click(lnk_logout); 58 | click(btn_logoutonframe); 59 | 60 | //clicking on dynamic element 61 | searchBox.findElement(By.xpath("/a/span[@id='"+a+"']")).click(); 62 | } 63 | 64 | 65 | 66 | 67 | public void searchOnGoogle(String value) { 68 | //SeleniumUtils.sendkeys(searchBox, "automation"); 69 | String newxpath=DynamicXpath.get(txtbox_searchbox, "q"); 70 | sendkeys(DriverManager.getDriver().findElement(By.xpath(newxpath)),value); 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/pages/LoginPage.java: -------------------------------------------------------------------------------- 1 | package com.pages; 2 | 3 | import org.openqa.selenium.WebElement; 4 | import org.openqa.selenium.support.FindBy; 5 | import org.openqa.selenium.support.PageFactory; 6 | 7 | import com.browser.Driver; 8 | import com.listener.ListenerClass; 9 | import com.reports.ExtentReport; 10 | import com.utils.ReadPropertyFile; 11 | 12 | import com.utils.TestUtils; 13 | 14 | public class LoginPage extends BasePage{ 15 | 16 | @FindBy(name="username") 17 | WebElement txtbox_username; 18 | 19 | @FindBy(name="password") 20 | WebElement txtbox_password; 21 | 22 | @FindBy(xpath="//*[text()='LOGIN']") 23 | WebElement btn_login; 24 | 25 | 26 | 27 | public HomePage login() { 28 | sendkeys(txtbox_username,TestUtils.getCellContent("TestData", ListenerClass.getTestcaseName(), "username")); 29 | sendkeys(txtbox_password,TestUtils.getCellContent("TestData", ListenerClass.getTestcaseName(), "password")); 30 | click(btn_login); 31 | return new HomePage(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/reports/ExtentManager.java: -------------------------------------------------------------------------------- 1 | package com.reports; 2 | 3 | import com.relevantcodes.extentreports.ExtentTest; 4 | 5 | public class ExtentManager { 6 | 7 | public static ThreadLocal exTest= new ThreadLocal(); 8 | 9 | 10 | public static ExtentTest getExtTest() { 11 | return exTest.get(); 12 | } 13 | 14 | public static void setExtentTest(ExtentTest test) { 15 | exTest.set(test); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/reports/ExtentReport.java: -------------------------------------------------------------------------------- 1 | package com.reports; 2 | 3 | import java.io.File; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | 7 | import com.constants.Constants; 8 | import com.relevantcodes.extentreports.ExtentReports; 9 | import com.relevantcodes.extentreports.ExtentTest; 10 | import com.utils.ReadPropertyFile; 11 | 12 | public class ExtentReport { 13 | 14 | public static ExtentReports report=null; 15 | // public static ExtentTest logger=null; 16 | public static String extentreportpath=""; 17 | 18 | 19 | //To avoid external initialization 20 | private ExtentReport() { 21 | SimpleDateFormat formatter = new SimpleDateFormat("MMddyyyy_ hh_mm_ss"); 22 | Date date = new Date(); 23 | String currentDate = formatter.format(date); 24 | if(ReadPropertyFile.get("OverrideResults").equalsIgnoreCase("yes")) 25 | { 26 | if(ReadPropertyFile.get("ResultPath").equals("")) 27 | { 28 | extentreportpath=Constants.PROJECTPATH+"\\ExtentReports\\Test Report.html"; 29 | 30 | } 31 | else { 32 | extentreportpath=ReadPropertyFile.get("ResultPath")+"\\ExtentReports\\Test Report.html"; 33 | } 34 | } 35 | else 36 | { 37 | if(ReadPropertyFile.get("ResultPath").equals("")) 38 | { 39 | extentreportpath=Constants.PROJECTPATH+"\\ExtentReports\\Test Report_"+currentDate+".html"; 40 | } 41 | 42 | else 43 | { 44 | extentreportpath=ReadPropertyFile.get("ResultPath")+"\\ExtentReports\\Test Report_"+currentDate+".html"; 45 | 46 | } 47 | 48 | } 49 | report=new ExtentReports(extentreportpath); 50 | report.loadConfig(new File(Constants.EXTENTCONFIGPATH)); 51 | } 52 | 53 | public static void initialize() 54 | { 55 | ExtentReport report=new ExtentReport(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/reports/LogStatus.java: -------------------------------------------------------------------------------- 1 | package com.reports; 2 | 3 | import com.utils.ReadPropertyFile; 4 | import com.utils.TestUtils; 5 | 6 | public class LogStatus { 7 | 8 | private LogStatus() { 9 | //private to avoid initialization 10 | } 11 | public static void pass(String message) 12 | { 13 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.PASS, message); 14 | 15 | } 16 | 17 | public static void fail(String message) 18 | { 19 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, message); 20 | } 21 | 22 | public static void fail(Exception message) 23 | { 24 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, message); 25 | } 26 | 27 | public static void fail(AssertionError a) 28 | { 29 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, a); 30 | } 31 | 32 | public static void info(String message) 33 | { 34 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.INFO, message); 35 | } 36 | 37 | public static void error(String message) 38 | { 39 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.ERROR, message); 40 | } 41 | 42 | public static void fatal(String message) 43 | { 44 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FATAL, message); 45 | } 46 | 47 | public static void skip(String message) 48 | { 49 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.SKIP, message); 50 | } 51 | 52 | public static void unknown(String message) 53 | { 54 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.UNKNOWN, message); 55 | } 56 | 57 | public static void warning(String message) 58 | { 59 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.WARNING, message); 60 | } 61 | public static void pass(String string, String addScreenCapture) { 62 | 63 | if(ReadPropertyFile.get("PassedStepsScreenshots").equalsIgnoreCase("yes")) { 64 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.PASS, string,ExtentManager.getExtTest().addBase64ScreenShot("data:image/png;base64,"+TestUtils.getBase64Image(addScreenCapture))); 65 | } 66 | } 67 | 68 | public static void fail(String string, String addScreenCapture) 69 | { 70 | 71 | if(ReadPropertyFile.get("FailedStepsScreenshots").equalsIgnoreCase("yes")) { 72 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.FAIL, string,ExtentManager.getExtTest().addBase64ScreenShot("data:image/png;base64,"+TestUtils.getBase64Image(addScreenCapture))); 73 | } 74 | 75 | } 76 | 77 | public static void skip(String string, String addScreenCapture) 78 | { 79 | if(ReadPropertyFile.get("SkippedStepsScreenshots").equalsIgnoreCase("yes")) { 80 | ExtentManager.getExtTest().log(com.relevantcodes.extentreports.LogStatus.SKIP, string,ExtentManager.getExtTest().addBase64ScreenShot("data:image/png;base64,"+TestUtils.getBase64Image(addScreenCapture))); 81 | } 82 | 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/utils/DynamicXpath.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | 6 | /* 7 | * It will be used to handle dynamic xpaths at run time 8 | */ 9 | public class DynamicXpath { 10 | 11 | public static String get(String xpath, String data) { 12 | 13 | String rawxpath = xpath.replaceAll("%replaceable%", data); 14 | return rawxpath; 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/utils/EventCapture.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import org.openqa.selenium.By; 4 | import org.openqa.selenium.OutputType; 5 | import org.openqa.selenium.WebDriver; 6 | import org.openqa.selenium.WebElement; 7 | import org.openqa.selenium.support.events.WebDriverEventListener; 8 | 9 | import com.reports.LogStatus; 10 | 11 | 12 | /* 13 | * WebDriver listener will listen all driver events. It can be modified according to the requirements. 14 | */ 15 | public class EventCapture implements WebDriverEventListener { 16 | 17 | public void beforeAlertAccept(WebDriver driver) { 18 | // TODO Auto-generated method stub 19 | 20 | } 21 | 22 | public void afterAlertAccept(WebDriver driver) { 23 | // TODO Auto-generated method stub 24 | 25 | } 26 | 27 | public void afterAlertDismiss(WebDriver driver) { 28 | // TODO Auto-generated method stub 29 | 30 | } 31 | 32 | public void beforeAlertDismiss(WebDriver driver) { 33 | // TODO Auto-generated method stub 34 | 35 | } 36 | 37 | public void beforeNavigateTo(String url, WebDriver driver) { 38 | // TODO Auto-generated method stub 39 | 40 | } 41 | 42 | public void afterNavigateTo(String url, WebDriver driver) { 43 | //LogStatus.pass("Navigated to url : "+ url ); 44 | 45 | } 46 | 47 | public void beforeNavigateBack(WebDriver driver) { 48 | // TODO Auto-generated method stub 49 | 50 | } 51 | 52 | public void afterNavigateBack(WebDriver driver) { 53 | // TODO Auto-generated method stub 54 | 55 | } 56 | 57 | public void beforeNavigateForward(WebDriver driver) { 58 | // TODO Auto-generated method stub 59 | 60 | } 61 | 62 | public void afterNavigateForward(WebDriver driver) { 63 | // TODO Auto-generated method stub 64 | 65 | } 66 | 67 | public void beforeNavigateRefresh(WebDriver driver) { 68 | // TODO Auto-generated method stub 69 | 70 | } 71 | 72 | public void afterNavigateRefresh(WebDriver driver) { 73 | // TODO Auto-generated method stub 74 | 75 | } 76 | 77 | public void beforeFindBy(By by, WebElement element, WebDriver driver) { 78 | // TODO Auto-generated method stub 79 | 80 | } 81 | 82 | public void afterFindBy(By by, WebElement element, WebDriver driver) { 83 | // TODO Auto-generated method stub 84 | 85 | } 86 | 87 | public void beforeClickOn(WebElement element, WebDriver driver) { 88 | // TODO Auto-generated method stub 89 | 90 | } 91 | 92 | public void afterClickOn(WebElement element, WebDriver driver) { 93 | 94 | LogStatus.pass("Clicking is successfull on "+ element); 95 | LogStatus.pass("Screenshot below", TestUtils.pullScreenshotPath()); 96 | 97 | } 98 | 99 | public void beforeChangeValueOf(WebElement element, WebDriver driver, CharSequence[] keysToSend) { 100 | // TODO Auto-generated method stub 101 | 102 | } 103 | 104 | public void afterChangeValueOf(WebElement element, WebDriver driver, CharSequence[] keysToSend) { 105 | // TODO Auto-generated method stub 106 | 107 | } 108 | 109 | public void beforeScript(String script, WebDriver driver) { 110 | // TODO Auto-generated method stub 111 | 112 | } 113 | 114 | public void afterScript(String script, WebDriver driver) { 115 | // TODO Auto-generated method stub 116 | 117 | } 118 | 119 | public void beforeSwitchToWindow(String windowName, WebDriver driver) { 120 | // TODO Auto-generated method stub 121 | 122 | } 123 | 124 | public void afterSwitchToWindow(String windowName, WebDriver driver) { 125 | // TODO Auto-generated method stub 126 | 127 | } 128 | 129 | public void onException(Throwable throwable, WebDriver driver) { 130 | try 131 | { 132 | TestUtils.takeScreenshot(); 133 | } 134 | catch (Exception e) 135 | { 136 | e.printStackTrace(); 137 | } 138 | 139 | } 140 | 141 | public void beforeGetScreenshotAs(OutputType target) { 142 | // TODO Auto-generated method stub 143 | 144 | } 145 | 146 | public void afterGetScreenshotAs(OutputType target, X screenshot) { 147 | // TODO Auto-generated method stub 148 | 149 | } 150 | 151 | public void beforeGetText(WebElement element, WebDriver driver) { 152 | // TODO Auto-generated method stub 153 | 154 | } 155 | 156 | public void afterGetText(WebElement element, WebDriver driver, String text) { 157 | // TODO Auto-generated method stub 158 | 159 | } 160 | 161 | } -------------------------------------------------------------------------------- /SAF/src/main/java/com/utils/ReadPropertyFile.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.FileInputStream; 4 | import java.util.Properties; 5 | 6 | public class ReadPropertyFile { 7 | 8 | /* 9 | * 10 | */ 11 | public static String get(String propertyname) { 12 | 13 | String returnproperty=null; 14 | Properties property = new Properties(); 15 | try { 16 | FileInputStream file = new FileInputStream("./src/test/resources/TestRunDetails.properties"); 17 | property.load(file); 18 | returnproperty = property.getProperty(propertyname); 19 | if(returnproperty==null) { 20 | throw new Exception("Property named "+propertyname+ "not found"); 21 | } 22 | } 23 | catch(Exception e) { 24 | e.printStackTrace(); 25 | } 26 | 27 | return returnproperty; 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/utils/SeleniumUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.openqa.selenium.JavascriptExecutor; 6 | import org.openqa.selenium.WebElement; 7 | 8 | import com.browser.Driver; 9 | import com.browser.DriverManager; 10 | import com.reports.ExtentReport; 11 | import com.reports.LogStatus; 12 | 13 | public class SeleniumUtils { 14 | 15 | 16 | public static void click(WebElement element) { 17 | highlightElement(element); 18 | element.click(); 19 | LogStatus.pass("Clicking is successfull on "+ element); 20 | LogStatus.pass("Screenshot below", TestUtils.pullScreenshotPath()); 21 | } 22 | 23 | 24 | 25 | public static void sendkeys(WebElement element, String text) { 26 | highlightElement(element); 27 | element.sendKeys(text); 28 | LogStatus.pass(text + " is entered in to the "+ element); 29 | LogStatus.pass(text + " is entered in to the "+ element, TestUtils.pullScreenshotPath()); 30 | 31 | } 32 | 33 | public static void highlightElement(WebElement element) { 34 | ((JavascriptExecutor)DriverManager.getDriver()).executeScript("arguments[0].style.border='3px solid red'", element); 35 | } 36 | 37 | public static boolean isVisible(WebElement element) { 38 | boolean flag=false; 39 | DriverManager.getDriver().manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); 40 | try 41 | { 42 | if(element.isDisplayed()) 43 | { 44 | flag=true; 45 | } 46 | } 47 | catch (Exception e) { 48 | 49 | } 50 | return flag; 51 | } 52 | 53 | 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /SAF/src/main/java/com/utils/TestUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | import java.lang.reflect.Method; 10 | import java.util.ArrayList; 11 | import java.util.Base64; 12 | import java.util.HashMap; 13 | import java.util.Hashtable; 14 | 15 | import java.util.List; 16 | 17 | import java.util.Random; 18 | 19 | 20 | import javax.mail.Message; 21 | import javax.mail.PasswordAuthentication; 22 | import javax.mail.Session; 23 | import javax.mail.Transport; 24 | import javax.mail.internet.InternetAddress; 25 | import javax.mail.internet.MimeMessage; 26 | 27 | import org.apache.commons.io.FileUtils; 28 | import org.apache.commons.mail.DefaultAuthenticator; 29 | import org.apache.commons.mail.Email; 30 | import org.apache.commons.mail.EmailAttachment; 31 | import org.apache.commons.mail.EmailException; 32 | import org.apache.commons.mail.HtmlEmail; 33 | import org.apache.commons.mail.MultiPartEmail; 34 | import org.apache.commons.mail.SimpleEmail; 35 | import org.apache.poi.ss.usermodel.Cell; 36 | import org.apache.poi.util.ArrayUtil; 37 | import org.apache.poi.util.IOUtils; 38 | import org.apache.poi.xssf.usermodel.XSSFCell; 39 | import org.apache.poi.xssf.usermodel.XSSFSheet; 40 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; 41 | import org.openqa.selenium.JavascriptExecutor; 42 | import org.openqa.selenium.OutputType; 43 | import org.openqa.selenium.TakesScreenshot; 44 | import org.openqa.selenium.WebElement; 45 | import org.testng.annotations.DataProvider; 46 | 47 | import com.browser.Driver; 48 | import com.browser.DriverManager; 49 | import com.constants.Constants; 50 | import com.listener.ListenerClass; 51 | import com.reports.ExtentReport; 52 | import com.reports.LogStatus; 53 | 54 | 55 | 56 | 57 | /* 58 | * All the utilities needed for the framework is placed in this class including excel utilities, screenshot capture. 59 | * We have used method overloading concept in getCellContent Method. 60 | */ 61 | public class TestUtils { 62 | 63 | public static FileInputStream fs; 64 | public static XSSFWorkbook workbook; 65 | public static XSSFSheet sheet; 66 | public static List testCases= new ArrayList(); 67 | public static List runStatus= new ArrayList(); 68 | public static List testDescription= new ArrayList(); 69 | public static List invocationCount= new ArrayList(); 70 | public static List priority= new ArrayList(); 71 | public static HashMap rowAndTestCaseMap=new HashMap(); 72 | public static String screenshotPath=ReadPropertyFile.get("ScreenshotPath"); 73 | 74 | 75 | /* 76 | * Reads the data from the excel sheet and store the values in respective lists which will be used in annotation transformer class 77 | */ 78 | 79 | public static void getRunStatus() throws Exception { 80 | try { 81 | fs=new FileInputStream(ReadPropertyFile.get("TestDataLocation")); 82 | workbook=new XSSFWorkbook(fs); 83 | sheet=workbook.getSheet("RunManager"); 84 | for(int i=1;i<=getLastRowNum("RunManager");i++) { 85 | //rowAndTestCaseMap.put(i,sheet.getRow(i).getCell(0).getStringCellValue().toString()); 86 | testCases.add(getCellContent("RunManager", i, "TestCaseName")); 87 | testDescription.add(getCellContent("RunManager", i, "Test Case Description")); 88 | runStatus.add(getCellContent("RunManager", i, "Execute")); 89 | invocationCount.add(getCellContent("RunManager", i, "InvocationCount")); 90 | priority.add(getCellContent("RunManager", i, "Priority")); 91 | } 92 | } 93 | catch(FileNotFoundException e) { 94 | e.printStackTrace(); 95 | } 96 | 97 | } 98 | 99 | /* 100 | * public static Object getRowNumForTestCase(String testcasename) { Object 101 | * a=null; for(Map.Entry m:rowAndTestCaseMap.entrySet()){ 102 | * if(m.getValue().toString().equalsIgnoreCase(testcasename)) { a= m.getKey(); } 103 | * } return a; } 104 | */ 105 | 106 | /* 107 | * Takes rowname and sheetname as parameter 108 | * return row number based of rowname 109 | */ 110 | public static int getRowNumForRowName(String sheetname,String rowName) { 111 | int rownum=0; 112 | sheet=workbook.getSheet(sheetname); 113 | for(int i=1;i<=getLastRowNum(sheetname);i++) { 114 | if(rowName.equalsIgnoreCase(sheet.getRow(i).getCell(0).getStringCellValue())) { 115 | rownum=i; 116 | break; 117 | } 118 | } 119 | 120 | return rownum; 121 | } 122 | 123 | /* 124 | * Takes columnname and sheetname as parameter 125 | * return column number based of columnheader 126 | */ 127 | 128 | public static int getColumnNumForColumnName(String sheetname, String columnname) { 129 | int colnum=0; 130 | sheet=workbook.getSheet(sheetname); 131 | for(int i=0;i"); 306 | } 307 | } 308 | 309 | /* 310 | * Used to separate email list from the TestRunDetails.properties based on comma and return them as a String array. 311 | */ 312 | public static String[] getList(String maillist) { 313 | String[] toList=null; 314 | toList=ReadPropertyFile.get(maillist).split(","); 315 | 316 | return toList; 317 | } 318 | 319 | /* 320 | * 321 | * DataProvider method used to provide data for multiple iterations. 322 | * Never try to use multiple iterations when the invocation count is greater than 1. It may result in adhoc results. 323 | * As long as the first name of the TestData has the same test case name it will be treated as iteration. 324 | * 325 | */ 326 | @DataProvider(name="dataProviderForIterations",parallel=true) 327 | public static Object[][] supplyDataForIterations(Method m){ 328 | return getDataForDataprovider(ReadPropertyFile.get("TestDataLocation"),Constants.TESTDATASHEETNAME,m.getName()); 329 | } 330 | 331 | /* 332 | * Finding number of iterations available for test case and return the data accordingly. 333 | * Using hashtable avoids multiple parameters entry to the test case. 334 | * 335 | */ 336 | private static Object[][] getDataForDataprovider(String testdata, String sheetname, String testcasename) { 337 | int totalcolumns=getLastColumnNum(sheetname, 0); 338 | ArrayList rowscount=getNumberofIterationsForATestCase(sheetname, testcasename); 339 | Object[][] b=new Object[rowscount.size()][1]; 340 | Hashtable table =null; 341 | for(int i=1;i<=rowscount.size();i++) { 342 | table=new Hashtable(); 343 | for(int j=0;j getNumberofIterationsForATestCase(String sheetname,String testcasename) { 356 | ArrayList a=new ArrayList(); 357 | for(int i=1;i<=getLastRowNum(sheetname);i++) { 358 | if(testcasename.equalsIgnoreCase(getCellContent(sheetname, i, 0))) { 359 | a.add(i); 360 | } 361 | } 362 | 363 | return a; 364 | } 365 | 366 | } 367 | -------------------------------------------------------------------------------- /SAF/src/test/java/com/testcases/BaseTest.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.awt.Desktop; 4 | import java.io.File; 5 | 6 | import org.testng.annotations.AfterMethod; 7 | import org.testng.annotations.AfterSuite; 8 | import org.testng.annotations.BeforeMethod; 9 | import org.testng.annotations.BeforeSuite; 10 | 11 | import com.browser.Driver; 12 | import com.browser.DriverManager; 13 | import com.browser.RemoteConfiguration; 14 | import com.reports.ExtentReport; 15 | import com.utils.ReadPropertyFile; 16 | import com.utils.TestUtils; 17 | 18 | public class BaseTest { 19 | 20 | @BeforeMethod 21 | public void setUp() { 22 | try { 23 | Driver.initialize(); 24 | } catch (Exception e) { 25 | e.printStackTrace(); 26 | } 27 | } 28 | 29 | @AfterMethod 30 | public void wrapUp() { 31 | DriverManager.getDriver().close(); 32 | } 33 | 34 | @BeforeSuite 35 | public void beforeSuite() throws Exception { 36 | ExtentReport.initialize(); 37 | if(ReadPropertyFile.get("RunMode").equalsIgnoreCase("Remote")) 38 | RemoteConfiguration.setUpRemote(); 39 | } 40 | 41 | @AfterSuite 42 | public void afterSuite() throws Exception { 43 | 44 | ExtentReport.report.flush(); 45 | TestUtils.sendEmailWithResults(); 46 | if(ReadPropertyFile.get("RunMode").equalsIgnoreCase("Remote")) { 47 | RemoteConfiguration.shutDownRemote(); 48 | } 49 | 50 | File htmlFile = new File(ExtentReport.extentreportpath); 51 | Desktop.getDesktop().browse(htmlFile.toURI()); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /SAF/src/test/java/com/testcases/FacilityViewTests.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.util.Hashtable; 4 | import org.testng.Assert; 5 | import org.testng.annotations.Test; 6 | import com.pages.HomePage; 7 | import com.pages.LoginPage; 8 | 9 | public class FacilityViewTests extends BaseTest{ 10 | 11 | LoginPage loginpage; 12 | HomePage homepage; 13 | 14 | 15 | 16 | 17 | 18 | @Test 19 | public void test1(Hashtable data) { 20 | homepage=new HomePage(); 21 | homepage.searchOnGoogle(data.get("valueforsearch")); 22 | 23 | //Assert.assertEquals(1, 2); 24 | 25 | } 26 | @Test 27 | public void test2(Hashtable data) { 28 | homepage=new HomePage(); 29 | homepage.searchOnGoogle(data.get("valueforsearch")); 30 | //Assert.assertEquals(1, 2); 31 | 32 | } 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /SAF/src/test/java/com/testcases/HomePageTests.java: -------------------------------------------------------------------------------- 1 | package com.testcases; 2 | 3 | import java.util.Hashtable; 4 | 5 | import org.testng.Assert; 6 | import org.testng.annotations.AfterMethod; 7 | import org.testng.annotations.BeforeMethod; 8 | import org.testng.annotations.Test; 9 | 10 | import com.browser.Driver; 11 | import com.pages.HomePage; 12 | import com.pages.LoginPage; 13 | 14 | public class HomePageTests extends BaseTest{ 15 | 16 | LoginPage loginpage; 17 | HomePage homepage; 18 | 19 | 20 | 21 | 22 | @Test 23 | public void test3(Hashtable data) { 24 | homepage=new HomePage(); 25 | homepage.searchOnGoogle(data.get("valueforsearch")); 26 | Assert.assertEquals(1, 1); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SAF/src/test/resources/TestRunDetails.properties: -------------------------------------------------------------------------------- 1 | 2 | #Browser Configuration - chrome or firefox 3 | Browser=chrome 4 | 5 | #Run Mode - Local and Remote 6 | RunMode=Local 7 | 8 | #Remote Mode - Selenium Grid inside Docker or Zalenium Inside Docker with default as Zalenium 9 | RemoteMode=Zalenium 10 | 11 | RemoteURL=http://localhost:4444/wd/hub 12 | 13 | #implicit Wait in seconds 14 | WaitTime=10 15 | 16 | #if yes existing results will be overridden. If no results will be dynamic with time stamp 17 | OverrideResults=yes 18 | 19 | #If screenshots are required use yes 20 | ScreenshotsRequired=yes 21 | 22 | #Test URL 23 | url=https://google.com 24 | 25 | TestDataLocation=./src/test/resources/testdata.xlsx 26 | 27 | #No of times the test case have to be retried 28 | NoOfRetries=0 29 | 30 | #if result path is null home directory will be picked 31 | #Sample path is C:\\Users\\users\\Desktop 32 | ResultPath= 33 | 34 | #if screenshot path is null home directory will be picked 35 | #Sample path is C:\\Users\\users\\Desktop 36 | ScreenshotPath= 37 | 38 | #Needed screenshots for passed steps in reports then use yes 39 | PassedStepsScreenshots=yes 40 | 41 | #Needed screenshots for passed steps in reports then use yes 42 | FailedStepsScreenshots=yes 43 | 44 | #Needed screenshots for skipped steps in reports then use yes 45 | SkippedStepsScreenshots=no 46 | 47 | #Need to Send Mail to respective stakeholders with the extent report 48 | #Separate multiple emails by commas 49 | #Logic is written in sec,main,java.com.utils.testutils class 50 | SendExecutionResultsInEmail=No 51 | FromEmail=mech.amuthansakthivel@gmail.com 52 | EmailPassword=dummy 53 | ToEmails=amuthanvec@gmail.com,mech.amuthansakthivel@gmail.com 54 | CCEmails= 55 | BCCEmails= 56 | 57 | -------------------------------------------------------------------------------- /SAF/src/test/resources/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/src/test/resources/chromedriver.exe -------------------------------------------------------------------------------- /SAF/src/test/resources/extentreport.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | standard 7 | 8 | 9 | 10 | UTF-8 11 | 12 | 13 | 14 | https 15 | 16 | 17 | AQCC Report 18 | 19 | 20 | AQCC 21 | 22 | 23 | Automation Report 24 | 25 | 26 | 27 | yyyy-MM-dd 28 | 29 | 30 | 31 | HH:mm:ss 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /SAF/src/test/resources/geckodriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/src/test/resources/geckodriver.exe -------------------------------------------------------------------------------- /SAF/src/test/resources/testdata.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/src/test/resources/testdata.xlsx -------------------------------------------------------------------------------- /SAF/test-output/Suite/AQCC Parallel Test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestNG: AQCC Parallel Test 4 | 5 | 6 | 7 | 11 | 53 | 54 | 55 | 56 |

AQCC Parallel Test

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Tests passed/Failed/Skipped:0/1/1
Started on:Tue Jul 23 15:55:24 IST 2019
Total time:18 seconds (18043 ms)
Included groups:
Excluded groups:

69 | (Hover the method name to see the test class name)

70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 116 | 117 | 118 |
FAILED TESTS
Test methodExceptionTime (seconds)Instance
test2
Test class: com.testcases.FacilityViewTests
Test method: Test Case 2
java.lang.AssertionError: expected [2] but found [1]
 80 | 	at com.testcases.FacilityViewTests.test2(FacilityViewTests.java:67)
 81 | ... Removed 31 stack frames
Click to show all stack frames 82 |
java.lang.AssertionError: expected [2] but found [1]
 83 | 	at org.testng.Assert.fail(Assert.java:96)
 84 | 	at org.testng.Assert.failNotEquals(Assert.java:776)
 85 | 	at org.testng.Assert.assertEqualsImpl(Assert.java:137)
 86 | 	at org.testng.Assert.assertEquals(Assert.java:118)
 87 | 	at org.testng.Assert.assertEquals(Assert.java:652)
 88 | 	at org.testng.Assert.assertEquals(Assert.java:662)
 89 | 	at com.testcases.FacilityViewTests.test2(FacilityViewTests.java:67)
 90 | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 91 | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 92 | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 93 | 	at java.lang.reflect.Method.invoke(Method.java:498)
 94 | 	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
 95 | 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
 96 | 	at org.testng.internal.Invoker.retryFailed(Invoker.java:839)
 97 | 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1010)
 98 | 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
 99 | 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
100 | 	at org.testng.TestRunner.privateRun(TestRunner.java:648)
101 | 	at org.testng.TestRunner.run(TestRunner.java:505)
102 | 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
103 | 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
104 | 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
105 | 	at org.testng.SuiteRunner.run(SuiteRunner.java:364)
106 | 	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
107 | 	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
108 | 	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
109 | 	at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
110 | 	at org.testng.TestNG.runSuites(TestNG.java:1049)
111 | 	at org.testng.TestNG.run(TestNG.java:1017)
112 | 	at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
113 | 	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
114 | 	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
115 | 
0com.testcases.FacilityViewTests@14dd9eb7

119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 165 | 166 | 167 |
SKIPPED TESTS
Test methodExceptionTime (seconds)Instance
test2
Test class: com.testcases.FacilityViewTests
Test method: Test Case 2
java.lang.AssertionError: expected [2] but found [1]
129 | 	at com.testcases.FacilityViewTests.test2(FacilityViewTests.java:67)
130 | ... Removed 31 stack frames
Click to show all stack frames 131 |
java.lang.AssertionError: expected [2] but found [1]
132 | 	at org.testng.Assert.fail(Assert.java:96)
133 | 	at org.testng.Assert.failNotEquals(Assert.java:776)
134 | 	at org.testng.Assert.assertEqualsImpl(Assert.java:137)
135 | 	at org.testng.Assert.assertEquals(Assert.java:118)
136 | 	at org.testng.Assert.assertEquals(Assert.java:652)
137 | 	at org.testng.Assert.assertEquals(Assert.java:662)
138 | 	at com.testcases.FacilityViewTests.test2(FacilityViewTests.java:67)
139 | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
140 | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
141 | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
142 | 	at java.lang.reflect.Method.invoke(Method.java:498)
143 | 	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
144 | 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:583)
145 | 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
146 | 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
147 | 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
148 | 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
149 | 	at org.testng.TestRunner.privateRun(TestRunner.java:648)
150 | 	at org.testng.TestRunner.run(TestRunner.java:505)
151 | 	at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
152 | 	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
153 | 	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
154 | 	at org.testng.SuiteRunner.run(SuiteRunner.java:364)
155 | 	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
156 | 	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
157 | 	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
158 | 	at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
159 | 	at org.testng.TestNG.runSuites(TestNG.java:1049)
160 | 	at org.testng.TestNG.run(TestNG.java:1017)
161 | 	at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
162 | 	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
163 | 	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
164 | 
0com.testcases.FacilityViewTests@14dd9eb7

168 | 169 | -------------------------------------------------------------------------------- /SAF/test-output/Suite/AQCC Parallel Test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /SAF/test-output/Suite/Test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestNG: Test 4 | 5 | 6 | 7 | 11 | 53 | 54 | 55 | 56 |

Test

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Tests passed/Failed/Skipped:3/0/0
Started on:Sat Dec 07 12:30:43 IST 2019
Total time:17 seconds (17074 ms)
Included groups:
Excluded groups:

69 | (Hover the method name to see the test class name)

70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
PASSED TESTS
Test methodExceptionTime (seconds)Instance
test1
Test class: com.testcases.FacilityViewTests
Test method: Test case 1
Parameters: {valueforsearch=appium, password=, TestCaseName=test1, username=abcd}
1com.testcases.FacilityViewTests@4a94ee4
test1
Test class: com.testcases.FacilityViewTests
Test method: Test case 1
Parameters: {valueforsearch=test11, password=, TestCaseName=test1, username=efgh}
1com.testcases.FacilityViewTests@4a94ee4
test2
Test class: com.testcases.FacilityViewTests
Test method: Test Case 2
Parameters: {valueforsearch=selenium, password=987, TestCaseName=test2, username=jbvb}
1com.testcases.FacilityViewTests@4a94ee4

93 | 94 | -------------------------------------------------------------------------------- /SAF/test-output/Suite/Test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SAF/test-output/Suite/methods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | TestNG: methods 4 | 5 | 6 | 7 | 11 | 53 | 54 | 55 | 56 |

methods

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
Tests passed/Failed/Skipped:2/0/0
Started on:Fri Jun 28 13:42:58 IST 2019
Total time:88 seconds (88244 ms)
Included groups:
Excluded groups:

69 | (Hover the method name to see the test class name)

70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 |
PASSED TESTS
Test methodExceptionTime (seconds)Instance
checkWhetherGlobalViewIsSelectedByDefault
Test class: com.testcases.FacilityViewTests
Test method: Validate whether the default view selected is Global View
20com.testcases.FacilityViewTests@68c4039c
validateEnteringShipmentID
Test class: com.testcases.FacilityViewTests
Test method: Validate whether the user can able to enter shipmentID
31com.testcases.FacilityViewTests@68c4039c

88 | 89 | -------------------------------------------------------------------------------- /SAF/test-output/Suite/methods.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SAF/test-output/Suite/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SAF/test-output/bullet_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/test-output/bullet_point.png -------------------------------------------------------------------------------- /SAF/test-output/collapseall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/test-output/collapseall.gif -------------------------------------------------------------------------------- /SAF/test-output/emailable-report.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestNG Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Test# Passed# Skipped# FailedTime (ms)Included GroupsExcluded Groups
Suite
Test30017,074
14 | 15 |
ClassMethodStartTime (ms)
Suite
Test — passed
com.testcases.FacilityViewTeststest115757020584961539
test1
test215757020584781557
16 |

Test

com.testcases.FacilityViewTests#test1

Parameter #1
{valueforsearch=test11, password=, TestCaseName=test1, username=efgh}

back to summary

17 |

com.testcases.FacilityViewTests#test1

Parameter #1
{valueforsearch=appium, password=, TestCaseName=test1, username=abcd}

back to summary

18 |

com.testcases.FacilityViewTests#test2

Parameter #1
{valueforsearch=selenium, password=987, TestCaseName=test2, username=jbvb}

back to summary

19 | 20 | 21 | -------------------------------------------------------------------------------- /SAF/test-output/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/test-output/failed.png -------------------------------------------------------------------------------- /SAF/test-output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | TestNG reports 7 | 8 | 9 | 10 | 11 | 12 | 18 | 21 | 22 | 23 | 24 |
25 | Test results 26 |
27 | 1 suite 28 |
29 | 127 |
128 |
129 |
130 |
131 |
132 | 133 | com.testcases.FacilityViewTests 134 |
135 |
136 |
137 |
138 | 139 | 140 | test1 141 | ({valueforsearch=test11, password=, TestCaseName=test1, username=efgh}) 142 | 143 | (Test case 1) 144 |
145 |
146 |
147 |
148 | 149 | 150 | test1 151 | ({valueforsearch=appium, password=, TestCaseName=test1, username=abcd}) 152 | 153 | (Test case 1) 154 |
155 |
156 |
157 |
158 | 159 | 160 | test2 161 | ({valueforsearch=selenium, password=987, TestCaseName=test2, username=jbvb}) 162 | 163 | (Test Case 2) 164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 | C:\Users\asakthiv\eclipse-workspace\SAF\testng.xml 172 |
173 |
174 |
175 | <?xml version="1.0" encoding="UTF-8"?>
176 | <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
177 | <suite guice-stage="DEVELOPMENT" name="Suite">
178 |   <listeners>
179 |     <listener class-name="com.listener.ListenerClass"/>
180 |     <listener class-name="com.listener.AnnotationTransformer"/>
181 |   </listeners>
182 |   <test thread-count="2" name="Test" parallel="methods">
183 |     <classes>
184 |       <class name="com.testcases.BaseTest"/>
185 |       <class name="com.testcases.FacilityViewTests"/>
186 |       <class name="com.testcases.HomePageTests"/>
187 |     </classes>
188 |   </test> <!-- Test -->
189 | </suite> <!-- Suite -->
190 |             
191 |
192 |
193 |
194 |
195 | Tests for Suite 196 |
197 |
198 |
    199 |
  • 200 | Test (3 classes) 201 |
  • 202 |
203 |
204 |
205 |
206 |
207 | Groups for Suite 208 |
209 |
210 |
211 |
212 |
213 |
214 | Times for Suite 215 |
216 |
217 |
218 | 243 | Total running time: 4 seconds 244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 | Reporter output for Suite 252 |
253 |
254 |
255 |
256 |
257 |
258 | 5 ignored methods 259 |
260 |
261 |
262 | com.testcases.HomePageTests 263 |
264 | test3 265 |
266 | beforeSuite 267 |
268 | afterSuite 269 |
270 |
271 |
272 |
273 | com.testcases.FacilityViewTests 274 |
275 | beforeSuite 276 |
277 | afterSuite 278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 | Methods in chronological order 286 |
287 |
288 |
289 |
com.testcases.BaseTest
290 |
291 | beforeSuite 292 | 0 ms 293 |
294 |
295 |
296 |
com.testcases.FacilityViewTests
297 |
298 | setUp 299 | 212 ms 300 |
301 |
302 | setUp 303 | 221 ms 304 |
305 |
306 | setUp 307 | 221 ms 308 |
309 |
310 | test2({valueforsearch=selenium, password=987, TestCaseName=test2, username=jbvb}) 311 | 15252 ms 312 |
313 |
314 | test1({valueforsearch=test11, password=, TestCaseName=test1, username=efgh}) 315 | 15270 ms 316 |
317 |
318 | test1({valueforsearch=appium, password=, TestCaseName=test1, username=abcd}) 319 | 15274 ms 320 |
321 |
322 | wrapUp 323 | 16789 ms 324 |
325 |
326 | wrapUp 327 | 16810 ms 328 |
329 |
330 | wrapUp 331 | 16813 ms 332 |
333 |
334 |
335 |
com.testcases.BaseTest
336 |
337 | afterSuite 338 | 17276 ms 339 |
340 |
341 |
342 |
343 |
344 | 345 | 346 | -------------------------------------------------------------------------------- /SAF/test-output/junitreports/TEST-com.testcases.FacilityViewTests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SAF/test-output/junitreports/TEST-com.testcases.HomePageTests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SAF/test-output/navigator-bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/test-output/navigator-bullet.png -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/AQCC Parallel Test.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=AQCC Parallel Test] -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/Test.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=Test] -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Class nameMethod nameGroups
com.testcases.FacilityViewTests  
@Test
 test1 
 test2 
@BeforeClass
@BeforeMethod
 setUp 
@AfterMethod
 wrapUp 
@AfterClass
41 | -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/groups.html: -------------------------------------------------------------------------------- 1 |

Groups used for this test run

-------------------------------------------------------------------------------- /SAF/test-output/old/Suite/index.html: -------------------------------------------------------------------------------- 1 | Results for Suite 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/main.html: -------------------------------------------------------------------------------- 1 | Results for Suite 2 | Select a result on the left-hand pane. 3 | -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/methods-alphabetical.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
19/12/07 12:31:00 0 <<afterSuite      main@1740797075
19/12/07 12:30:43 -17268 >>beforeSuite      main@1740797075
19/12/07 12:30:43 -17055     >>setUp  TestNG-PoolService-1@459706022
19/12/07 12:30:43 -17055     >>setUp  TestNG-PoolService-1@459706022
19/12/07 12:30:43 -17055     >>setUp  TestNG-PoolService-1@459706022
19/12/07 12:30:58 -2006      test1TestNG-PoolService-1@459706022
19/12/07 12:30:58 -2002      test1TestNG-PoolService-1@459706022
19/12/07 12:30:58 -2024      test2TestNG-PoolService-0@86325311
19/12/07 12:31:00 -487     <<wrapUp  TestNG-PoolService-1@459706022
19/12/07 12:31:00 -465     <<wrapUp  TestNG-PoolService-1@459706022
19/12/07 12:31:00 -463     <<wrapUp  TestNG-PoolService-1@459706022
27 | -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/methods-not-run.html: -------------------------------------------------------------------------------- 1 |

Methods that were not run

2 | 3 | 4 | 5 | 6 | 7 |
com.testcases.HomePageTests.test3
    Test Case 3
com.testcases.BaseTest.beforeSuite
com.testcases.BaseTest.beforeSuite
com.testcases.BaseTest.afterSuite
com.testcases.BaseTest.afterSuite
-------------------------------------------------------------------------------- /SAF/test-output/old/Suite/methods.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
19/12/07 12:30:43 0 >>beforeSuite      main@1740797075
19/12/07 12:30:43 213     >>setUp  TestNG-PoolService-1@459706022
19/12/07 12:30:43 213     >>setUp  TestNG-PoolService-1@459706022
19/12/07 12:30:43 213     >>setUp  TestNG-PoolService-1@459706022
19/12/07 12:30:58 15244      test2TestNG-PoolService-0@86325311
19/12/07 12:30:58 15262      test1TestNG-PoolService-1@459706022
19/12/07 12:30:58 15266      test1TestNG-PoolService-1@459706022
19/12/07 12:31:00 16781     <<wrapUp  TestNG-PoolService-1@459706022
19/12/07 12:31:00 16803     <<wrapUp  TestNG-PoolService-1@459706022
19/12/07 12:31:00 16805     <<wrapUp  TestNG-PoolService-1@459706022
19/12/07 12:31:00 17268 <<afterSuite      main@1740797075
27 | -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/methods.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=methods] -------------------------------------------------------------------------------- /SAF/test-output/old/Suite/reporter-output.html: -------------------------------------------------------------------------------- 1 |

Reporter output

-------------------------------------------------------------------------------- /SAF/test-output/old/Suite/testng.xml.html: -------------------------------------------------------------------------------- 1 | testng.xml for Suite<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite guice-stage="DEVELOPMENT" name="Suite">
  <listeners>
    <listener class-name="com.listener.ListenerClass"/>
    <listener class-name="com.listener.AnnotationTransformer"/>
  </listeners>
  <test thread-count="2" name="Test" parallel="methods">
    <classes>
      <class name="com.testcases.BaseTest"/>
      <class name="com.testcases.FacilityViewTests"/>
      <class name="com.testcases.HomePageTests"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->
-------------------------------------------------------------------------------- /SAF/test-output/old/Suite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results for Suite 4 | 5 | 6 | 7 | 8 |

Results for
Suite

9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 |
1 test1 class2 methods:
14 |   chronological
15 |   alphabetical
16 |   not run (5)
0 groupreporter outputtestng.xml
23 | 24 |

29 |

25 |
Test (3/0/0) 26 | Results 27 |
28 |
30 | -------------------------------------------------------------------------------- /SAF/test-output/old/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Test results

6 | 7 | 8 | 9 |
SuitePassedFailedSkippedtestng.xml
Total300 
Suite300Link
10 | -------------------------------------------------------------------------------- /SAF/test-output/passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/test-output/passed.png -------------------------------------------------------------------------------- /SAF/test-output/skipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amuthansakthivel/MavenTestNG/5d58246558e8074924aef35062faefbe576c484e/SAF/test-output/skipped.png -------------------------------------------------------------------------------- /SAF/test-output/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SAF/test-output/testng-reports.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px 0px 5px 5px; 3 | } 4 | 5 | ul { 6 | margin: 0px; 7 | } 8 | 9 | li { 10 | list-style-type: none; 11 | } 12 | 13 | a { 14 | text-decoration: none; 15 | } 16 | 17 | a:hover { 18 | text-decoration: underline; 19 | } 20 | 21 | .navigator-selected { 22 | background: #ffa500; 23 | } 24 | 25 | .wrapper { 26 | position: absolute; 27 | top: 60px; 28 | bottom: 0; 29 | left: 400px; 30 | right: 0; 31 | overflow: auto; 32 | } 33 | 34 | .navigator-root { 35 | position: absolute; 36 | top: 60px; 37 | bottom: 0; 38 | left: 0; 39 | width: 400px; 40 | overflow-y: auto; 41 | } 42 | 43 | .suite { 44 | margin: 0px 10px 10px 0px; 45 | background-color: #fff8dc; 46 | } 47 | 48 | .suite-name { 49 | padding-left: 10px; 50 | font-size: 25px; 51 | font-family: Times; 52 | } 53 | 54 | .main-panel-header { 55 | padding: 5px; 56 | background-color: #9FB4D9; //afeeee; 57 | font-family: monospace; 58 | font-size: 18px; 59 | } 60 | 61 | .main-panel-content { 62 | padding: 5px; 63 | margin-bottom: 10px; 64 | background-color: #DEE8FC; //d0ffff; 65 | } 66 | 67 | .rounded-window { 68 | border-radius: 10px; 69 | border-style: solid; 70 | border-width: 1px; 71 | } 72 | 73 | .rounded-window-top { 74 | border-top-right-radius: 10px 10px; 75 | border-top-left-radius: 10px 10px; 76 | border-style: solid; 77 | border-width: 1px; 78 | overflow: auto; 79 | } 80 | 81 | .light-rounded-window-top { 82 | border-top-right-radius: 10px 10px; 83 | border-top-left-radius: 10px 10px; 84 | } 85 | 86 | .rounded-window-bottom { 87 | border-style: solid; 88 | border-width: 0px 1px 1px 1px; 89 | border-bottom-right-radius: 10px 10px; 90 | border-bottom-left-radius: 10px 10px; 91 | overflow: auto; 92 | } 93 | 94 | .method-name { 95 | font-size: 12px; 96 | font-family: monospace; 97 | } 98 | 99 | .method-content { 100 | border-style: solid; 101 | border-width: 0px 0px 1px 0px; 102 | margin-bottom: 10; 103 | padding-bottom: 5px; 104 | width: 80%; 105 | } 106 | 107 | .parameters { 108 | font-size: 14px; 109 | font-family: monospace; 110 | } 111 | 112 | .stack-trace { 113 | white-space: pre; 114 | font-family: monospace; 115 | font-size: 12px; 116 | font-weight: bold; 117 | margin-top: 0px; 118 | margin-left: 20px; 119 | } 120 | 121 | .testng-xml { 122 | font-family: monospace; 123 | } 124 | 125 | .method-list-content { 126 | margin-left: 10px; 127 | } 128 | 129 | .navigator-suite-content { 130 | margin-left: 10px; 131 | font: 12px 'Lucida Grande'; 132 | } 133 | 134 | .suite-section-title { 135 | margin-top: 10px; 136 | width: 80%; 137 | border-style: solid; 138 | border-width: 1px 0px 0px 0px; 139 | font-family: Times; 140 | font-size: 18px; 141 | font-weight: bold; 142 | } 143 | 144 | .suite-section-content { 145 | list-style-image: url(bullet_point.png); 146 | } 147 | 148 | .top-banner-root { 149 | position: absolute; 150 | top: 0; 151 | height: 45px; 152 | left: 0; 153 | right: 0; 154 | padding: 5px; 155 | margin: 0px 0px 5px 0px; 156 | background-color: #0066ff; 157 | font-family: Times; 158 | color: #fff; 159 | text-align: center; 160 | } 161 | 162 | .top-banner-title-font { 163 | font-size: 25px; 164 | } 165 | 166 | .test-name { 167 | font-family: 'Lucida Grande'; 168 | font-size: 16px; 169 | } 170 | 171 | .suite-icon { 172 | padding: 5px; 173 | float: right; 174 | height: 20; 175 | } 176 | 177 | .test-group { 178 | font: 20px 'Lucida Grande'; 179 | margin: 5px 5px 10px 5px; 180 | border-width: 0px 0px 1px 0px; 181 | border-style: solid; 182 | padding: 5px; 183 | } 184 | 185 | .test-group-name { 186 | font-weight: bold; 187 | } 188 | 189 | .method-in-group { 190 | font-size: 16px; 191 | margin-left: 80px; 192 | } 193 | 194 | table.google-visualization-table-table { 195 | width: 100%; 196 | } 197 | 198 | .reporter-method-name { 199 | font-size: 14px; 200 | font-family: monospace; 201 | } 202 | 203 | .reporter-method-output-div { 204 | padding: 5px; 205 | margin: 0px 0px 5px 20px; 206 | font-size: 12px; 207 | font-family: monospace; 208 | border-width: 0px 0px 0px 1px; 209 | border-style: solid; 210 | } 211 | 212 | .ignored-class-div { 213 | font-size: 14px; 214 | font-family: monospace; 215 | } 216 | 217 | .ignored-methods-div { 218 | padding: 5px; 219 | margin: 0px 0px 5px 20px; 220 | font-size: 12px; 221 | font-family: monospace; 222 | border-width: 0px 0px 0px 1px; 223 | border-style: solid; 224 | } 225 | 226 | .border-failed { 227 | border-top-left-radius: 10px 10px; 228 | border-bottom-left-radius: 10px 10px; 229 | border-style: solid; 230 | border-width: 0px 0px 0px 10px; 231 | border-color: #f00; 232 | } 233 | 234 | .border-skipped { 235 | border-top-left-radius: 10px 10px; 236 | border-bottom-left-radius: 10px 10px; 237 | border-style: solid; 238 | border-width: 0px 0px 0px 10px; 239 | border-color: #edc600; 240 | } 241 | 242 | .border-passed { 243 | border-top-left-radius: 10px 10px; 244 | border-bottom-left-radius: 10px 10px; 245 | border-style: solid; 246 | border-width: 0px 0px 0px 10px; 247 | border-color: #19f52d; 248 | } 249 | 250 | .times-div { 251 | text-align: center; 252 | padding: 5px; 253 | } 254 | 255 | .suite-total-time { 256 | font: 16px 'Lucida Grande'; 257 | } 258 | 259 | .configuration-suite { 260 | margin-left: 20px; 261 | } 262 | 263 | .configuration-test { 264 | margin-left: 40px; 265 | } 266 | 267 | .configuration-class { 268 | margin-left: 60px; 269 | } 270 | 271 | .configuration-method { 272 | margin-left: 80px; 273 | } 274 | 275 | .test-method { 276 | margin-left: 100px; 277 | } 278 | 279 | .chronological-class { 280 | background-color: #0ccff; 281 | border-style: solid; 282 | border-width: 0px 0px 1px 1px; 283 | } 284 | 285 | .method-start { 286 | float: right; 287 | } 288 | 289 | .chronological-class-name { 290 | padding: 0px 0px 0px 5px; 291 | color: #008; 292 | } 293 | 294 | .after, .before, .test-method { 295 | font-family: monospace; 296 | font-size: 14px; 297 | } 298 | 299 | .navigator-suite-header { 300 | font-size: 22px; 301 | margin: 0px 10px 5px 0px; 302 | background-color: #deb887; 303 | text-align: center; 304 | } 305 | 306 | .collapse-all-icon { 307 | padding: 5px; 308 | float: right; 309 | } 310 | -------------------------------------------------------------------------------- /SAF/test-output/testng-reports.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('a.navigator-link').click(function() { 3 | // Extract the panel for this link 4 | var panel = getPanelName($(this)); 5 | 6 | // Mark this link as currently selected 7 | $('.navigator-link').parent().removeClass('navigator-selected'); 8 | $(this).parent().addClass('navigator-selected'); 9 | 10 | showPanel(panel); 11 | }); 12 | 13 | installMethodHandlers('failed'); 14 | installMethodHandlers('skipped'); 15 | installMethodHandlers('passed', true); // hide passed methods by default 16 | 17 | $('a.method').click(function() { 18 | showMethod($(this)); 19 | return false; 20 | }); 21 | 22 | // Hide all the panels and display the first one (do this last 23 | // to make sure the click() will invoke the listeners) 24 | $('.panel').hide(); 25 | $('.navigator-link').first().click(); 26 | 27 | // Collapse/expand the suites 28 | $('a.collapse-all-link').click(function() { 29 | var contents = $('.navigator-suite-content'); 30 | if (contents.css('display') == 'none') { 31 | contents.show(); 32 | } else { 33 | contents.hide(); 34 | } 35 | }); 36 | }); 37 | 38 | // The handlers that take care of showing/hiding the methods 39 | function installMethodHandlers(name, hide) { 40 | function getContent(t) { 41 | return $('.method-list-content.' + name + "." + t.attr('panel-name')); 42 | } 43 | 44 | function getHideLink(t, name) { 45 | var s = 'a.hide-methods.' + name + "." + t.attr('panel-name'); 46 | return $(s); 47 | } 48 | 49 | function getShowLink(t, name) { 50 | return $('a.show-methods.' + name + "." + t.attr('panel-name')); 51 | } 52 | 53 | function getMethodPanelClassSel(element, name) { 54 | var panelName = getPanelName(element); 55 | var sel = '.' + panelName + "-class-" + name; 56 | return $(sel); 57 | } 58 | 59 | $('a.hide-methods.' + name).click(function() { 60 | var w = getContent($(this)); 61 | w.hide(); 62 | getHideLink($(this), name).hide(); 63 | getShowLink($(this), name).show(); 64 | getMethodPanelClassSel($(this), name).hide(); 65 | }); 66 | 67 | $('a.show-methods.' + name).click(function() { 68 | var w = getContent($(this)); 69 | w.show(); 70 | getHideLink($(this), name).show(); 71 | getShowLink($(this), name).hide(); 72 | showPanel(getPanelName($(this))); 73 | getMethodPanelClassSel($(this), name).show(); 74 | }); 75 | 76 | if (hide) { 77 | $('a.hide-methods.' + name).click(); 78 | } else { 79 | $('a.show-methods.' + name).click(); 80 | } 81 | } 82 | 83 | function getHashForMethod(element) { 84 | return element.attr('hash-for-method'); 85 | } 86 | 87 | function getPanelName(element) { 88 | return element.attr('panel-name'); 89 | } 90 | 91 | function showPanel(panelName) { 92 | $('.panel').hide(); 93 | var panel = $('.panel[panel-name="' + panelName + '"]'); 94 | panel.show(); 95 | } 96 | 97 | function showMethod(element) { 98 | var hashTag = getHashForMethod(element); 99 | var panelName = getPanelName(element); 100 | showPanel(panelName); 101 | var current = document.location.href; 102 | var base = current.substring(0, current.indexOf('#')) 103 | document.location.href = base + '#' + hashTag; 104 | var newPosition = $(document).scrollTop() - 65; 105 | $(document).scrollTop(newPosition); 106 | } 107 | 108 | function drawTable() { 109 | for (var i = 0; i < suiteTableInitFunctions.length; i++) { 110 | window[suiteTableInitFunctions[i]](); 111 | } 112 | 113 | for (var k in window.suiteTableData) { 114 | var v = window.suiteTableData[k]; 115 | var div = v.tableDiv; 116 | var data = v.tableData 117 | var table = new google.visualization.Table(document.getElementById(div)); 118 | table.draw(data, { 119 | showRowNumber : false 120 | }); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /SAF/test-output/testng-results.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /SAF/test-output/testng.css: -------------------------------------------------------------------------------- 1 | .invocation-failed, .test-failed { background-color: #DD0000; } 2 | .invocation-percent, .test-percent { background-color: #006600; } 3 | .invocation-passed, .test-passed { background-color: #00AA00; } 4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; } 5 | 6 | .main-page { 7 | font-size: x-large; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /SAF/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SAF/zaleniumDown.bat: -------------------------------------------------------------------------------- 1 | docker stop zalenium -------------------------------------------------------------------------------- /SAF/zaleniumUp.bat: -------------------------------------------------------------------------------- 1 | docker run --rm -ti --name zalenium -p 4444:4444 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start >>output.txt --------------------------------------------------------------------------------