Forum Discussion
Power Query SDK Unit Testing Error
I am writing a custom data connector using the Power Query SDK in Visual Studio. I have started to write unit tests as per this documentation: https://docs.microsoft.com/en-us/power-query/handlingunittesting . However, I am finding if I have two Facts that call the same function, but with different arguments, I get an error 'Information is needed in order to combine data' and the unit tests won't execute.
As an example, the following unit tests will execute correctly as I am calling the same thing twice:
shared MyExtension.UnitTest1=
[
facts =
{
Fact( "Test1",
1,
Table.RowCount(Data_Connector("Argument1", "Argument2"))
),
Fact( "Test2",
1,
Table.RowCount(Data_Connector("Argument1", "Argument2"))
)
},
report = Facts.Summarize(facts)
][report];However, the below will not, now that one of the arguments in the Data_Connector function is different:
shared MyExtension.UnitTest1=
[
facts =
{
Fact( "Test1",
1,
Table.RowCount(Data_Connector("Argument1", "Argument2"))
),
Fact( "Test2",
5,
Table.RowCount(Data_Connector("SomethingElse1", "SomethingElse2"))
)
},
report = Facts.Summarize(facts)
][report];Running the two tests manually in PowerBI returns the expected Table.RowCount results.
I have the latest version of Visual Studio and the Power Query SDK.
Any thoughts? It's doing my head in.
5 Replies
- v-piga-msftResident Rockstar
Hi Anonymous ,
Do you get error when you run the code in Visual Studio or in Power BI ?
If it is convenient, could you share the screenshot of the error message so that I could understand better?
In addtion, maybe ImkeF has other ideas.
Best Regards,
Cherry
- AnonymousNot applicable
Hi v-piga-msft - I am getting the error code in Visual Studio when I go to 'run' my Data_Connector.query.pq file which contains the unit tests. Please see screenshot below:
- ImkeFCommunity Champion
This could be due to incompatible privacy settings. There are a lot of threads in this forum with similar problems, like this i.e.: https://community.powerbi.com/t5/Service/Refresh-error-message-Information-is-needed-in-order-to-combine/td-p/234722
Please check out the options described there.
- Syndicate_AdminAdministrator
Hi,
Do I have to use Power BI to do unit testing for my project in Power Apps? Is there a way to directly connect Visual Studio's Power Query SDK with the project I created in Power Apps for unit testing? If so, could you provide relevant tutorials?
Thanks.