【问题标题】:How to get the total iteration count for data provider如何获取数据提供者的总迭代次数
【发布时间】:2020-02-23 07:06:29
【问题描述】:

我有一个数据提供者,它返回 2d(取自 excel 的数据)并将其传递给 @test。

我想通过自动化激活一些用户,并在执行特定操作后重新激活这些用户。

所以动作指令是通过数据提供者从excel中获取的。用户的激活应该在数据提供者到最后一次迭代之后完成。

excel数据是动态的。所以有什么办法可以找出数据提供者的总行或最终迭代

数据提供者(名称) 返回 2d 的代码

@test(数据提供者名称)

执行操作 (如果它达到最终迭代 取消激活)。有什么办法

【问题讨论】:

    标签: java selenium testng dataprovider


    【解决方案1】:

    如果你有一个二维数组,那么你可以这样做

    int[][] example = new int[4][4];
    
    for(int i=0; i<example.length; i++) {
            for(int j=0; j<example[i].length; j++) {
    
               if (i==example.length-1 && j == example[i].length-1){
    
                       //do your stuff , this is last iteration      
                  }
    
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多