#Using Host files with ZebraTester
First, let’s talk about host files to get a basic undestanding on how they work.
A host file is a plain text file used by the operating system to map hostnames to IP addresses.
It can also be used when executing tests with ZebraTester and Apica Load Test Portal.
The contents of a host file:
#Ip address Host
The first column is the IP Address you want your reqests to hit when requesting the host name in column 2
To insert a comment, you prefix it with #
Example use case of using a host file in Apica Load Test Portal;
You have recorded your script against an internal staging web site at stg.zebratester.int and now want to use the script to load test from the Apica Load test portal. If the domain stg.zebratester.int is not publicly available on the internet you can use a host file to direct any requests against stg.zebratester.int to an public IP-address that represents the site.
Another example could be that you want to run the same script against your production site, you would then enter hostname stg.zebratester.int and the IP-address for the production site to direct any requests for stg.zebratester.int to the IP of Zebratester.com
#Ip address Host
Include a host file with your ZebraTester script.
1. Create the host file and place it in the same directory as your ZebraTester script
2. Declare your host file as an external resource to make that it is included when you generate the load test program.
3. When you generate the load test program, ZebraTester will package the hosts.txt file together with the .class-file to create an executable zip file
#Use a host file when executing the script
When executing your load test program, make sure to specify a host file to use.
This makes zebratester lookup IP-addresses from the hosts.txt file for each domain in the script
#Use a host host file in Apica Load Test Portal
When starting a new job in the Load Test Portal, expand the DNS section and select the host file you want to use to resolve your domains.