The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> Oracle e-Test

Pages: 1
vfalco02
Newbie


Reged: 07/24/07
Posts: 18
Loc: Conshohocken, PA
OpenScript - Using "web" functionality in classes
      #701358 - 03/14/12 08:26 AM

Hello all,

I am trying to create a class with methods that will use objects stored in my Object Library. I can successfully create and invoke the method, but I am receiving a NullPointerException whenever my method tries to use an object. Below is my code. Any assistance is greatly appreciated.

Main Script:
...
beginStep("[1] Login", 0);
{
WebTest wt = new WebTest();
wt.Login();
}
endStep();
...

Class:
public class WebTest {
@ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities;
@ScriptService oracle.oats.scripting.modules.browser.api.BrowserService browser;
@ScriptService oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft;
@ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web;

public void Login() throws Exception{
browser.close();
web.textBox("{{obj.TestingOL.txt_UserID}}").click();
web.textBox("{{obj.TestingOL.txt_UserID}}").setText("700578");
web.textBox("{{obj.TestingOL.txt_UserID}}").pressTab();
web.textBox("{{obj.TestingOL.txt_Password}}").setPassword("A1b2c3d4");
web.textBox("{{obj.TestingOL.txt_Password}}").pressEnter();
}
}

--------------------
VF
Senior QA Analyst
Oracle


Post Extras: Print Post   Remind Me!   Notify Moderator  
maximusus
Newbie


Reged: 06/22/09
Posts: 7
Loc: Poland
Re: OpenScript - Using "web" functionality in classes [Re: vfalco02]
      #710621 - 06/25/12 05:01 AM

Hi,
You should write sth like this:

in MainScript:
-------------------------
@ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities;
@ScriptService oracle.oats.scripting.modules.browser.api.BrowserService browser;
@ScriptService oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft;
@ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web;

beginStep("[1] Login", 0);
{
WebTest wt = new WebTest(browser, web);
wt.login("700578", "A1b2c3d4");
}
endStep();




Class:
---------------------------------------
public class WebTest {

private BrowserService browser;
private WebDomService web;

public WebTest(BrowserService browser, WebDomService web){
this.browser = browser;
this.web = web;
}


private void closeBrowser(){
browser.close();
}


public void login(String UserId, String pass) throws Exception{
closeBrowser();
web.textBox("{{obj.TestingOL.txt_UserID}}").click();
web.textBox("{{obj.TestingOL.txt_UserID}}").setText(UserId);
web.textBox("{{obj.TestingOL.txt_UserID}}").pressTab();
web.textBox("{{obj.TestingOL.txt_Password}}").setPassword(pass);
web.textBox("{{obj.TestingOL.txt_Password}}").pressEnter();
}


I hope It will help you.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 0 anonymous users are browsing this forum.

Moderator:  Joe Strazzere, martinh, AJ 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 3403

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5