私はこれらの2つのクラスで3つのメソッド/テストを持つ2つのクラスを作成しました。第1クラスでは2つの方法/テスト、第3の方法では第2クラスです。しかし、これらをxmlで実行すると、第1クラスはテストとテストの両方を実行し、第2クラスのメソッド/テストはスキップします。2番目のクラスで作成されたメソッドは、xmlを使用してTestngで2つのクラスを実行している間スキップされました
XML:
<?xml version="1.0" encoding="UTF-8"?>
<suite name= "Expedia Call Tracker">
<test name="Expedia Home Smoke Testcases">
<classes>
<class name="ExpediaCallTracker.Expedia"/>
<class name="ExpediaCallTracker.ExpediaCreateSale" />
</classes>
</test>
</suite>
First Class :
package ExpediaCallTracker;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
public class Expedia {
public String e;
WebDriver expedia = new FirefoxDriver();
@Test(priority=1)
public void ExpediaLogin()
{
expedia.manage().window().maximize();
expedia.get("http://fedev.teleperformanceusa.com/Expedia/ExpediaCallTracker/Account/Login");
expedia.findElement(By.id("UserName")).sendKeys("kochhar.5");
expedia.findElement(By.id("Password")).sendKeys("Password11");
expedia.findElement(By.xpath(".//*[@id='loginForm']/form/fieldset/p/input")).click();
}
@Test(priority=2)
public void ExpediaDashSale()
{
expedia.findElement(By.linkText("Sale - HWW/EAN")).click();
}
}
Second Class :
package ExpediaCallTracker;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class ExpediaCreateSale {
private static final WebDriver d = null;
public ExpediaCreateSale()
{
}
WebDriver expedia = d;
@Test
public void ExpediaCreate(WebDriver d)
{
expedia.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Select LineOfBusiness = new Select(expedia.findElement(By.id("lineOfBusiness")));
LineOfBusiness.selectByIndex(1);
expedia.findElement(By.id("sourceCode")).sendKeys("abcdefgh");
WebElement Upsell = expedia.findElement(By.xpath("html/body/div[1]/section[2]/form/fieldset/div[6]/input[1]"));
Upsell.click();
WebElement SaleCall =expedia.findElement(By.xpath("html/body/div[1]/section[2]/form/fieldset/div[8]/input[1]"));
SaleCall.click();
expedia.findElement(By.id("checkInDate")).sendKeys("09/14/2016");
Select numberOfNights = new Select(expedia.findElement(By.id("numberOfNights")));
numberOfNights.selectByIndex(1);
WebElement PaymentMethod = expedia.findElement(By.xpath("html/body/div[1]/section[2]/form/fieldset/div[9]/div[6]/input[1]"));
PaymentMethod.click();
Select currency = new Select(expedia.findElement(By.id("currency")));
currency.selectByIndex(70);
expedia.findElement(By.id("grossBooking")).sendKeys("123456");
expedia.findElement(By.id("itineraryNumber")).sendKeys("123456789");
expedia.findElement(By.id("remark")).sendKeys("Itinery number saved.");
expedia.findElement(By.xpath(".//*[@id='body']/section[2] /form/fieldset/p/input[1]")).click();
}
}
誰も私が何をしようとすべきかを提案することはできますか?
あなたはあなたの 'testng.xml' – Paras
の<?xml version = "1.0" エンコード= "UTF-8"?> <スイート名= "ホテルズドットコールトラッカー"> <テスト名="ホテルズドットのホームを共有することができますテストケースの煙 "> を<クラス名=" ExpediaCallTracker.Expedia "/> <クラス名=" ExpediaCallTracker.ExpediaCreateSale - ExpediaCreate」/ "> <! \t \t \t \t <名前=含めます"> \t \t \t \t \t \t \t \t \t \t \t \t \t <除外名= "testMakeOrder" /> \t \t \t \t \t \t \t - > \t \t –
あなたの質問を編集して、両方のクラスのコードを置くことができますか? – Paras