htmltest

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 22 Imported by: 2

Documentation

Overview

Package htmltest : Main package, provides the HTMLTest struct and associated checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOptions

func DefaultOptions() map[string]interface{}

DefaultOptions returns a map of default options.

func InList

func InList(list []interface{}, key string) bool

InList tests if key is in a slice/list.

Types

type CertChainErr

type CertChainErr struct {
	// contains filtered or unexported fields
}

func (CertChainErr) Error

func (e CertChainErr) Error() string

type HTMLTest

type HTMLTest struct {
	// contains filtered or unexported fields
}

HTMLTest struct, A html testing session, user options are passed in and tests are run.

func Test

func Test(optsUser map[string]interface{}) (*HTMLTest, error)

Test : Given user options run htmltest and return a pointer to the test object.

func (*HTMLTest) CountDocuments

func (hT *HTMLTest) CountDocuments() int

CountDocuments : Return number of documents in hT document store

func (*HTMLTest) CountErrors

func (hT *HTMLTest) CountErrors() int

CountErrors : Return number of error level issues

type Options

type Options struct {
	DirectoryPath  string
	DirectoryIndex string
	FilePath       string
	FileExtension  string

	CheckDoctype bool
	CheckAnchors bool
	CheckLinks   bool
	CheckImages  bool
	CheckScripts bool
	CheckMeta    bool
	CheckGeneric bool

	CheckExternal     bool
	CheckInternal     bool
	CheckInternalHash bool
	CheckMailto       bool
	CheckTel          bool
	CheckFavicon      bool
	CheckMetaRefresh  bool

	EnforceHTML5 bool
	EnforceHTTPS bool

	IgnoreURLs         []interface{}
	IgnoreInternalURLs []interface{}
	IgnoreHTTPS        []interface{}
	IgnoreDirs         []interface{}

	IgnoreInternalEmptyHash             bool
	IgnoreEmptyHref                     bool
	IgnoreCanonicalBrokenLinks          bool
	IgnoreExternalBrokenLinks           bool
	IgnoreAltMissing                    bool
	IgnoreAltEmpty                      bool
	IgnoreDirectoryMissingTrailingSlash bool
	IgnoreSSLVerify                     bool
	IgnoreTagAttribute                  string

	HTTPHeaders map[interface{}]interface{}

	TestFilesConcurrently    bool
	DocumentConcurrencyLimit int
	HTTPConcurrencyLimit     int

	LogLevel int
	LogSort  string

	ExternalTimeout    int
	StripQueryString   bool
	StripQueryExcludes []interface{}

	EnableCache     bool
	EnableLog       bool
	OutputDir       string
	OutputCacheFile string
	OutputLogFile   string
	CacheExpires    string // Accepts golang time period strings, hours (16h) is really only useful option

	// --- Internals below here ---
	NoRun     bool   // When true does not run tests, used to inspect state in unit tests
	VCREnable bool   // When true patches the govcr httpClient to mock network calls
	Version   string // Instigator should set this to a version string
}

Options struct for htmltest, user and default options are merged and mapped into an instance of this struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL