How to reduce duplication for multiple similar test packages

Hi,

I’m writing a test that will go through multiple packages that will all contain a list of structs with the actual tests and one function to run against the data. The list and function will all be called the same thing in all of the packages. What I would like to avoid is having the same X number of lines per package and would like to be able to have a single function/group of instructions that can go through all of the imported test packages.

I would have done a search for this but I’m not really sure how to do a search for this.

Does anyone have suggestions about how to reduce the duplication in this scenario?

Thanks,

Rob

2 Likes

I recently published about large-scale approach related to testing which has the “duplication” as part of the encountered problem.

Hope it helps. Link is here: https://sites.google.com/view/chewkeanho/careers/researches/large-scale-unit-testing-for-go-programming-langauges

1 Like

Hi,

The link on the page you reference appears to be incorrect. However if I go directly to doi.org and do a search on the ID, I do find the paper.

Thanks,

Rob

2 Likes

Just checked the link. It is working on-click but not suitable for URL copy-and-paste. Apparently, Google Sites converts all links into its URL redirecting format.

For direct link, you can try: http://doi.org/10.13140/RG.2.2.36308.76166.

1 Like

So took a brief look at the paper. As it turns out I had already decided on a table-driven approach. At the time I didn’t know that was a thing, it just seemed to make sense to me. I guess I can feel validated in the approach I chose :slight_smile:

Thank-you,

Rob

2 Likes

The paper goes beyond that as table-driven approach is only half way there. There were too many duplication that table-driven approach can’t solve on its own.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.