Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

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 5
Syndicate_Admin
Administrator
Administrator

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.

v-piga-msft
Resident Rockstar
Resident 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

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not 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:Capture.JPG

 

 

ImkeF
Community Champion
Community 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-com... 

Please check out the options described there.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Thank you for your response @ImkeF. I have looked through the articles and tried the solutions (setting privacy levels to none) but to no avail.

 

It seems, according to this thread, that the issue is still quite prevalent in the latest version of Power BI Desktop. I will continue to monitor the thread for future resolutions.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.