Webinject(3pm)

πŸ“¦
version 1.94 Β· 2 versions
  • 1.94 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.94 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Webinject(3pm) β€” the Perl module for testing web services πŸ’–

okay bestie, sit down, hydrate, and let me tell you about Webinject β€” she's a Perl module, she lives in the User Contributed Perl Documentation corner of your system, and she is literally the moment for anyone testing web stuff. 🫢


✨ SYNOPSIS ✨

the three lines that start everything, no cap:

use Webinject;
my $webinject = Webinject->new();
$webinject->engine();

that's it. that's the whole ritual. πŸ•―οΈ


🌈 DESCRIPTION 🌈

so WebInject is a free tool for automated testing of web applications and web services. like, free free. πŸ’Έ

she can test individual system components that have HTTP interfaces β€” and the list is giving range: JSP, ASP, CGI, PHP, AJAX, Servlets, HTML Forms, XML/SOAP Web Services, REST, etc. she does not discriminate. πŸ’…

she can also be your test harness for building a whole suite of [HTTP level] automated functional, acceptance, and regression tests. a test harness = you run a million test cases and collect/report all the results like a boss. and she gives you real-time results display ✨ and can even be used for monitoring system response times. main character energy fr fr.


πŸŽ€ CONSTRUCTOR πŸŽ€

new ( [ARGS] )

creates a Webinject object. yes, the args are optional. she's chill like that.

  • reporttype β€” possible values are 'standard', 'nagios', 'nagios2', 'mrtg' or 'external:'. pick your vibe. πŸ“Š
  • nooutput β€” suppresses ALL output to STDOUT, and creates only logfiles. silent but deadly. 🀫
  • break_on_errors β€” stop after the first testcase fails. otherwise Webinject would go on and execute all tests regardless of the previous case. so basically: do you want her to rage-quit at the first L, or keep going through the whole thing? πŸ’€
  • timeout β€” default timeout is 180seconds. and heads up bestie, the timeout starts again for every testcase. ⏰
  • useragent β€” set the useragent used in HTTP requests. default is 'Webinject'. she knows who she is. πŸ‘‘
  • max_redirect β€” set maximum number of HTTP redirects. default is 0. 🚦
  • proxy β€” sets a proxy which is then used for http and https requests.

ex.: http://proxy.company.net:3128

with authentication:

ex.: http://user:password@proxy.company.net:3128

  • output_dir β€” output directory where all logfiles will go to. defaults to current directory. πŸ“
  • globalhttplog β€” can be 'yes' or 'onfail'. will log the http request and response to a http.log file. πŸ“
  • httpauth β€” provides credentials for webserver authentications. the format is:
['servername', 'portnumber', 'realm-name', 'username', 'password']
  • baseurl β€” the value can be used as {BASEURL} in the test cases πŸ”—
  • baseurl1 β€” the value can be used as {BASEURL1} in the test cases πŸ”—
  • baseurl2 β€” the value can be used as {BASEURL2} in the test cases πŸ”—
  • standaloneplot β€” can be "on" or "off". default is off. create gnuplot graphs when enabled. πŸ“ˆ
  • graphtype β€” defaults to 'lines'. ✏️
  • gnuplot β€” defines the path to your gnuplot binary. πŸ”
  • postbodybasedir β€” path to a directory from which all relative test case postbody directives are based.

when test cases include a "postbody" directive with a "file=>..." value, and that value is a relative location, Webinject will prepend this directory path.

if not supplied, the directory containing the current test case file is prepended to any relative "file=>" values.


πŸ¦‹ METHODS πŸ¦‹

engine

start the engine of webinject. πŸŽοΈπŸ’¨ vroom.


🌸 TEST CASES 🌸

Parameters

  • addcookie β€” when added to a test case, this adds a cookie to the cookie jar prior to the test case request being sent (i.e. the test case this is attached to will include any cookies specified in this parameter). this is useful for cases where a cookie is set outside of a Set-Cookie directive in the response header. this parameter takes a comma-delimited list of fields that configure the cookie; the fields for this parameter are a direct one-to-one correllation with the parameters to the HTTP::Cookies::set_cookie method. as well, multiple cookies can be defined by separating with a '|' character as with the addheader parameter. πŸͺ

the comma-delimited list of fields are as follows.

addcookie="version,name,value,path,domain,port,path_spec,secure,maxage,discard"

  • version - Cookie-spec version number
  • name - Cookie name.
  • value - Cookie value.
  • path - The URL path where the cookie is set.
  • domain - The domain under which the cookie is set.
  • port - The port on which the cookie is set.
  • path_spec - Boolean. Set if the cookie is valid only under 'path' or the entire domain.
  • secure - Boolean. If true (1), the cookie is only sent over secure connections
  • maxage - The time in seconds the cookie is valid for.
  • discard - Boolean. Do not send in future requests and destroy upon the next cookie jar save.
  • parseresponse β€” parse a string from the HTTP response for use in subsequent requests. this is mostly used for passing Session ID's, but can be applied to any case where you need to pass a dynamically generated value. it takes the arguments in the format "leftboundary|rightboundary", and an optional third argument "leftboundary|rightboundary|escape|decode" when you want to force escaping of all non-alphanumeric characters (in case there is a wrong configuration of Apache server it will push encoded HTML characters (/ = /, : = :, ... ) to the Webinject and decode serve to translate them into normal characters. see the "Session Handling and State Management - Parsing Response Data & Embedded Session ID's" section of this manual for details and examples on how to use this parameter. πŸ”Ž
Note: you may need to prepend a backslash before certain reserved characters when parsing (sorry that is rather vague).
Note: Newlines (\n) are also valid boundaries and are useful when you need to use the end of the line as a boundary.
  • parseresponse1 β€” additional parameter for response parsing.
  • parseresponse2 β€” additional parameter for response parsing.
  • parseresponse3 β€” additional parameter for response parsing.
  • parseresponse4 β€” additional parameter for response parsing.
  • parseresponse5 β€” additional parameter for response parsing.

⭐ EXAMPLE TEST CASE ⭐

here's what it actually looks like, bestie, in all her XML glory:

<testcases>
  <case
    id             = "1"
    description1   = "Sample Test Case"
    method         = "get"
    url            = "{BASEURL}/test.jsp"
    verifypositive = "All tests succeded"
    warning        = "5"
    critical       = "15"
    label          = "testpage"
    errormessage   = "got error: {PARSERESPONSE}"
  />
</testcases>

detailed description about the syntax of testcases can be found on the Webinject homepage. πŸ“š


πŸ‘€ SEE ALSO πŸ‘€

for more information about webinject visit http://www.webinject.org β€” go, click, be enlightened. 🌐


🫢 AUTHOR 🫢

  • Corey Goldberg, <corey@goldb.org>
  • Sven Nierlein, <nierlein@cpan.org>

give them their flowers. πŸ’


Copyright (C) 2010 by Sven Nierlein

Copyright (C) 2004-2006 by Corey Goldberg

This library is free software; you can redistribute it under the GPL2 license.


okay and that's the whole page, bestie β€” slay, you read all of it. πŸ’…βœ¨ this was perl v5.34.0, dated 2022-06-28, from the Webinject(3pm) page. now go write some test cases and eat. πŸ“πŸŽ€