Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Mojolicious Test::Mojo remote app

by davido (Cardinal)
on Feb 16, 2022 at 22:25 UTC ( [id://11141430]=note: print w/replies, xml ) Need Help??


in reply to Mojolicious Test::Mojo remote app

See Mojolicious Guides Testing: The Test::Mojo-object.

In short, yes, you can specify the entire URL to issue requests against, allowing you to test remote web applications. This works because Test::Mojo contains a Mojo::UserAgent object.

As an example:

#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Mojo; my $t = Test::Mojo->new; $t->get_ok('https://www.perlmonks.org') ->status_is(200); done_testing();

If you run that you should see:

ok 1 - GET https://www.perlmonks.org ok 2 - 200 OK 1..2

Dave

Replies are listed 'Best First'.
Re^2: Mojolicious Test::Mojo remote app
by ait (Hermit) on Feb 16, 2022 at 22:56 UTC

    That's awesome !
    Thank you !!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141430]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found