use Modern::Perl; use strict; use warnings; package MyTestingSuite; use parent 'Test::Class'; use Test::Selenium::Remote::Driver; use Test::More; use POSIX qw(strftime); my $start = time(); cprint "Started at ", (strftime '%A %d %B %Y %H:%M:%S',localtime($star +t)), "\n"; sub startup : Test( startup => no_plan ) { my $self = shift; $self->{browsers} = [('firefox', 'internet explorer', 'chrome', 'pha +ntomjs')]; } # WHEN I PUT MY END TIME HERE: my $end = time(); cprint "Ended at ", (strftime '%A %d %B %Y %H:%M:%S', localtime($end +)),"\n"; cprintf "Total run time:", $end-$start, " seconds\n"; printf ("%02d:%02d:%02d\n",(gmtime($end-$start))[2,1,0]); I HAVE THIS OUTPUT IN MY SHELL: Started at 2016-05-17-16-55-00 1..0 Ended at 2016-05-17-16-57-04 Total run time:0 seconds .....ALL MY TESTS ..... sub Login_test : Tests { $driver->quit(); } } sub Logout_test : Tests { $driver->quit(); } } sub Navigation_test : Tests { $driver->quit(); } # WHEN I PUT MY END TIME HERE: my $end = time(); cprint "Ended at ", (strftime '%A %d %B %Y %H:%M:%S', localtime($end +)),"\n"; cprintf "Total run time:", $end-$start, " seconds\n"; printf ("%02d:%02d:%02d\n",(gmtime($end-$start))[2,1,0]); I HAVE THIS OUTPUT IN MY SHELL: Started at 2016-05-17-16-57-04 1..0 ....ALL MY TESTS ..... Ended at 2016-05-17-17-03-04 Total run time:360 seconds }
So in second position, inside Sub, it works fine , because i have all my tests inside my timer and so i can have elapsed time. But problem is that i can have random sub in my test . Also even if i place my end timer in the last Sub it can cut my timer inside my tests and not at the end of end.
I think about a conditionnal loop to get all my sub when they finish all to call my end time but i don't know how .
How can i do?
Many Thanks !
In reply to Time elapsed with Selenium Test by Chaoui05
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |