- l3l00Active particpant
- Posts : 11
Join date : 2015-01-06
Page Objects and testcases in Test cases Problem cSharp
Tue Jan 06, 2015 2:23 am
So, I have setup a class that contains the setup & teardown attributes called Gears.
I have a class that holds the pageObjects and Gears is extended on it and a class for the testcases - Gears also extended on it as well.
So I will have a test case like:
Test
public void test_pageObjectISSue() {
payments_targetPoints pageObject = new payments_targetPoints();
driver.Navigate().GoToUrl("someURL");
driver.Navigate().GoToUrl("someURL");
pageObject.testEcho();
}
Another:
Test
public void test_shouldwork() {
payments_targetPoints pageObject = new payments_targetPoints();
test_pageObjectISSue();
pageObject.testEcho();
}
public void testEcho()
{
Utilities genUtilz = new Utilities();
this.driver = driver;
try
{
Console.Write("\n" + "This is just a simple test");
driver.Navigate().GoToUrl("someURL");
genUtilz.WaitForTesto("tag", "body", 10, driver);
}
catch {
Console.Write("\n" + "could not print");
driver.Quit();
}
}
The second test case calls the first one, what I have been noticing on my other test cases, I would get the pageObject I would call to fail? This one I get an Object Reference no initiated, however on others, it will run through just fine but the pageObject try & catch will catch everytime. I do not know what I am doing wrong?
I have a class that holds the pageObjects and Gears is extended on it and a class for the testcases - Gears also extended on it as well.
So I will have a test case like:
Test
public void test_pageObjectISSue() {
payments_targetPoints pageObject = new payments_targetPoints();
driver.Navigate().GoToUrl("someURL");
driver.Navigate().GoToUrl("someURL");
pageObject.testEcho();
}
Another:
Test
public void test_shouldwork() {
payments_targetPoints pageObject = new payments_targetPoints();
test_pageObjectISSue();
pageObject.testEcho();
}
public void testEcho()
{
Utilities genUtilz = new Utilities();
this.driver = driver;
try
{
Console.Write("\n" + "This is just a simple test");
driver.Navigate().GoToUrl("someURL");
genUtilz.WaitForTesto("tag", "body", 10, driver);
}
catch {
Console.Write("\n" + "could not print");
driver.Quit();
}
}
The second test case calls the first one, what I have been noticing on my other test cases, I would get the pageObject I would call to fail? This one I get an Object Reference no initiated, however on others, it will run through just fine but the pageObject try & catch will catch everytime. I do not know what I am doing wrong?
Permissions in this forum:
You cannot reply to topics in this forum