Xceptance / neodymium-library

A test automation library based on common other best practice open source libraries. It adds missing functionalities but does not reinvent the wheel. Just glues stuff together nicely and adds some sprinkles.
MIT License
80 stars 11 forks source link

Random DataSet annotation #153

Closed occupant23 closed 5 months ago

occupant23 commented 3 years ago

It would be nice to have an annotation that selects one or more data sets out of all available data sets.

e.G.:

@Retention(RUNTIME)
@Target({
  TYPE, METHOD
})
public @interface RandomDataSet()
{
    int value() default 1;
}

value = 1 would mean choose one set randomly. If the more data sets than available should be picked randomly an exception should be raised.

occupant23 commented 3 years ago

Another/better idea would be to extend the existing DataSet annotation and add a randomSets parameter. This could avoid some problems when we would uses 2 different annotations.

occupant23 commented 3 years ago

@oomelianchuk Code approved and merged. Please go on and create the documentation for this feature.

oomelianchuk commented 3 years ago

Documentation of this feature is created and committed to the develop branch of the neodymium-library.wiki project with the commit message " #153 documentation for randomSets parameter of DataSet annotation"

occupant23 commented 3 years ago

@oomelianchuk: Please revisit the RandomnessOfDataSets test I just saw that the method test2 will fail if the randomly created order of the datasets will be the same as in the data file but this a very likely event. Let us chat about possible solutions before implementation.

occupant23 commented 3 years ago

@oomelianchuk While rechecking the RandomBrowser annotation I rethought this ticket and found that we are missing some combinations and have some strange edge cases with the current implementation.

I would like to support such a case

@DataSet(1)
@DataSet(3)
@DataSet(4)
@DataSet(7)
@DataSet(11)
@DataSet(12)
@RandomDataSets(2)
public class MyTest() {
  public void test1() {
    // do something
  }

  @DataSet(2)
  @DataSet(5)
  public void test2() {
    // do something different
  }

  @RandomDataSets(3)
  public void test3() {
    // do something completely different
  }
}

I think we could achieve suche a behavior when we adjust the current implementation but we would have to explain a lot more the documentation. And would have to cover/document edge cases like double definition of random number etc.

Please revisit the issue (new branch for development, new test cases etc.).

occupant23 commented 3 years ago

@georgkunze: Please test this feature and check the documentation (should be available in the wikis dev branch).

georgkunze commented 3 years ago

@occupant23 Test done. Checked also the documentation

georgkunze commented 5 months ago

Rechecked again and closed