0% found this document useful (0 votes)
3 views5 pages

OAT Script

The document contains a script for automated testing using Oracle's OATS framework, which includes HTTP and ADF load services. It outlines the initialization, execution, and cleanup processes for virtual user scripts, as well as subprocess commands for running scenarios and managing batch files. Additionally, it includes commands for logging into and interacting with Oracle's EPMAutomate tool for file uploads and downloads.

Uploaded by

9071802621dj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

OAT Script

The document contains a script for automated testing using Oracle's OATS framework, which includes HTTP and ADF load services. It outlines the initialization, execution, and cleanup processes for virtual user scripts, as well as subprocess commands for running scenarios and managing batch files. Additionally, it includes commands for logging into and interacting with Oracle's EPMAutomate tool for file uploads and downloads.

Uploaded by

9071802621dj
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Co

nfi
de
nti
al - import [Link].*;
Ora
cle import [Link].*;
Res
import [Link].*;
tric
ted import [Link].*;
\
Em import [Link].*;
plo
@SuppressWarnings("unused")
yee
s public class script extends IteratingVUserScript {
Onl
y @ScriptService [Link] http;

@ScriptService [Link] adfload;

boolean isSyncPointsNecessary = false;// true - for response, false - else

int i_ThinkTime_Start = 0000; // 60 secs

int i_ThinkTime_Small = 15000; // 15 secs

// int i_ThinkTime_Small = 10000; //10 secs

int i_ThinkTime_Medium = 15000; // 15 secs

boolean isDebug = false; // false for running in OLT , true in open script

public void initialize() throws Exception {

getVariables().set("Host",

"[Link] [Link]);

[Link]("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36


(KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36");

[Link]("en-US,en;q=0.9");

/** * Add code to be executed each iteration for this virtual user. */

public void run() throws Exception {


Co
getDatabank("ICP_Eaton").getNextDatabankRecord();
nfi
de if (isSyncPointsNecessary)
nti
al - syncPointWait("_Home");
Ora
cle beginStep("[01] HomePage", i_ThinkTime_Small);
Res {
tric
ted [Link](61, "{{Host,[Link] null,
\ [Link]([Link](
Em
plo
yee
s
Onl
y
Co
nfi
de
nti
al - "Upgrade-
Ora Insecure-Requests", "1", [Link])), true, "UTF8", "UTF8");
cle
Res //correlation
tric
{ [Link]("js_afrLoop", "\"_afrLoop\", \"(.+?)\"", "", false,
ted
\ [Link], 0, [Link]); }
Em
plo //looping
yee
s do {
Onl {
y
[Link]("JobStatus", ">{{db.ICP_Eaton.ICP_Name,IC_EMOBILITY_YTD}}</a></div><div>(.
+?)</div>", "", false, [Link], 0, [Link]);

} [Link](60000);

} while (!getVariables().get("JobStatus").contains("Completed"));

info("JobStatus::{{JobStatus}}");

//validation

{ [Link]("Job Complted", "Completed", [Link],

[Link], [Link]); }

endStep();

/**

* Add any cleanup code or perform any operations after all iterations are performed.

*/

public void finish() throws Exception {

Co }
nfi
de
}
nti
al -
Ora
cle
Res
tric
ted
\
Em
plo
yee
s
Onl
y
Co
nfi
de
nti
al - import subprocess
Ora
cle import time
Res
import cx_Oracle
tric
ted #label="210643"
\
Em label="23.04.27_FCCS_23.04.61a"
plo
server=""
yee
s #scenarios=["NV","MR"]
Onl
y scenarios=["Forms_CT","JR"]

#scenarios=["SV_CT","Forms_CT","Forms_BL","Forms_PL","ICP","SV_FP","MR_Book","MR_HTML","
MR_PDF"]

users=[1,5,10]

cmd_base="D:\\OracleATS\\jdk\\bin\\java -jar [Link] "

cmd_server="-OLTServer=localhost:8088 -user=oats -password=welcome1 "

#db = cx_Oracle.connect('fusionepm_reg', 'welcome1', 'slc15gtv:1521/[Link]')

#cursor = [Link]()

#script = "begin\ndbms_stats.gather_schema_stats(ownname => 'FUSIONEPM_REG',


no_invalidate=> false, estimate_percent=> 100, cascade => TRUE, method_opt => 'FOR ALL
COLUMNS SIZE AUTO' );\nend;"

#script = "begin\ndbms_stats.gather_schema_stats(ownname => 'MNZY2NJXMATE', no_invalidate=>


false, estimate_percent=> 100, cascade => TRUE, method_opt => 'FOR ALL COLUMNS SIZE AUTO' );\
nend;"

for scenario in scenarios:

for n in users:

# cmd_scenario="-scenarioFile=D:\\OATS_Python\\"+scenario+"_"+server+".scn "

cmd_scenario="-scenarioFile=D:\\OATS_Python\\"+scenario+"_"+str(n)+".scn "

Co cmd_session=scenario+"_"+label+"_"+server+"_"+"{0:03d}".format(n)+"u"
nfi
cmd_log="-log=D:\\OATS_Python\\"+cmd_session+".log "
de
nti cmd1=cmd_base+"-run "+cmd_scenario+cmd_server+cmd_log+"-session="+cmd_session+" -
al - VUCount="+str(n)
Ora
cle print(cmd1)
Res
tric out=subprocess.check_output(cmd1, shell=True, cwd='D:\OracleATS\lib')
ted
print(out)
\
Em cmd2=cmd_base+"-status "+cmd_server+"-session="+cmd_session
plo
yee
s
Onl
y
Co
nfi
de
nti
al - out=subprocess.check_output(cmd2, shell=True, cwd='D:\OracleATS\lib').decode('utf-8')
Ora
cle print(out)
Res
while "running" in subprocess.check_output(cmd2, shell=True, cwd='D:\OracleATS\
tric
lib').decode('utf-8'):
ted
\ [Link](30)
Em
plo print("running")
yee
s print("stopped")
Onl # [Link](script)
y
//////////////////////////////////////////////////////////////////////////////////////

// MMC batch run

///////////////////////////////////////////////////////////////////////////////////////////

import util

import subprocess

from pathlib import Path

import [Link]

MAX_WORKERS = 10 # Configure max workers here

# First, collect location/periods from .txt files under inbound/GL

batch_files = []

for gl_file in [Link](util.GL_DIR, ".txt"):

location, scenario, periodWithExt = gl_file.[Link]("~")

period = [Link](".")[0]

batch_files.append((location, period))

pathToGlLoadScript = Path(__file__).parent / "load_gl.py"

with [Link](max_workers=MAX_WORKERS) as executor:


Co
futures = {}
nfi
de for location, period in batch_files:
nti
al - # schedule parallel execution and map to location and period string
Ora
cle futures[[Link](subprocess.check_output, ["python", str(pathToGlLoadScript), location,
Res period])] = f"{location}_{period}"
tric
for future in [Link].as_completed(futures):
ted
\ location_and_period = futures[future]
Em
plo try:
yee
s
Onl
y
Co
nfi
de
nti
al - [Link]()
Ora
cle except Exception as exc:
Res
print(f'GL {location_and_period} generated an exception')
tric
ted else:
\
Em print(f'GL {location_and_period} completed')
plo
////[Link]////////////////////
yee
s Call C:\Oracle\EPMAUT~1\bin\epmautomate login epm_default_cloud_admin welcome1
Onl [Link]
y
C:\Oracle\EPMAUT~1\bin\epmautomate uploadfile C:\Oracle\EPMAutomate\LCM\DM\
LCM_Merck_Sep22_Unlocked.zip

REM C:\Oracle\EPMAUT~1\bin\epmautomate deletefile LCM_Merck_Sep22_Unlocked.zip

REM C:\Oracle\EPMAUT~1\bin\epmautomate importsnapshot LCM_Merck_Sep22_Unlocked

Pause

REM Call C:\Oracle\EPMAUT~1\bin\epmautomate downloadfile "Artifact Snapshot"

Call C:\Oracle\EPMAUT~1\bin\epmautomate logout

Co
nfi
de
nti
al -
Ora
cle
Res
tric
ted
\
Em
plo
yee
s
Onl
y

You might also like