How do I display 3 post each in a bootstrap carousel?

A div with class="item" is used for each carousel slide. But right now your foreach loop is inside that div, not outside, so all of your posts are going into one slide.

So just change that bit to:

<div class="carousel-inner">
    <?php foreach ($lastposts as $post) : setup_postdata ($post); ++$index; ?>
        <div class="item<?php if ($index == 1) { echo ' active'; } ?>">
            // Your post goes here
        </div> <!-- item -->
    <?php endforeach; ?>
</div> <!-- carousel-inner -->

And finally, change your query at the top to get as many posts as you want in the carousel, such as 10:

$args = array( 'post_type' => 'testimonial','numberposts' => 10 );

tech