Erwartetes VerhaltenRun verschiedene Datensätze für jeden Test in einer Sequenz für jede Iteration unter Verwendung des Test NG
Der Punkt ist hier, dass ich erwartet habe, ist, die Daten für jeden des Tests in Sequenz iterieren für jede Iteration, so alle Tests sollten in mit dem ersten Satz von Daten ausführen, folgt von den zweiten bis zum Ende
public class SampleFactory {
DataGenerators dataGen;
@Factory(dataProvider="dp")
public Object[] createInstances(String country, String email, String firstName, String securityQuestion, String title, String ccyFrom, String ccyTo) {
return new Object[] {new PersonalRegoTest(country, email, firstName, securityQuestion, title, ccyFrom, ccyTo)};
}
@DataProvider(name="dp")
public static Object[][] dataProvider() {
// dataGen = new DataGenerators();
Object[][] dataArray = {
{"country1", "[email protected]","abc", "Model", "Mr", "AUD", "USD"},
{"country2", "[email protected]","abcd", "Model", "Mr", "USD", "NZD"}
};
return dataArray;
}
}
Und mein PersonalRegoTest wird wie folgt
public class PersonalRegoTest extends Appium {
PersonalRego personalRego;
DataGenerators dataGen;
String country="";
String email="";
String firstName="";
String securityQuestion="";
String title="";
String ccyFrom="";
String ccyTo="";`
PersonalRegoTest(String country, String email, String firstName, String
securityQuestion, String title, String ccyFrom, String ccyTo) {
super();
this.country = country;
this.email = email;
this.firstName = firstName;
this.securityQuestion = securityQuestion;
this.title = title;
this.ccyFrom = ccyFrom;
this.ccyTo = ccyTo;
}
@BeforeClass(alwaysRun = true)
public void initialize() throws IOException {
personalRego = new PersonalRego(driver, System.getProperty("platform"));
dataGen = new DataGenerators();
}
@Test(priority = 1, alwaysRun=true, description="select of Personal Rego form", groups="personalRego")
public void verifyPersonalRegoPageWindow() {
personalRego.isPersonalRegoWindowDisplayed();
}
@Test(priority = 2, alwaysRun=true, description = "fill step 1 of Personal Rego form", groups="personalRego")
public void validateAndCompletePersonalRegoForm_FirstPage() {
...
}
@Test(priority = 3, alwaysRun=true, description = "fill step 2 of Personal Rego form", groups="personalRego", dependsOnMethods = "validateAndCompletePersonalRegoForm_FirstPage")
public void validateAndCompletePersonalRegoForm_SecondPage() {
...
}
@Test(priority = 4, alwaysRun=true, description = "fill step 3 of Personal Rego form", groups="personalRego", dependsOnMethods = {"validateAndCompletePersonalRegoForm_FirstPage", "validateAndCompletePersonalRegoForm_SecondPage"})
public void validateAndSubmitPersonalRegoForm_ThirdPage() {
...
}
@Test(priority = 5, alwaysRun=true, description = "Last step of Personal Rego form to reset app", groups="personalRego", dependsOnMethods = {"validateAndSubmitPersonalRegoForm_ThirdPage"})
public void resetApplication(String reset) {
System.out.println("reset application ");
..
}
PFA das ähnliche Ergebnis wie zuvor. Bitte teilen Sie mir, wenn ich jetzt etwas falsch zu machen bin
Aktuelles Problem: Meine Tests als
verifyPersonalRegoPageWindow
verifyPersonalRegoPageWindow(1)
validateAndCompletePersonalRegoForm_FirstPage
validateAndCompletePersonalRegoForm_FirstPage(1)
validateAndCompletePersonalRegoForm_SecondPage
validateAndCompletePersonalRegoForm_SecondPage(1)
..
Erwartetes Ergebnis
Iteration - 1
verifyPersonalRegoPageWindow
validateAndCompletePersonalRegoForm_FirstPage
validateAndCompletePersonalRegoForm_SecondPage
..
Iteration - 2
verifyPersonalRegoPageWindow
validateAndCompletePersonalRegoForm_FirstPage
validateAndCompletePersonalRegoForm_SecondPage
..
jemand folgt läuft Kann bitte beraten als ich hier geschlagen wurde?
Versuchen Sie mit Gruppen-by-Instanzen. http://testng.org/doc/documentation-main.html#dependencies-with-annotations – Grasshopper
Welchen Unterschied macht es? Tests sollten in beliebiger Reihenfolge ablaufen können. Das Endergebnis ist das gleiche, alle Tests werden ausgeführt. – JeffC
@Grasshopper Danke für Ihre Antwort. Ich lief nur nach Gruppen. – Brad