:white_check_mark: Test generated HTML for problems

htmltest

Go Report Card GoDoc

If you generate HTML files, html-proofer might be the tool for you. If you can't be bothered with a Ruby environment or fancy something a bit faster, htmltest may be a better option.

🔍 htmltest runs your HTML output through a series of checks to ensure all your links, images, scripts references work, your alt tags are filled in, et cetera.

🏇 Faster? Yep, quite a bit actually. On a site with over 2000 files htmlproofer took over three minutes, htmltest took 8.6 seconds. Both tools had full valid caches.

😕 Why make another tool: A mix of frustration with using htmlproofer/Ruby on large sites and needing a good project to get to grips with Go.

💾 Installation

🐧 Linux / 🍏 macOS / 📱 Arm

This godownloader script will query GitHub for the latest release and download the correct binary for your platform into the directory set with the -b flag.

System-wide Install

curl https://htmltest.wjdp.uk | sudo bash -s -- -b /usr/local/bin

You'll be prompted for your password. After simply do htmltest to run.

Into Current Directory

curl https://htmltest.wjdp.uk | bash

By default this will install htmltest into ./bin of your current directory, to run do bin/htmltest. Rather suitable for CI environments.

More options

Run curl https://htmltest.wjdp.uk | bash -s -- -h for help text.

win64 Windows

⬇️ Download the latest binary release and put it somewhere on your PATH.

🐡 OpenBSD

⬇️ Download the latest binary release and put it somewhere on your PATH.

You can also build from sources by cloning this repo and running sh build.sh, which puts the htmltest executable in the ./bin dir. Use in place, or install to path such as /usr/local/bin.

fedora Fedora

htmltest is in the Fedora repositories, note this is not a first party build and may lag the latest version.

dnf install htmltest

🐳 Docker

docker run -v $(pwd):/test --rm wjdp/htmltest
Mount your directory with html files into the container and test them.

If you need more arguments to the test run it like this:
docker run -v $(pwd):/test --rm wjdp/htmltest -l 3 -s

Notes

We store temporary files in tmp/.htmltest by default. You probably want to ignore that in your version control system, and perhaps cache it in your CI system.

💻 Usage

htmltest - Test generated HTML for problems
           https://github.com/wjdp/htmltest

Usage:
  htmltest [options] [<path>]
  htmltest -v --version
  htmltest -h --help

Options:
  <path>                       Path to directory or file to test, if omitted we
                               attempt to read from .htmltest.yml.
  -c FILE, --conf FILE         Custom path to config file.
  -h, --help                   Show this text.
  -l LEVEL, --log-level LEVEL  Logging level, 0-3: debug, info, warning, error.
  -s, --skip-external          Skip external link checks, may shorten execution
                               time considerably.
  -v, --version                Show version and build time.

🔬 What's Tested?

Many options of the following tests can customised. Items marked 🔜 are not checked yet, but will be soon.

  • a link img script: Whether internal links work / are valid.
  • a: Whether internal hashes work.
  • a link img script: Whether external links work.
  • a: 🔜 Whether external hashes work.
  • a link: Whether external links use HTTPS.
  • img: Whether your images have valid alt attributes.
  • link: Whether pages have a valid favicon.
  • meta: Whether refresh tags are valid and the url works.
  • meta: 🔜 Whether images and URLs in the OpenGraph metadata are valid.
  • meta title: 🔜 Whether you've got the recommended tags in your head.
  • DOCTYPE: Whether a doctype is correctly specified.

What's Not

I'd like to test the following but won't be for a while.

  • Whether your HTML markup is valid. htmlproofer has the ruby library Nokogiri, I've not found one for Go yet.

🙈 Ignoring content

Add the data-proofer-ignore attribute to any tag to ignore it from every check. The name of this attribute can be customised.

<a href="http://notareallink" data-proofer-ignore>Not checked.</a>

📑 Caching

Checking external URLs can slow tests down and potentially annoy the URL's host. htmltest caches the status code of checked external URLs and stores this cache between runs. We write the cache to tmp/.htmltest/refcache.json and expire items after two weeks by default.

🌈 Colour Output

By default, output in the TTY uses colours to indicate warnings, errors, and success. To turn off colourization, set an environment variable named NO_COLOR. If it is present, no colour will be used. The value is ignored. (See no-color.org.)

📠 Logging

If you've got a lot of errors, reading them off a TTY may be difficult. We write errors to tmp/.htmltest/htmltest.log by default. The log level is set in the config file.

🔧 Configuration

htmltest uses a YAML configuration file. Put .htmltest.yml in the same directory that you're running the tool from and you can just say htmltest to run your tests. You'll probably also want to cache the tmp/.htmltest directory.

Basic Options

Option Description Default
DirectoryPath Directory to scan for HTML files.
DirectoryIndex The file to look for when linking to a directory. index.html
FilePath Single file to test within DirectoryPath, omit to test all.
FileExtension Extension of your HTML documents, includes the dot. If FilePath is set we use the extension from that. .html
CheckDoctype Enables checking the document type declaration. true
CheckAnchors Enables checking <a… tags. true
CheckLinks Enables checking <link… tags. true
CheckImages Enables checking <img… tags true
CheckScripts Enables checking <script… tags. true
CheckMeta Enables checking <meta… tags. true
CheckGeneric Enables other tags, see items marked with checkGeneric on the tags wiki page. true
CheckExternal Enables external reference checking; all tag types. true
CheckInternal Enables internal reference checking; all tag types. When disabled will prevent internal hash checking unless the reference only contains a hash fragment (#heading) and therefore refers to the current page. true
CheckInternalHash Enables internal hash/fragment checking. true
CheckMailto Enables–albeit quite basic–mailto: link checking. true
CheckTel Enables–albeit quite basic–tel: link checking. true
CheckFavicon Enables favicon checking, ensures every page has a favicon set. false
CheckMetaRefresh Enables checking meta refresh tags. true
EnforceHTML5 Fails when the doctype isn't <!DOCTYPE html>. false
EnforceHTTPS Fails when encountering an http:// link. Useful to prevent mixed content errors when serving over HTTPS. false
IgnoreURLs Array of regexs of URLs to ignore. empty
IgnoreDirs Array of regexs of directories to ignore when scanning for HTML files. empty
IgnoreInternalEmptyHash When true prevents raising an error for links with href="#". false
IgnoreEmptyHref When true prevents raising an error for links with href="". false
IgnoreCanonicalBrokenLinks When true produces a warning, rather than an error, for broken canonical links. When testing a site which isn't live yet or before publishing a new page canonical links will fail. true
IgnoreExternalBrokenLinks When true produces a warning, rather than an error, for broken external links. Useful when testing a site having hundreds of external links. false
IgnoreAltMissing Turns off image alt attribute checking. false
IgnoreDirectoryMissingTrailingSlash Turns off errors for links to directories without a trailing slash. false
IgnoreSSLVerify Turns off x509 errors for self-signed certificates. false
IgnoreTagAttribute Specify the ignore attribute. All tags with this attribute will be excluded from every check. "data-proofer-ignore"
HTTPHeaders Dictionary of headers to include in external requests {"Range": "bytes=0-0", "Accept": "*/*"}
TestFilesConcurrently ⚠️ 🚧 EXPERIMENTAL Turns on concurrent checking of files. false
DocumentConcurrencyLimit Maximum number of documents to process at once. 128
HTTPConcurrencyLimit Maximum number of open HTTP connections. If you raise this number ensure the ExternalTimeout is suitably raised. 16
LogLevel Logging level, 0-3: debug, info, warning, error. 2
LogSort How to sort/present issues. Can be seq for sequential output or document to group by document. document
ExternalTimeout Number of seconds to wait on an HTTP connection before failing. 15
StripQueryString Enables stripping of query strings from external checks. true
StripQueryExcludes List of URLs to disable query stripping on. ["fonts.googleapis.com"]
OutputDir Directory to store cache and log files in. Relative to executing directory. tmp/.htmltest
OutputCacheFile File within OutputDir to store reference cache. refcache.json
OutputLogFile File within OutputDir to store last tests errors. htmltest.log
CacheExpires Cache validity period, accepts go.time duration strings (…"m", "h"). 336h (two weeks)

Example

DirectoryPath: "_site"
EnforceHTTPS: true
IgnoreURLs:
- "example.com"
IgnoreDirs:
- "lib"
CacheExpires: "6h"

📢 Issues? Suggestions?

Submit an issue.

Owner
Will Pimblett
Full-stack web developer
Will Pimblett
Comments
  • Crash parsing HTML document

    Crash parsing HTML document

    htmltest is erroring out when I run it:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1111246]
    
    goroutine 1 [running]:
    github.com/wjdp/htmltest/htmldoc.(*Document).Parse(0x0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmldoc/document.go:47 +0x26
    github.com/wjdp/htmltest/htmldoc.(*Document).IsHashValid(0x0, 0xc000364b1e, 0x15, 0x127b200)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmldoc/document.go:112 +0x2b
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkInternalHash(0xc0000c5200, 0xc000161770)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:297 +0xad
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkInternal(0xc0000c5200, 0xc000161770)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:271 +0xcb
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkLink(0xc0000c5200, 0xc00010c700, 0xc00012df10)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:85 +0x3f9
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocument(0xc0000c5200, 0xc00010c700)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:203 +0x193
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocuments(0xc0000c5200)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:182 +0x6a
    github.com/wjdp/htmltest/htmltest.Test(0xc000075aa0, 0x1, 0x1, 0x49)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:142 +0x8fb
    main.run(0xc000075aa0, 0xc000075aa0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/main.go:159 +0x1e8
    main.main()
    	/home/travis/gopath/src/github.com/wjdp/htmltest/main.go:66 +0x298
    

    To Reproduce

    Steps to reproduce the behaviour:

    1. Run with config and options …
    htmltest --log-level 3
    

    .htmltest.yml

    Please copy in your config file

    DirectoryPath: "public"
    EnforceHTTPS: false
    CacheExpires: "6h"
    CheckExternal: false
    IgnoreDirectoryMissingTrailingSlash: true
    IgnoreInternalEmptyHash: true
    IgnoreDirs:
    - Support
    

    Source files

    I haven't been able to narrow it down yet -- my request is for htmltest to print the page it's processing to help narrow it down.

    Expected behaviour

    print each page as it's being processed

    Versions

    • OS: MacOS 10.14.5
    • htmltest: 0.10.3
  • Build for Apple Silicon?

    Build for Apple Silicon?

    I've just upgraded to a Macbook Pro with Apple Silicon. Unfortunately, there doesn't appear to be a macOS ARM64 build available, so the installation script exits with a non-zero exit code and no binary is installed.

    $ curl https://htmltest.wjdp.uk | bash -s -- -b bin
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 10278  100 10278    0     0  74478      0 --:--:-- --:--:-- --:--:-- 74478
    wjdp/htmltest info checking GitHub for latest tag
    wjdp/htmltest info found version: 0.15.0 for v0.15.0/macos/arm64
    $ echo $?
    1
    $ ls bin
    $
    
  • segfault in Document.Parse htmlMutex

    segfault in Document.Parse htmlMutex

    Caught this panic on our Ubuntu Linux build server using latest (0.4.1) binary release:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x50e756]
    
    goroutine 1 [running]:
    github.com/wjdp/htmltest/htmldoc.(*Document).Parse(0x0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmldoc/document.go:47 +0x26
    github.com/wjdp/htmltest/htmldoc.(*Document).IsHashValid(0x0, 0xc427267419, 0x22, 0xc4200b7800)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmldoc/document.go:105 +0x2b
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkInternalHash(0xc4200b7680, 0xc4272c07b0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:284 +0xbb
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkInternal(0xc4200b7680, 0xc4272c07b0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:258 +0xe9
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkLink(0xc4200b7680, 0xc4203becb0, 0xc42727c5b0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/check-link.go:84 +0x3d4
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocument(0xc4200b7680, 0xc4203becb0)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:146 +0x165
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocuments(0xc4200b7680)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:130 +0x69
    github.com/wjdp/htmltest/htmltest.Test(0xc420019fb0, 0x1)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/htmltest/htmltest.go:93 +0x771
    main.run(0xc420019fb0, 0x7ffd07310b5e)
    	/home/travis/gopath/src/github.com/wjdp/htmltest/main.go:154 +0x29e
    main.main()
    	/home/travis/gopath/src/github.com/wjdp/htmltest/main.go:62 +0x1c1
    Process exited with code 2
    

    I don't know the cause yet, but it's random and it was actually first time I saw it.

  • ignoreAltMissing does not work with .htmltest

    ignoreAltMissing does not work with .htmltest

    The feature ignoreAltMissing does not accept a true value when using the .htmltest feature

    DirectoryPath: "public"
    EnforceHTTPS: true
    CacheExpires: "6h"
    OutputLogFile: htmltest.log
    LogLevel: 3
    IgnoreAltMissing: false
    CheckInternal: false
    
  • gorelaser + godownloader script for better CI/CD integration

    gorelaser + godownloader script for better CI/CD integration

    it would be nice to have releases made in a way that godownloader could generate scripts to install things on CI.

    My workflow would be to to install both hugo and htmltest in that way:

    install:
    - curl hugo.sh | bash
    - curl htmltest.sh | bash
    script:
    - hugo
    - htmltest ./public
    

    With goreleaser it is easy to do that, I can carry this issue on if you want.

  • Ignore internal urls

    Ignore internal urls

    Hello,

    Following #168 I made a small patch. It seems that for this use case, we cannot use the IgnoreURLs because it uses regexp and this is I think too violent for internal urls.

    So I added the internal equivalent IgnoreInternalURLs and just done an equal test for url. Seems to work fine for what I tested.

    I also added some tests, but as said I'm a golang noob, so I don't know if those tests suits your quality needs. may be you have to add/reinforce those tests.

    Hope this is helpful. Done with go version go1.16 darwin/amd64

    Solve #168

  • IgnoreURLs doesn't work on relative URLs

    IgnoreURLs doesn't work on relative URLs

    Describe the bug

    I have a server-side redirect on my production site, but on the static site, it looks like a broken link. I want to tell htmltest to ignore it, but I can't figure out how. Using IgnoreURLs seems to have no effect on a relative URL

    To Reproduce

    1. Create an HTML file with a non-existent relative link
    2. Add the relative URL to IgnoreURLs

    .htmltest.yml

    DirectoryPath: dist
    IgnoreURLs:
      - /foo/bar
    

    Source files

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width">
      <title>Demo</title>
    </head>
    
    <body>
      <a href="/foo/bar">Foo bar</a>
    </body>
    </html>
    

    Expected behaviour

    htmltest ignores the broken /foo/bar relative link.

    Actual behaviour

    htmltest reports error: target does not exist --- index.html --> /foo/bar

    Even if I change the IgnoreURLs to .*/foo/bar, it still flags this as a broken link. I'm not sure if this is a bug in htmltest or if I'm misunderstanding how to specify IgnoreURLs for relative links.

    Versions

    • OS: Ubuntu 20.04
    • htmltest: htmltest v0.14.0, 2021-01-23T18:38:58Z

    Additional context

    Thanks so much for your work on htmltest! I'd love to make a financial donation to the project if that's an option.

  • Add option: `IgnoreExternalBrokenLinks`

    Add option: `IgnoreExternalBrokenLinks`

    Do let me know if it is useful, we particularly required this while checking links for julialang.org site which has a large number of links.

    I'll add tests and docs soon, if this idea looks good enough.

    Closes https://github.com/wjdp/htmltest/issues/139

    cc @wjdp

  • Panic when meta refresh URL is single-quoted

    Panic when meta refresh URL is single-quoted

    Here's a simple test HTML file:

    test.html

    <!doctype html>
    <html lang="en">
        <head>
            <title>ox-hugo Test Site</title>
            <meta http-equiv="refresh" content="0; URL='https://github.com/kaushalmodi/ox-hugo/issues'" />
        </head>
    </html>
    

    How to make htmltest panic

    htmltest test.html
    

    Log

    panic: parse 'https://github.com/kaushalmodi/ox-hugo/issues': first path segment in URL cannot contain colon
    
    goroutine 1 [running]:
    github.com/wjdp/htmltest/output.CheckErrorPanic(0x78d580, 0xc0000a9dd0)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/output/error.go:22 +0x86
    github.com/wjdp/htmltest/htmldoc.NewReference(0xc0001c04d0, 0xc0001c08c0, 0xc00001cb87, 0x2f, 0xc00000dd20)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/htmldoc/reference.go:34 +0x109
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkMetaRefresh(0xc0000ecb40, 0xc0001c04d0, 0xc0001c08c0)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/htmltest/check-meta.go:31 +0x200
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).checkMeta(0xc0000ecb40, 0xc0001c04d0, 0xc0001c08c0)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/htmltest/check-meta.go:12 +0x54
    github.com/wjdp/htmltest/htmltest.(*HTMLTest).testDocument(0xc0000ecb40, 0xc0001c04d0)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/htmltest/htmltest.go:218 +0x479
    github.com/wjdp/htmltest/htmltest.Test(0xc0000a99e0, 0x1, 0x1, 0x49)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/htmltest/htmltest.go:138 +0x91f
    main.run(0xc0000a99e0, 0xc0000a99e0)
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/main.go:159 +0x1e8
    main.main()
            /home/kmodi/go.apps/src/github.com/wjdp/htmltest/main.go:66 +0x298
    
  • Add an option to ignore blank href

    Add an option to ignore blank href

    htmltest reports errors when a href is blank. For example, the internal pagination template of hugo generates some codes like <a href="" aria-label="Previous"><span aria-hidden="true">«</span></a>.

    Is it possible to add an option to add an option to ignore errors like this?

  • htmltest's link checker reports HTTP 403 but cURL (and httpie) report 200

    htmltest's link checker reports HTTP 403 but cURL (and httpie) report 200

    When feeding tiny HTML page with a few links to Microsoft MSDN pages to htmltest, error messages are printed since htmltest sees HTTP 403 responses. However, feeding the exact same URLs to cURL or httpie (or my browser) gives a HTTP 200 response. I'm running htmltest on thousands of web pages (containing a lot of links) -- it always only microsoft.com URLs which trigger this behaviour.

    To Reproduce:

    1. Store this HTML markup which just has a few links to Microsoft pages in test.html:
    <!doctype html>
    <html>
        <body>
            <a href="https://www.microsoft.com/en-us/download/details.aspx?id=13255">Microsoft Access Database Engine 2010 Redistributable</a>
            <a href="https://www.microsoft.com/en-us/download/details.aspx?id=49077">Update for Windows 7 (KB2999226)</a>
            <a href="https://www.microsoft.com/en-in/download/details.aspx?id=48145">Visual C++ Redistributable for Visual Studio 2015</a>
            <a href="https://www.microsoft.com/en-us/download/details.aspx?id=14431">Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update</a>
        </body>
    </html>
    
    1. Run htmltest without any arguments on the file:
    $ ./htmltest test.html
    

    .htmltest.yml

    There is no configuration file used in this case.

    Expected behaviour

    I expect htmltest to not print any errors

    Actual behaviour

    htmltest prints the following error messages:

    htmltest started at 08:44:09 on .
    ========================================================================
    test.html
      Non-OK status: 403 --- test.html --> https://www.microsoft.com/en-us/download/details.aspx?id=13255
      Non-OK status: 403 --- test.html --> https://www.microsoft.com/en-us/download/details.aspx?id=49077
      Non-OK status: 403 --- test.html --> https://www.microsoft.com/en-in/download/details.aspx?id=48145
      Non-OK status: 403 --- test.html --> https://www.microsoft.com/en-us/download/details.aspx?id=14431
    ========================================================================
    ✘✘✘ failed in 430.673973ms
    4 errors
    

    Versions

    • OS: macOS 10.15.6
    • htmltest: 0.13.0 (also reproduced with 0.12.1)

    Additional context

    Issueing a 'HEAD' or 'GET' request using the 'httpie' utility (or cURL) works for any of the URLs in the document, resulting in a HTTP 200 response, e.g.:

    ➜  curl -I 'https://www.microsoft.com/en-us/download/details.aspx?id=13255'
    HTTP/2 200
    cache-control: no-cache, no-store
    ...
    
  • Any way to validate broken images?

    Any way to validate broken images?

    Is your feature request related to a problem? Please describe. I have found a bunch of images which had wrong "src", but htmltest missed this issues. I quickly checked the code, and seems like it validate only existence of attributes like src or rel, but does not actually check if image exists, like it does with links.

    Describe the solution you'd like Validate that image src are actually exists

    Describe alternatives you've considered Interestingly that I tried to find alternative solution, using my static side builder, in my case Hugo. For links it does provide special helper calledref, which errors if url is wrong, but for images there is no such thing...

  • Support authenticating to targeted URLs

    Support authenticating to targeted URLs

    Is your feature request related to a problem? Please describe. I would want to check pages that can only respond with a 200 after authentication. It would need to be ensured that tokens are sent only to the sites they belong to. Also, credentials shouldn't be stored as plain text in a configuration file.

    Describe the solution you'd like I would like to see the possibility to provide a configuration like that:

    auth:
      - site: <some site URL pattern>
        authType: basic
        userByEnvvar: <some envvar holding a user name>
        tokenByEnvvar: <some envvar holding a token>
      - site: <some other site URL pattern>
        authType: oauth2
        userByShellCommand: /path/to/my/script/retrieve-user.sh
        tokenByShellCommand: /path/to/my/script/retrieve-token.sh
    

    Describe alternatives you've considered There could be dozens of secret sources or auth types, but starting with reading credentials via envvars and allow basic and oauth2 authentication should provide a valuable first iteration.

    Maybe in addition something like this might be suitable:

    echo "github.com:oauth2:username:token;mysite.com:basic:username:password" | htmltest --auth - 
    

    Additional context Add any other context or screenshots about the feature request here.

  • Add Configuration Option to Limit Redirects

    Add Configuration Option to Limit Redirects

    When testing for stale / outdated links it is very helpful to fail on redirects.

    I propose to add a RedirectLimit option (as int value) with the following semantics

    • unset or negative value: use the default limit built into net/http
    • positive value: limit allowed number of redirects

    Setting this to 0 would result in a failure for redirected links.

    I will prepare a PR for this shortly.

  • Output to JSON format

    Output to JSON format

    Is your feature request related to a problem? Please describe.

    It is hard to use the output programmatically.

    Describe the solution you'd like

    Optionally output to JSON format so it can be used more easily by another program.

    Describe alternatives you've considered

    None

    Additional context

    Looking for a better way to display it visually, such as within a webpage.

  • Ignore link rel preconnect when testing external links

    Ignore link rel preconnect when testing external links

    Describe the bug

    informs the browser that your page intends to establish a connection to another origin, and that you'd like the process to start as soon as possible. As you specifiy the domain only for that other origin, the domain only doesn't always return status 200. www.googletagmanager.com returns status 400. In real, the URL shouldn't be checked to avoid errors like that: `categories/index.html Non-OK status: 400 --- categories/index.html --> https://www.googletagmanager.com/`

    To Reproduce

    Steps to reproduce the behaviour:

    1. Create an HTML file with the line given: <link rel="preconnect" href="https://www.googletagmanager.com" crossorigin>
    2. Run htmltest on it.
    3. See error.

    .htmltest.yml

    No config file required.

    Source files

    See above.

    Expected behaviour

    No error should be raised for link rel preconnect URIs.

    Actual behaviour

    The URI is treated as a URL and checked for existence, and an error is thrown.

    Versions

    • OS: Ubuntu 18.04
    • htmltest: 0.16.0

    Additional context

    More about link rel preconnect.

Flugel Test Documentation for steps to run and test the automatio
Flugel Test Documentation for steps to run and test the automatio

Flugel Test Documentation Documentation for steps to run and test the automation #Test-01 1 - Local Test Using Terratest (End To End) 1- By runing " t

Nov 13, 2022
Test-assignment - Test assignment with golang
Test-assignment - Test assignment with golang

test-assignment We have a two steam of data and we need to save it in the map: I

Jan 19, 2022
This repository includes consumer driven contract test for provider, unit test and counter api.

This repository includes consumer driven contract test for provider, unit test and counter api.

Feb 1, 2022
Load generator for measuring overhead generated by EDRs and other logging tools on Linux

Simple load generator for stress-testing EDR software The purpose of this tool is to measure CPU overhead incurred by having active or passive securit

Nov 9, 2022
Test your command line interfaces on windows, linux and osx and nodes viá ssh and docker

Commander Define language independent tests for your command line scripts and programs in simple yaml files. It runs on windows, osx and linux It can

Dec 17, 2022
Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test
Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test

embedded-postgres Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test. When testing this provides

Dec 27, 2022
End to end functional test and automation framework
End to end functional test and automation framework

Declarative end to end functional testing (endly) This library is compatible with Go 1.12+ Please refer to CHANGELOG.md if you encounter breaking chan

Jan 6, 2023
Test your code without writing mocks with ephemeral Docker containers 📦 Setup popular services with just a couple lines of code ⏱️ No bash, no yaml, only code 💻

Gnomock – tests without mocks ??️ Spin up entire dependency stack ?? Setup initial dependency state – easily! ?? Test against actual, close to product

Dec 29, 2022
go-carpet - show test coverage in terminal for Go source files
go-carpet - show test coverage in terminal for Go source files

go-carpet - show test coverage for Go source files To view the test coverage in the terminal, just run go-carpet. It works outside of the GOPATH direc

Jan 8, 2023
http integration test framework

go-hit hit is an http integration test framework written in golang. It is designed to be flexible as possible, but to keep a simple to use interface f

Dec 29, 2022
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

GoConvey is awesome Go testing Welcome to GoConvey, a yummy Go testing tool for gophers. Works with go test. Use it in the terminal or browser accordi

Dec 30, 2022
A Go test assertion library for verifying that two representations of JSON are semantically equal
A Go test assertion library for verifying that two representations of JSON are semantically equal

jsonassert is a Go test assertion library for verifying that two representations of JSON are semantically equal. Usage Create a new *jsonassert.Assert

Jan 4, 2023
Ruby on Rails like test fixtures for Go. Write tests against a real database

testfixtures Warning: this package will wipe the database data before loading the fixtures! It is supposed to be used on a test database. Please, doub

Jan 8, 2023
A tool for generating self-contained, type-safe test doubles in go

counterfeiter When writing unit-tests for an object, it is often useful to have fake implementations of the object's collaborators. In go, such fake i

Jan 5, 2023
Sql mock driver for golang to test database interactions

Sql driver mock for Golang sqlmock is a mock library implementing sql/driver. Which has one and only purpose - to simulate any sql driver behavior in

Dec 31, 2022
A test-friendly replacement for golang's time package

timex timex is a test-friendly replacement for the time package. Usage Just replace your time.Now() by a timex.Now() call, etc. Mocking Use timex.Over

Dec 21, 2022
Easier way to unit test terraform

Unit testing terraform (WIP) Disclaimer Currently, the only way to compare values is using JSON query path and all types are strings. want := terraf

Aug 16, 2022
Learn Go with test-driven development
Learn Go with test-driven development

Learn Go with Tests Art by Denise Formats Gitbook EPUB or PDF Translations 中文 Português 日本語 한국어 Support me I am proud to offer this resource for free,

Jan 1, 2023
HTTP mocking to test API services for chaos scenarios
HTTP mocking to test API services for chaos scenarios

GAOS HTTP mocking to test API services for chaos scenarios Gaos, can create and provide custom mock restful services via using your fully-customizable

Nov 5, 2022