use Test::Most; use Test::Moose; use MooseX::ClassCompositor; use MyCoolNewRole v1.0;#To test for version availability my @attributes = qw( first_attribute ); my @methods = qw( important_method ); my ( $instance ); my $class = MooseX::ClassCompositor->new({ class_basename => 'Test', })->class_for( 'MyCoolNewRole', ); map has_attribute_ok( $class, $_ ), @attributes; map can_ok( $class, $_ ), @methods; lives_ok{ $instance = $class->new( first_attribute => 'cool', )} 'Test creation of an instance'; # other cool tests, for example; # is( 42, $instance->important_method( '?' ), 'The answer') ) done_testing();