I have a simple dotnet spark app and I have tried to break it down into units for testing. A sample unit,
public DataFrame filtermyname(DataFrame df, string name)
{
return df.Filter(“name”==name);
}
Since unit test should not have external dependencies, my organisation is not allowing installing spark in the build servers. Is there a way to test this without installing spark by mocking session?
I am not 100% sure I am fully understanding you, or the complications of you architecture.
But I would assume, that the action you have on:
You replace with:
Then implement IFilterSource on the DataFrame class? Or make an implementation of IFilterSource that has DataFrame as a property, and then apply the filter on that property.
so that your method becomes:
Now you can mock the IFilterSource, and use a concrete instance for a DataFrame.