Skip to content

Combine all tests into one munged coverage report #167

@edwardbr

Description

@edwardbr

Hi for legacy reasons we have numerous unit tests that cover different bits of code on the same code base, unfortunately this then means that we have no global view of what areas of our code base have not been covered.

To solve this I hacked your app to do this munging changing this
` Plugin::CoverageData CoverageDataMerger::Merge(
const std::vectorPlugin::CoverageData& coverageDataCollection) const
{
auto coverageData = CreateCoverageData(coverageDataCollection);

	std::map<fs::path, std::vector<Plugin::ModuleCoverage*>> modulesByPath =
		GroupChildrenByKey<Plugin::CoverageData, fs::path, Plugin::ModuleCoverage>(
			coverageDataCollection,
			[](const Plugin::CoverageData& data) -> const Plugin::CoverageData::T_ModuleCoverageCollection& { return data.GetModules(); },
			[](const Plugin::ModuleCoverage& module) -> const fs::path& { return module.GetPath(); });
	
	for (const auto& pair : modulesByPath)
	{
		auto& module = coverageData.AddModule(pair.first);
		FillModule(module, pair.second);
	}
	
	return coverageData;
}`

to this:
` Plugin::CoverageData CoverageDataMerger::Merge(
const std::vectorPlugin::CoverageData& coverageDataCollection) const
{
auto coverageData = CreateCoverageData(coverageDataCollection);
fs::path global_path("Global");

	std::map<fs::path, std::vector<Plugin::ModuleCoverage*>> modulesByPath =
		GroupChildrenByKey<Plugin::CoverageData, fs::path, Plugin::ModuleCoverage>(
			coverageDataCollection,
			[](const Plugin::CoverageData& data) -> const Plugin::CoverageData::T_ModuleCoverageCollection& { return data.GetModules(); },
			[&](const Plugin::ModuleCoverage& module) -> const fs::path& { return global_path; });
	
	for (const auto& pair : modulesByPath)
	{
		auto& module = coverageData.AddModule(pair.first);
		FillModule(module, pair.second);
	}
	
	return coverageData;
}`	

I am testing it now I hope it works however, it would be very nice if we could have a --munge type command line parameter so that we could do this in one app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions