Ability to override Browser Parameter at test set level via command line

133 views
Skip to first unread message

pappuj...@gmail.com

unread,
Apr 17, 2019, 4:40:43 AM4/17/19
to Cognizant Intelligent Test Scripter
Requirements:

We have requirement to integrate the UI automation thru DevOps , which means there is no manual intervention

Also, we have a need to run a test set on different supported browsers ( IE, Chrome, Safari) etc  and windows frameworks ( Internal frameworks).

Problem Statement:
Since the Browser parameter can be overridden from command line at test case level and not at the test set level, it is blocking us from integrating to the DevOps pipeline.

We would not want to duplicate test sets for each of the frameworks that we use, as we will later on get into maintenance issues, and also it is not a good solution.

Thanks

shantha laxmi kumar

unread,
Apr 23, 2019, 4:47:20 AM4/23/19
to Cognizant Intelligent Test Scripter
In order to run all test cases in a test set against the same browser specified through command line, please find the changes to be made in the CITS engine below.

- Package : com.cognizant.cognizantits.engine.cli 
class name : CLI.java
Method : static void executeWith(Map<String, Option> execution)
Add the below block of code inside the if block - if (execution.containsKey(Op.RS_NAME))

if (execution.containsKey(Op.BROWSER_NAME)) {
                           gSettings.setBrowser(execution.get(Op.BROWSER_NAME).getValue());
                    } else {
                           gSettings.setBrowser("");
                    }

- Package : com.cognizant.cognizantits.engine.core
class name : RunManager.java
Method : private static void addRunContext(ExecutionStep step, Queue<RunContext> execQ)
Replace the line "exe.BrowserName = step.getBrowser();" by the below code snippet,

String browser = RunManager.getGlobalSettings().getBrowser();
if (browser != null && !(browser.equals(""))) {
                    exe.BrowserName = RunManager.getGlobalSettings().getBrowser();
             } else {
                    exe.BrowserName = step.getBrowser();
             }

A sample command line option to trigger the above execution  is,  

Run.bat -run -project_location "D:\CITS_1.1\cognizant-intelligent-test-scripter-1.1\Projects\DemoProject" -release "spritz" -testset "BasicWebFlow_Environment1" –browser chrome

Thanks,
Shantha

ramamu...@gmail.com

unread,
Jun 11, 2019, 6:01:09 AM6/11/19
to Cognizant Intelligent Test Scripter
After making the below changes to the CITS, when user runs the tests in CITS UI, it's not considering the browser set at the test case level. Instead it's always referring the browser in the Global Settings.Properties. Please solve this issue.

shantha laxmi kumar

unread,
Jun 11, 2019, 9:42:01 AM6/11/19
to Cognizant Intelligent Test Scripter
Please share console logs of execution.

ramamu...@gmail.com

unread,
Jun 13, 2019, 4:06:31 AM6/13/19
to Cognizant Intelligent Test Scripter
Run Information
========================
cognizant.intelligent.test.scripter.engine : ${project.version}
java.runtime.name    : Java(TM) SE Runtime Environment
java.version         : 1.8.0_211
java.home            : C:\Program Files\Java\jre1.8.0_211
os.name              : Windows 7
os.arch              : amd64
os.version           : 6.1
file.encoding        : UTF-8
========================
Run Started on Thu Jun 13 13:35:13 IST 2019
Loading Browser Profile
Loading RunManager
[Scenario:Login] [TestCase: Login] [Description: Login] [Browser: Chrome] [BrowserVersion: Default] [Platform: ANY][ExistingBrowser: false]
----------------------------------------------------------
[1] TestCase selected for execution from [//HTML5_RFT/Functional]
----------------------------------------------------------
Initializing Report
ApiLink not available!!
Shutting Down Thread as there is no need for SelectiveThreading
Running Iteration 1
Launching Chrome
Launching Local Driver
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 5614
Only local connections are allowed.
2019-06-13 13:35:16:06S +0530 [INFO] org.openqa.selenium.remote.ProtocolHandshake createSession:Detected dialect: OSS

Chrome Launched
Step:1   | Object: Browser | Action: customLogin | Input:  | Conditon:  | @13-Jun-2019 13:35:16.016
Step:1   | Object: Browser | Action: Open | Input: Login:URL | Conditon:  | @13-Jun-2019 13:35:16.016

===================================================================================================

Step:2   | Object: Textbox_UserName | Action: Set | Input: Login:UserName | Conditon:  | @13-Jun-2019 13:35:18.018
Using @name [Login1:UserName], Object 'Textbox_UserName' Found in 19 ms
[DONE]   | Entered Text 'cttgs1....@thomsonreuters.com' on 'Textbox_UserName'

===================================================================================================

Step:3   | Object: Textbox_Password | Action: setEncrypted | Input: Login:Password | Conditon:  | @13-Jun-2019 13:35:19.019
Using @name [Login1:Password], Object 'Textbox_Password' Found in 14 ms
[DONE]   | Entered Encrypted Text UGFzc3dvcmRAMQ== on Textbox_Password

===================================================================================================

Step:4   | Object: Button_Login | Action: Click | Input:  | Conditon:  | @13-Jun-2019 13:35:19.019
Using @name [Login1:LoginButton], Object 'Button_Login' Found in 17 ms
[DONE]   | Clicking on Button_Login

===================================================================================================

Step:5   | Object: Browser | Action: waitForPageLoaded | Input:  | Conditon:  | @13-Jun-2019 13:35:21.021
[DONE]   | Page load completed in stipulated time

===================================================================================================

Step:2   | Object: Browser | Action: AddGlobalVar | Input: @2000 | Conditon: %SlowTimeChrome% | @13-Jun-2019 13:35:21.021
Getting runTimeVar %SlowTimeChrome%
[DONE]   | Variable %SlowTimeChrome% added with value 2000

===================================================================================================


---------------------------------------------------
Testcase Name        : Login:Login
Executed Steps       : 6
Passed Steps         : 6
Failed Steps         : 0
Time Taken           : 00:00:07
-----------------------------------------------------

Run Finished on Thu Jun 13 13:35:21 IST 2019
-----------------------------------------------------
ExecutionDate        : 13-Jun-2019 13-35-13
Executed TestCases   : 1
Passed TestCases     : 1
Failed TestCases     : 0
Time Taken           : 00:00:07
ReportPath           : file:///C:\GIT\HTML5_CITS_FRAMEWORK\cognizant-intelligent-test-scripter-1.1\Projects\BETA_LINK\Results\TestExecution\HTML5_RFT\Functional\13-Jun-2019 13-35-13\summary.html
-----------------------------------------------------

shantha laxmi kumar

unread,
Jun 14, 2019, 9:54:13 AM6/14/19
to Cognizant Intelligent Test Scripter
We looked at the logs shared and we need few more additional information

1. Please confirm if your initial requirement to execute test flows with browser option set at TestSet level from CITS CLI is working fine.
2. Please share the command line syntax used.
3. Are you able to execute the testcase from CITS UI Test Design panel & Test Execution Panel with the set browser.
4. Request you to reproduce the issue again and share the steps and corresponding global settings file & the console logs.

 


On Tuesday, 11 June 2019 15:31:09 UTC+5:30, ramamu...@gmail.com wrote:

ramamu...@gmail.com

unread,
Jun 17, 2019, 6:19:14 AM6/17/19
to Cognizant Intelligent Test Scripter
Comments inline..


On Friday, June 14, 2019 at 7:24:13 PM UTC+5:30, shantha laxmi kumar wrote:
We looked at the logs shared and we need few more additional information

1. Please confirm if your initial requirement to execute test flows with browser option set at TestSet level from CITS CLI is working fine.
 Yes
2. Please share the command line syntax used.
           @echo off

pushd %~dp0

 

rem For App to load lib from

SET APP_CLASSPATH=lib\*;lib\clib\*

 

java -Xms128m -Xmx1024m -Dfile.encoding=UTF-8 -cp cognizant-intelligent-test-scripter-ide-1.1.jar;%APP_CLASSPATH%; com.cognizant.cognizantits.ide.main.Main -run -project_location "C:\GIT\HTML5_CITS_FRAMEWORK\cognizant-intelligent-test-scripter-1.1\Projects\BETA_LINK" -release "HTML5_RFT" -testset "Functional" -browser "Thomson1"

3. Are you able to execute the testcase from CITS UI Test Design panel & Test Execution Panel with the set browser.
When I execute the tests in Test Design panel, it executed on the selected browser in the Design Panel
When I executed the tests in the Test Execution Panel, it did not executed the selected browser in the Test Execution Panel, INSTEAD it executed the tests based on Design Panel browser.
4. Request you to reproduce the issue again and share the steps and corresponding global settings file & the console logs.
 
 I set Thomson1 as browser, but tests executed in chrome.
Execution log from Test Execution Panel
 Run Information
========================
cognizant.intelligent.test.scripter.engine : ${project.version}
java.runtime.name    : Java(TM) SE Runtime Environment
java.version         : 1.8.0_211
java.home            : C:\Program Files\Java\jre1.8.0_211
os.name              : Windows 7
os.arch              : amd64
os.version           : 6.1
file.encoding        : UTF-8
========================
Run Started on Mon Jun 17 15:31:37 IST 2019
Loading Browser Profile
Loading RunManager
[Scenario:Login] [TestCase: Login] [Description: Login] [Browser: Chrome] [BrowserVersion: Default] [Platform: ANY][ExistingBrowser: false]
[Scenario:Navigation] [TestCase: Navigation_AccountWorkBook] [Description: Navigation_AccountWorkBook] [Browser: Chrome] [BrowserVersion: Default] [Platform: ANY][ExistingBrowser: false]
[Scenario:AWB_Errors Warnings] [TestCase: AWB_BAL_001_Balances Error Warning Messages] [Description: AWB_BAL_001_Balances Error Warning Messages] [Browser: Chrome] [BrowserVersion: Default] [Platform: ANY][ExistingBrowser: false]
----------------------------------------------------------
[3] TestCases selected for execution from [//HTML5_RFT/Functional]
----------------------------------------------------------
Initializing Report
ApiLink not available!!
Shutting Down Thread as there is no need for SelectiveThreading
Running Iteration 1
Launching Chrome
Launching Local Driver
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 43438
Only local connections are allowed.
2019-06-17 15:31:42:06S +0530 [INFO] org.openqa.selenium.remote.ProtocolHandshake createSession:Detected dialect: OSS

Chrome Launched
Step:1   | Object: Browser | Action: customLogin | Input:  | Conditon:  | @17-Jun-2019 15:31:42.042
Step:1   | Object: Browser | Action: Open | Input: Login:URL | Conditon:  | @17-Jun-2019 15:31:42.042

===================================================================================================

Step:2   | Object: Textbox_UserName | Action: Set | Input: Login:UserName | Conditon:  | @17-Jun-2019 15:31:45.045
Using @name [Login1:UserName], Object 'Textbox_UserName' Found in 64 ms
[DONE]   | Entered Text 'cttgs1....@thomsonreuters.com' on 'Textbox_UserName'

===================================================================================================

Step:3   | Object: Textbox_Password | Action: setEncrypted | Input: Login:Password | Conditon:  | @17-Jun-2019 15:31:45.045
Using @name [Login1:Password], Object 'Textbox_Password' Found in 23 ms
[DONE]   | Entered Encrypted Text UGFzc3dvcmRAMQ== on Textbox_Password

===================================================================================================

Step:4   | Object: Button_Login | Action: Click | Input:  | Conditon:  | @17-Jun-2019 15:31:45.045
Using @name [Login1:LoginButton], Object 'Button_Login' Found in 30 ms
[DONE]   | Clicking on Button_Login

===================================================================================================

Step:5   | Object: Browser | Action: waitForPageLoaded | Input:  | Conditon:  | @17-Jun-2019 15:31:48.048
[DONE]   | Page load completed in stipulated time

===================================================================================================

Step:2   | Object: Browser | Action: AddGlobalVar | Input: @2000 | Conditon: %SlowTimeChrome% | @17-Jun-2019 15:31:48.048
Getting runTimeVar %SlowTimeChrome%
[DONE]   | Variable %SlowTimeChrome% added with value 2000

===================================================================================================


---------------------------------------------------
Testcase Name        : Login:Login
Executed Steps       : 6
Passed Steps         : 6
Failed Steps         : 0
Time Taken           : 00:00:10
-----------------------------------------------------

Running Iteration 1
Step:1   | Object: Browser | Action: customNavigationWorkBook | Input:  | Conditon:  | @17-Jun-2019 15:31:48.048
Step:1   | Object: Menu_Header | Action: setObjectProperty | Input: Navigation:App Menu Header | Conditon: #HeaderName | @17-Jun-2019 15:31:48.048
[DONE]   | Setting Object Property for #HeaderName with NON-TRADING for Object [App_Navigation - Menu_Header]

===================================================================================================

Step:2   | Object: Menu_Header | Action: Click | Input:  | Conditon:  | @17-Jun-2019 15:31:48.048
Using @xpath [//div[text()='NON-TRADING']], Object 'Menu_Header' Found in 24 ms
[DONE]   | Clicking on Menu_Header

===================================================================================================

Step:3   | Object: Link_Menu | Action: setObjectProperty | Input: Navigation:App Link Menu | Conditon: #LinkMenu | @17-Jun-2019 15:31:48.048
[DONE]   | Setting Object Property for #LinkMenu with Account Workbook for Object [App_Navigation - Link_Menu]

===================================================================================================

Step:4   | Object: Link_Menu | Action: Click | Input:  | Conditon:  | @17-Jun-2019 15:31:48.048
Using @link_text [Account Workbook], Object 'Link_Menu' Found in 23 ms
[DONE]   | Clicking on Link_Menu

===================================================================================================


---------------------------------------------------
Testcase Name        : Navigation:Navigation_AccountWorkBook
Executed Steps       : 4
Passed Steps         : 4
Failed Steps         : 0
Time Taken           : 00:00:07
-----------------------------------------------------

Running Iteration 1
Step:1   | Object: Textbox_Account | Action: waitForElementToBeClickable | Input:  | Conditon:  | @17-Jun-2019 15:31:56.056
Using @xpath [//input[@formcontrolname='account']], Object 'Textbox_Account' Found in 1255 ms
[DONE]   | 'Textbox_Account' Element becomes Clickable in stipulated time

===================================================================================================

Step:2   | Object: Textbox_Account | Action: customSetText | Input: AWB_InputBar:Account | Conditon:  | @17-Jun-2019 15:31:57.057
Using @xpath [//input[@formcontrolname='account']], Object 'Textbox_Account' Found in 77 ms
[DONE]   | The text box values is entered as :

===================================================================================================

Step:3   | Object: Button_Go | Action: waitForElementToBeClickable | Input:  | Conditon:  | @17-Jun-2019 15:32:00.000
Using @xpath [//button[text()='Go']], Object 'Button_Go' Found in 52 ms
[DONE]   | 'Button_Go' Element becomes Clickable in stipulated time

===================================================================================================

Step:4   | Object: Button_AccountSelect | Action: customSelectDropdownValue | Input: AWB_InputBar:Account | Conditon:  | @17-Jun-2019 15:32:00.000
Using @xpath [//*[@id='account']/div[1]/div/div/span/button], Object 'Button_AccountSelect' Found in 56 ms
[PASS]   | Dropdown value as 3199-9235 [HARKER USE MIXON] is selected. 

===================================================================================================

Step:5   | Object: Dropdown_AccessType | Action: waitForElementToBeClickable | Input:  | Conditon:  | @17-Jun-2019 15:32:01.001
Using @xpath [//input[@formcontrolname='scopeRange']], Object 'Dropdown_AccessType' Found in 66 ms
[DONE]   | 'Dropdown_AccessType' Element becomes Clickable in stipulated time

===================================================================================================

Step:6   | Object: Dropdown_AccessType | Action: customSelectDropdownValue | Input: AWB_InputBar:Access Type | Conditon:  | @17-Jun-2019 15:32:02.002
Using @xpath [//input[@formcontrolname='scopeRange']], Object 'Dropdown_AccessType' Found in 52 ms
[PASS]   | Dropdown value as Rep is selected. 

===================================================================================================

Step:7   | Object: Button_Go | Action: waitForElementToBeClickable | Input:  | Conditon:  | @17-Jun-2019 15:32:03.003
Using @xpath [//button[text()='Go']], Object 'Button_Go' Found in 50 ms
[DONE]   | 'Button_Go' Element becomes Clickable in stipulated time

===================================================================================================

Step:8   | Object: Button_Go | Action: Click | Input:  | Conditon:  | @17-Jun-2019 15:32:06.006
Using @xpath [//button[text()='Go']], Object 'Button_Go' Found in 44 ms
[DONE]   | Clicking on Button_Go

===================================================================================================

Step:9   | Object: Button_Go | Action: waitForElementToBeClickable | Input:  | Conditon:  | @17-Jun-2019 15:32:06.006
Using @xpath [//button[text()='Go']], Object 'Button_Go' Found in 69 ms
[DONE]   | 'Button_Go' Element becomes Clickable in stipulated time

===================================================================================================

Step:10  | Object: Browser | Action: AddVar | Input: AWB_InputBar:Account | Conditon: %lavelCheck% | @17-Jun-2019 15:32:08.008
Adding to runTimeVars %lavelCheck%:3199-9235
Getting runTimeVar %lavelCheck%
[DONE]   | Variable %lavelCheck% added with value 3199-9235

===================================================================================================

Step:11  | Object: Label_Customer's Account Number | Action: customAccountNumValidate | Input: %lavelCheck% | Conditon:  | @17-Jun-2019 15:32:08.008
%lavelCheck% changed to 3199-9235
Using @xpath [//div[@class='wcl-layout-main']//awb-account-information-static], Object 'Label_Customer's Account Number' Found in 56 ms
Getting runTimeVar %lavelCheck%
[PASS]   | Label 3199-9235 is found. 

===================================================================================================

Step:2   | Object: Browser | Action: customNavigatToTabAndSubTab | Input: AWB_Errors_Warnigs:Tab And SubTab | Conditon:  | @17-Jun-2019 15:32:08.008
[PASS]   | The navigationLink Balances is clicked

===================================================================================================

Step:3   | Object: Browser | Action: customVerifyErrWarnInfoMsg | Input: @AWB_Errors_Warnigs | Conditon:  | @17-Jun-2019 15:32:11.011
[PASS]   |  Cash Management Account Balances No Data Available is displayed under Additional InformationSection .

===================================================================================================

[FAIL]   | Trading Dollars Balances INSUFFICIENT TRADING DOLLARS AVAILABLE is not displayed under WarningsSection.

===================================================================================================

[FAIL]   | Trading Dollars Balances PREM TDOL IS NOT TURNED ON is not displayed under WarningsSection.

===================================================================================================


---------------------------------------------------
Testcase Name        : AWB_Errors Warnings:AWB_BAL_001_Balances Error Warning Messages
Executed Steps       : 15
Passed Steps         : 13
Failed Steps         : 2
Time Taken           : 00:00:20
-----------------------------------------------------

Run Finished on Mon Jun 17 15:32:16 IST 2019
-----------------------------------------------------
ExecutionDate        : 17-Jun-2019 15-31-37
Executed TestCases   : 3
Passed TestCases     : 2
Failed TestCases     : 1
Time Taken           : 00:00:38
ReportPath           : file:///C:\GIT\HTML5_CITS_FRAMEWORK\cognizant-intelligent-test-scripter-1.1\Projects\BETA_LINK\Results\TestExecution\HTML5_RFT\Functional\17-Jun-2019 15-31-37\summary.html
-----------------------------------------------------

Global Settings:
#Mon Jun 17 15:41:42 IST 2019
TestRun=false
ProjectPath=C\:\\GIT\\HTML5_CITS_FRAMEWORK\\cognizant-intelligent-test-scripter-1.1\\Projects\\BETA_LINK
ProjectName=BETA_LINK
Browser=chrome
Release=HTML5_RFT
TestSet=Functional
Scenario=Login
TestCase=Login 

shantha laxmi kumar

unread,
Jun 18, 2019, 7:36:54 AM6/18/19
to Cognizant Intelligent Test Scripter
Thanks for the information shared, we will analyse and revert to you.
[DONE]   | Entered Text 'cttgs1.qabt1551@thomsonreuters.com' on 'Textbox_UserName'

shantha laxmi kumar

unread,
Jun 21, 2019, 4:53:44 AM6/21/19
to Cognizant Intelligent Test Scripter
We have analysed the logs and information shared and could see that the fix helped in CLI execution. However in order to execute the same from IDE as well, we have made the following changes. Please find the updated code changes below.

1.Class name : "com.cognizant.cognizantits.engine.cli. LookUp.java”

Add the below line after " private static final Logger LOG = Logger.getLogger(LookUp.class.getName());"

    public static boolean cliflag= false;


2.Class name : "com.cognizant.cognizantits.engine.cli. LookUp.java”
Method Name:  public static void exe(String[] args) 

Add the below line as the first line inside the try block before the line "CommandLineParser parser = new DefaultParser();"

cliflag=true;

3.Class name : com.cognizant.cognizantits.engine.cli
Method name : static void executeWith(Map<String, Option> execution)
Add the below block of code inside the if block - if (execution.containsKey(Op.RS_NAME))

if (execution.containsKey(Op.BROWSER_NAME)) {
                           gSettings.setBrowser(execution.get(Op.BROWSER_NAME).getValue());
                    } else {
                           gSettings.setBrowser("");
                    }


4.Class name : "com.cognizant.cognizantits.engine.core.RunManager.java”
Method : private static void addRunContext(ExecutionStep step, Queue<RunContext> execQ)


Replace the line "exe.BrowserName = step.getBrowser();" by the below code snippet,

String browser = RunManager.getGlobalSettings().getBrowser();

if (browser != null && !(browser.equals(""))   && LookUp.cliflag==true) {
                    exe.BrowserName = browser;
             } else {
                    exe.BrowserName = step.getBrowser();
             }


Please let us know if this works for you.

ramamu...@gmail.com

unread,
Jul 8, 2019, 6:19:52 AM7/8/19
to Cognizant Intelligent Test Scripter
Seems to be working fine now!!

Thanks a lot!!!!
Reply all
Reply to author
Forward
0 new messages