Syntax Highlighting with Visual Studio Code is now supported - search for WebImblaze
in Extensions.
In Nagios plugin mode, WebImblaze will exit with code UNKNOWN if the test step has an abort
parameter and it is invoked.
This project is now very different to the original WebInject so it has been renamed to WebImblaze.
WebImblaze is a free Perl based tool for automated testing of web applications and web services.
You can see WebImblaze example output here: Example output
WebImblaze is very easy to setup and run. An example is test included.
Clone WebImblaze with git
mkdir $HOME/git
cd $HOME/git
git clone https://github.com/Qarj/WebImblaze.git
Fix permissions
cd $HOME/git/WebImblaze
chmod +x wi.pl
Install additional Perl packages, choose [local::lib]
when configuring cpan.
cpan XML::Simple
source $HOME/.bashrc
cpan LWP::Protocol::https
Check that you can see the WebImblaze help info
perl wi.pl --help
Install XML::Simple
with this method
sudo dnf install perl-XML-Simple
CentOS requires a lot of additional setup before installing the packages above - some of the below may be redundant
sudo yum install cpan
sudo cpan
install CPAN
reload CPAN
sudo cpan IO::Socket
sudo yum install perl-libwww-perl
sudo yum install perl-DBI
sudo yum install perl-DBD-MySQL
sudo yum install perl-GD
sudo yum install perl-XML-Simple
sudo cpan JSON::PP
sudo cpan HTTP::Cookies
sudo yum install perl-Crypt-SSLeay
sudo yum install perl-LWP-Protocol-https
sudo yum groupinstall "Development Tools"
sudo yum install openssl-devel
You can see if SSL is installed correctly with the command perl -MNet::SSL -e1
- if it returns no output then all
is OK and there is no need to install LWP::Protocol::https
using cpan.
Install Strawberry Perl.
It doesn't matter where you put WebImblaze, for simplicity, put it in C:\git
mkdir C:\git
If you have git installed, then just clone the repository
cd C:\git
git clone https://github.com/Qarj/WebImblaze.git
If you don't have git, you can get it from git.
Note that these instructions are written with Linux in mind.
Ensure you have installed the WebImblaze
vscode extension for syntax highlighting.
In the tests
folder, create a file called hello.test
.
cd $HOME/git/WebImblaze
code tests/hello.test
Copy paste the following then save the file.
step: Get Totaljobs Home Page
varTOTALJOBS_URL: https://www.totaljobs.com
url: {TOTALJOBS_URL}
verifypositive1: Search for and be recommended
verifypositive2: See all hiring companies
step: Search for hello jobs
desc: Expect to see at least 2 pages of hello jobs
url: {TOTALJOBS_URL}/jobs/hello
addheader: Referer: www.totaljobs.com
verifypositive1: Hello jobs|||Expected to see a count of hello jobs
verifypositive2: page=2|||Should be at least two pages of results for keyword hello
verifynegative1: Page not found
perl wi.pl tests/hello.test
If everything worked OK, then you'll see something like the following:
Starting WebImblaze Engine...
-------------------------------------------------------
Test: tests/hello.test - 10
Get Totaljobs Home Page
Verify Positive: "Search for and be recommended"
Verify Positive: "See all hiring companies"
Passed Positive Verification
Passed Positive Verification
Passed HTTP Response Code Verification
TEST STEP PASSED
Response Time = 0.122 sec
-------------------------------------------------------
Test: tests/hello.test - 20
Search for hello jobs
Expect to see at least 2 pages of hello jobs
Verify Negative: "Page not found"
Verify Positive: "Hello jobs"
Verify Positive: "page=2"
Passed Positive Verification
Passed Positive Verification
Passed Negative Verification
Passed HTTP Response Code Verification
TEST STEP PASSED
Response Time = 0.122 sec
-------------------------------------------------------
Start Time: Sun 27 Feb 2022, 19:38:05
Total Run Time: 0.302 seconds
Total Response Time: 0.244 seconds
Test Steps Run: 2
Test Steps Passed: 2
Test Steps Failed: 0
Verifications Passed: 9
Verifications Failed: 0
Results at: output/Results.html
So what happened?
First WebImblaze read in the default config file called config.xml
located in the root folder of the project.
Then it loaded tests/hello.test
and ran the two test steps in order, numbering them 10
and 20
.
Five files were created in the default output folder called output
:
results.html
is a HTML version of the results - with colourresults.xml
is a XML version of the resultshttp.txt
contains all the response headers and the actual page HTML10.html
contains the HTTP response for step 1020.html
contains the HTTP response for step 20Double click on results.html
to view in a browser, there are links to the individual results for steps 10 and 20.
Click on the link for step 10 and to see the web page that WebImblaze received rendered in the browser. You can
expand the Request Headers
and Response Headers
. You can also click on next
to see the next test step results.
Ignore the Summary
, Batch Summary
and Run Results
links (the WebImblaze-Framework project is needed to make them functional.)
There are some examples on the WebImblaze blog with detailed discussion: Examples
Examine and run the examples in the examples
folder.
Also, if you examine the files in the selftest/substeps
folder you will get a lot of additional examples for additional parameters.
Finally there is always the manual :)
The manual contains extensive details on how to use WebImblaze.
There are many working examples in the examples folder.
For additional examples, study the self tests in the selftest\substeps
folder.
WebImblaze uses WebImblaze to test itself. The self tests are organised by feature name. If you study the self tests for a feature you are interested, you will learn more about how that feature works.
You can run all the self tests with the following command:
perl wi.pl selftest/all_core.test
Or you can run just one self test like this:
perl wi.pl selftest/verifypositive.test
Have multiple test environments? Hundreds of tests that are run many times a day?
Then the WebImblaze-Framework project is for you! Provides config management and a way to neatly organise test execution and results.
Find the project here: WebImblaze Framework
WebImblaze can also drive the Chrome browser using WebDriver Selenium.
Find the project here: WebImblaze-Selenium
A Chrome screenshot can be searched to see if it contains a specific (or approximate) sub-image.
Find the project here: search-image
Use WebImblaze as a plugin to Nagios to monitor critical business workflows.
WebImblaze uses a simplified test file format over WebInject.
The WebInject xml style format is misleading since it isn't true xml - for simplicity illegal characters are allowed to improve readability.
The goal of the format is to simplify test specification and remove clutter. Common errors are validated for and a comprehensive error message is given explaining the problem, line number of the problem and an example of something that works.
Use VSCode and install the WebImblaze Syntax Highlighting extension for best results.
Quick start information:
step:
must be on the first line of each step blockstep:
replaces description1desc:
replaces description2id:
is reserved - it is assigned automatically in increments of 10method:
is also inferred - unless you need to use delete
or put
in which case you need to specify itselenium:
instead of command:
(see examples/misc/selenium.test)shell:
instead of command:
(see examples/demo.test)Mixing tabs and spaces for formatting causes alignment to be out whack depending on what text editor you view the file in. For this reason tabs are not supported for formatting.
Full information is in the manual.
Perl script for converting .xml test case files to .test files Note - you'll need to manually move over comments, plus the repeat parameter. It only works with two or more test steps, and two or more include steps (if present).
Notepad++ syntax highlighting for WebImblaze .test files