Giter VIP home page Giter VIP logo

andreapagliacci / apiseleniumtesting Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.07 MB

It's Selenium API, you can test simple call one API, for all end-2-end test case only deploying on your server API. IMPORTANT. If you want to deploy on cloud you must configure properly selenium as well browser driver. I realize a proof of concept for Chrome on AWS Ec2. It's work like a charm!

Java 100.00%
test java selenium-server

apiseleniumtesting's Introduction

Selenium API

It's Selenium API, you can test simple call one API, for all end-2-end test case only deploying on your server API. IMPORTANT. If you want to deploy on cloud you must configure properly selenium as well browser driver. I realize a proof of concept for Chrome on AWS Ec2. It's work like a charm!

Use library

You can call API many way: preparing json request and sending, use Builder in library. If you use maven you should include

<dependency>
    <groupId>net.seniorsoftwareengineer.testing</groupId>
    <artifactId>selenium-api-testing</artifactId>
    <version>1.3.4-alpha</version>
</dependency>

After that can call API with

String serverTest = "http://localhost:8081/test";
String url = "https://www.google.com";
String driverVersion = "104.0.5112.20";
String browserVersion = "104.0.5112.79";
String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36.";
Configuration configuration = BuilderConfiguration.create().browserVersion(browserVersion).driverVersion(driverVersion).userAgent(userAgent).headless().getConfiguration();
Click click =  new Click();
click.getSelector().setCssSelector("body");
TestCase test = test = BuilderTestCase.create().url(url).configuration(configuration).addActivity(click).getTestCase();
RestTemplate restTemplate = new RestTemplate();
HttpEntity<TestCase> request = new HttpEntity<TestCase>(test);
ResultTesting resultTesting = restTemplate.postForObject(serverTest, request, ResultTesting.class);

Troubleshooting

If you have runtime error regarding log4j can resolve adding in pom in import of library

<exclusions>
	<exclusion>
	    <groupId>org.apache.logging.log4j</groupId>
	    <artifactId>log4j-to-slf4j</artifactId>
	</exclusion>
</exclusions>

Documentation API

Documentation REST API is automagically with Swagger library. If you go at ./swagger-ui/index.html you can dinamically see request and response API structure.

apiseleniumtesting's People

Contributors

andreapagliacci avatar

Watchers

 avatar

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.