TT#74160 Make package ngcp-api-testframework

Make new 'ngcp-api-testframework' package with module:
NGCP::API::TestFramework

Move the module source from t/api/rest2/lib/ to lib/
Change paths accordingly in module files.

Change-Id: I7a4b08ecac1059533628771ea4faf2eb10dba41f
changes/99/37399/7
Victor Tsvetov 6 years ago
parent 7327cf02a0
commit 77b3834bae

19
debian/control vendored

@ -152,3 +152,22 @@ Description: tools from ngcp-panel application
A completely overhauled provisioning interface for the NGCP system.
.
This package contains some helper tools from ngcp-panel
Package: ngcp-api-testframework
Section: perl
Architecture: all
Depends:
${misc:Depends},
${perl:Depends},
libcpanel-json-xs-perl,
libdata-walk-perl,
libdatetime-format-iso8601-perl,
libdatetime-format-strptime-perl,
liblog-log4perl-perl,
libmoose-perl,
liburi-perl,
libwww-perl,
libyaml-libyaml-perl,
Description: TestFramework for testing NGCP API functionalities
The NGCP API Test Framework is designed to run over the API rails and test
its basic functionalities, using yaml scenarios.

@ -0,0 +1,2 @@
usr/share/perl5/NGCP/API/TestFramework.pm
usr/share/perl5/NGCP/API/TestFramework

@ -8,4 +8,5 @@ share/* usr/share/ngcp-panel/
usr/share/man/man3/NGCP::*
usr/share/perl5/Catalyst/Plugin/NGCP
usr/share/perl5/NGCP
usr/share/perl5/NGCP/Panel.pm
usr/share/perl5/NGCP/Panel

@ -1,4 +1,4 @@
package TestFramework;
package NGCP::API::TestFramework;
use strict;
use warnings;
@ -18,9 +18,9 @@ use URI;
use YAML::XS qw(LoadFile);
use Data::Dumper;
use TestFramework::RequestBuilder;
use TestFramework::Client;
use TestFramework::TestExecutor;
use NGCP::API::TestFramework::RequestBuilder;
use NGCP::API::TestFramework::Client;
use NGCP::API::TestFramework::TestExecutor;
has 'file_path' => (
isa => 'Str',
@ -35,15 +35,15 @@ sub run {
chomp $test_case_name;
Log::Log4perl->easy_init( { level => $DEBUG,
file => ">>/results/$test_case_name.log",
category => "TestFramework::Client",
category => "NGCP::API::TestFramework::Client",
layout => '%d - %F{1} line %L - %M: %m%n' },
{ level => $DEBUG,
file => ">>/results/$test_case_name.log",
category => "TestFramework::RequestBuilder",
category => "NGCP::API::TestFramework::RequestBuilder",
layout => '%d - %F{1} line %L - %M: %m%n' },
{ level => $DEBUG,
file => ">>/results/$test_case_name.log",
category => "TestFramework::TestExecutor",
category => "NGCP::API::TestFramework::TestExecutor",
layout => '%d - %F{1} line %L - %M: %m%n' },
{ level => $DEBUG,
file => ">/results/$test_case_name.log",
@ -65,11 +65,11 @@ sub run {
INFO( "Setting up the base URI." );
my $base_uri = $ENV{CATALYST_SERVER} || ('https://'.hostfqdn.':4443');
INFO( "Setting up the RequestBuilder." );
my $request_builder = TestFramework::RequestBuilder->new({ base_uri => $base_uri });
my $request_builder = NGCP::API::TestFramework::RequestBuilder->new({ base_uri => $base_uri });
INFO( "Setting up the Client." );
my $client = TestFramework::Client->new( { uri => $base_uri } );
my $client = NGCP::API::TestFramework::Client->new( { uri => $base_uri } );
INFO( "Setting up the Test Executor." );
my $test_executor = TestFramework::TestExecutor->new();
my $test_executor = NGCP::API::TestFramework::TestExecutor->new();
# initializing time to add to fields which need to be unique
my $retained = { unique_id => int(rand(100000)) };

@ -1,4 +1,4 @@
package TestFramework::Client;
package NGCP::API::TestFramework::Client;
use strict;
use warnings;
@ -170,4 +170,3 @@ sub perform_request {
}
1;

@ -1,4 +1,4 @@
package TestFramework::RequestBuilder;
package NGCP::API::TestFramework::RequestBuilder;
use strict;
use warnings;

@ -1,4 +1,4 @@
package TestFramework::TestExecutor;
package NGCP::API::TestFramework::TestExecutor;
use strict;
use warnings;

@ -1,9 +1,9 @@
#!/usr/bin/perl
use lib 't/api-rest2/lib';
use lib 'lib';
use strict;
use warnings;
use TestFramework;
use NGCP::API::TestFramework;
use threads;
use Thread::Queue;
use Data::Dumper;
@ -73,7 +73,7 @@ sub worker {
chomp $test_file;
my $start_time = time;
print "Running tests from $test_file\n";
my $test_framework = TestFramework->new( {file_path => $test_file} );
my $test_framework = NGCP::API::TestFramework->new( {file_path => $test_file} );
my $result = $test_framework->run();

Loading…
Cancel
Save