如果我们调用具有优先级的方法,则无法使方法失败/通过报告

时间:2018-10-03 10:03:17

标签: testng

我有以下代码,它从字符串中读取ID并检查数据,如果数据包含某些图表名称,它将调用method,在“ for循环”再次终止后,该方法正在执行并跳过这些方法,但是在loop终止之后,这些方法不要执行,我该怎么办 @Test

public static void Repository(String sdataID) throws InterruptedException
 {
        String[] arrSplit = sdataID.split(",");

        for (int i = 0; i < arrSplit.length; i++) {
            String Query="#"+arrSplit[i]+" > div.viewletBody > div.widget-head";                
            String Data=driver.findElement(By.cssSelector(Content)).getText();                  
            try {

                if(Query.contains("ANOMALYCHART")|| Query.contains("anomalychart") )   
                {
                    AnomalyChart(Data);
                }
                if(Query.contains("AREACHART")|| Query.contains("areachart") )
                {
                    AreaChart(Data);
                }
                if(Query.contains("BARCHART")|| Query.contains("barchart") )
                {
                    BarChart(Data);
                }

            }
                catch(Exception ex)
                {
              System.out.println("ex");
                }
            }
        }                       
    }
                @Test(priority=1)
                private static void AnomalyChart(String Data) {
                    if(Data.contains("Please modify the query")  || Data.contains("No record found") )
                {
                        System.out.print("Viewlet not plotted");

                        driver.findElement(By.cssSelector("hhhhh")).click();                    
                }
                }

                @Test(priority=2)
                private static void AreaChart(String Data) {
                    if(Data.contains("Please modify the query")  || tData.contains("No record found") )
                    {
                        System.out.print("Viewlet not plotted");
                        driver.findElement(By.cssSelector("hhhhh")).click();

                    }

                }
                @Test(priority=3)
                private static void BarChart(String Data) {
                    if(Data.contains("Please modify the query")  || Data.contains("No record found") )
                    {
                        System.out.print("Viewlet not plotted");
                        driver.findElement(By.cssSelector("hhhhh")).click();
                    }

                }

                }

                }
}

0 个答案:

没有答案