Fatal error: Uncaught Error: Call to undefined function test()

Not sure what your test() function is meant to achieve, or if you’ve even defined it, but yes if you haven’t defined it then it’s undefined.

In reference to your question: “What’s the best method to include all content from profile-card.php and use that shortcode to show it?” The answer is actually in your question, i.e. the best method to include it is to include it, literally. If you haven’t included that PHP file, and your test() function is actually defined in there, then that’s why it’s undefined, because that file was never included.

Granted, I’m somewhat extrapolating what I think you’re trying to do based on the information provided, but try this:

include(__DIR__.'/profile-card.php');
function clearline_func() {
    return test();
}
add_shortcode('test', 'clearline_func');

Or if your profile-card.php file is directly producing output, you can capture the output in a variable and then return it from the shortcode callback function. A shortcode callback function should not produce any output, it should always return the desired output.

Something like this:

function clearline_func(){
    ob_start();
    include(__DIR__.'/profile-card.php');
    test(); //-> You can call your test function here or just call it in the included php file.
    $output = ob_get_clean();
    return $output;
}
add_shortcode('test', 'clearline_func');