question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to merge datasets

See original GitHub issue

Case:

  1. Meta dataset is defined and includes several dataset files are common for all tests.
  2. Any test is needed its specific dataset in addition to common data in meta dataset.

DataSet in test is override metadataset.

I think it’s a good idea to make some dataset mode flags to manage included datasets, for example:

/*Meta dataset with common data*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@DataSet(value = {"SomeData1.xml", "SomeData2.xml", "SomeData3.xml"},
        strategy = SeedStrategy.CLEAN_INSERT)
public @interface MetaDataset {
}

@MetaDataset
public class SomeDaoTest {
  ...
  @Test
  @DataSet(value = "before-update.xml", mode=DatasetMergeMode .DATASET)
  @ExpectedDataSet(value = "after-update.xml")
  public void updateTest() {
      ...
  }

  @Test
  @DataSet(value = "before-delete.xml", mode=DatasetMergeMode .DATASET)
  @ExpectedDataSet(value = "after-delete.xml")
  public void deleteTest() {
      ...
  }
}

Possible modes can affect all dataset parameters:

class DatasetMergeMode {
   public static final int DATASET = 1;   
   public static final int BEFORE_STATEMENTS= 2;
   public static final int AFTER_STATEMENTS = 4;
  .....
}

Because default behavior is “override”, only merge is interested.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (18 by maintainers)

github_iconTop GitHub Comments

2reactions
artemy-osipovcommented, Sep 10, 2018

Hi, I think merging datasets on annotations, classes and methods is good idea in some cases, but configuring priorities and modes are overcomplication. We can start with choosing good default merging behaviour.

Maybe I’m being too simplistic but my idea is to create (merge) one dataset based on datasets declared on class level (be it metataset or not) and on dataset declared on the test level. So for example if both declare executeStatementsBefore their values will just be merged in one executeStatementsBefore

Agreed! For my opinion datasets on annotation must be specified for common setup like filling reference data, while datasets on methods are more test specific. What do you think about such ordering?

  • executeStatementsBefore on annotation level
  • executeStatementsBefore on class level
  • executeStatementsBefore on method level
  • executeScriptsBefore on annotation level
  • executeScriptsBefore on class level
  • executeScriptsBefore on method level
  • datasets on annotation level
  • datasets on class level
  • datasets on method level
  • executeScriptsAfter on method level
  • executeScriptsAfter on class level
  • executeScriptsAfter on annotation level
  • executeStatementsAfter on method level
  • executeStatementsAfter on class level
  • executeStatementsAfter on annotation level
1reaction
rmpestanocommented, Sep 16, 2018

Hi folks, I’ve opened the PR #94, it would be nice if someone could have a look and also try it locally.

Thank you so far!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combining Datasets: Merge and Join | Python Data Science ...
The pd.merge() function recognizes that each DataFrame has an "employee" column, and automatically joins using this column as a key. The result of ......
Read more >
How to COMBINE DATA with MERGE and APPEND in Power BI
Learn how to use merge and append to combine data sets in Power BI.
Read more >
How to Append / Combine two datasets Power BI ... - YouTube
How to combine two datasets In Power BI, We explained in which business scenario you will combine / Append data in Power BI,...
Read more >
Merge queries and join tables - Microsoft Support
Merge queries and join tables ; Sales Data worksheet, open Power Query, and then select ; Home > ; Combine > ; Merge...
Read more >
Merging Datasets in R - DataCamp
At the high level, there are two ways you can merge datasets; you can add information by adding more rows or by adding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found