GithubHelp home page GithubHelp logo

kochetkov-ma / qa-tools Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 81 KB

Different Tools for Auto Testing

License: Apache License 2.0

Java 100.00%
java11 http-server selenium utilities gradle github actions central highlight-element highlight

qa-tools's Introduction

QA Tools Java Library

Build / Make Release / Publish to OSS

jdk11 gradle junit

Coverage Status

Maven Central

Codacy Badge

checkstyle pmd spotbugs

qa-tools

Different simple tools for auto testing:

  • unit-testing
  • web ui
  • mobile ui
  • api
  • other

Getting

implementation 'ru.iopump.qa:qa-tools:0.2.0'

Possibilities

Selenium element highlighting

WebDriverEventListener to highlight element with which one be interacting now (active element). Use static constructor.

        final WebDriver sourceDriver = new ChromeDriver()
        final EventFiringWebDriver driver = new EventFiringWebDriver(sourceDriver);
        driver.register(HighlighterListener.newSingleThreadHighlighterListener());

Also you can register this event handler in com.codeborne.selenide via WebDriverRunner

Publishing html page for web testing and unit testing on localhost

If you want check you Page Object or you want provide simple html page on localhost in your unit (integration) tests you can use this simplest and fastest single html page http server from JDK.

        LocalSimpleHtmlServer server = LocalSimpleHtmlServer.of(8080, "/");
        server.publish("<!DOCTYPE html><html><body>test</body></html>");
        server.close()      

or in Junit as test rule

        @Rule
        public LocalSimpleHtmlServer.TestHtmlServer server = LocalSimpleHtmlServer.of(8080, "/")
            .asTestRule("<!DOCTYPE html><html><body>test</body></html>");      

WithValue interface

If you have some class with any value field especially String type just implement WithValue interface.
And you will get very convenient method ru.iopump.qa.support.api.WithValue.hasValue (see javadoc).
This smart small method can equals every types of values especially String type with ignore case, also it execute smart cast objectValue or expectedValue to String if any of them is String type.

Utilities

ClassUtil

Provide several JDK's methods with a null-safe behavior.

EnumUtil

  • create your enum implemented WithValue<String>
    @AllArgsConstructor
    @Getter
    private enum EnumTmp implements WithValue<String> {
        ONE("one_value"), TWO("two_value"), THREE("three_value");
        private final String value;
    }
  • find enum constants by String value and don't worry about letter's case or get clear exception with very useful message
EnumTmp result = EnumUtil.getByValue(EnumTmp.class, "ONE_VALUE")
assert result == EnumTmp.ONE
  • you may change generic type to any other and use it
  • also you may find enum by its name
EnumTmp result = EnumUtil.getByName(EnumTmp.class, "two")
assert result == EnumTmp.TWO

FileUtil

ReflectionUtil

ResourceUtil

Str

StreamUtil

VarUtil

Merge environment and system variables.

        /* get */
        Optional<String> envOrSysProp = VarUtil.get("OS");
        assertThat(envOrSysProp).isNotEmpty();
        /* getOrDefault */
        String envOrSysPropOrDefault = VarUtil.getOrDefault("NOT_EXISTS", "DEFAULT_VALUE") // can be null
        assertThat(VarUtil.getOfDefault("NOT_EXISTS", "DEFAULT_VALUE")).isEqualTo("DEFAULT_VALUE");

qa-tools's People

Contributors

kochetkov-ma avatar

Stargazers

 avatar  avatar

Watchers

 avatar

qa-tools's Issues

True semantic versioning

minor version on PR from branch 'feature/' 'refactoring/'
patch version on PR from branch 'bugfix/' 'bug/'

add instruction and possibilities to raise major version (m.b. special task in gradel ... )

Add github badges

  • build (actions) status
  • maven central release
  • junit status
  • jacoco status
  • pitest status
  • pmd
  • spotbug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.