AyeVeeKay
AyeVeeKay

Reputation: 159

What is the best way to create a test automation suite as a service

I am trying to create the following setup :

  1. A Selenium (Java) project that has a set of 10 automated test cases.
  2. When this project is executed, it generates an HTML test execution report.
  3. This project should be 'hosted' on an internal network.
  4. Anyone who has access to the network should be able to 'invoke' this project, which in turn executes the test cases and passes the HTML report to the person who invoked it.
  5. The project should be accessible ONLY for execution and the code should NOT be accessible.

My goal is that this implementation should be executable by any framework irrespective of the technology that the framework uses. I was thinking of creating the project as a WebService using Java (servlet).

My question is:

  1. Can this implementation be accessed by any external automation framework ?
  2. Are there any limitations to this implementation?
  3. Is there a better way to implement this requirement?

Thanks in advance.

Upvotes: 0

Views: 351

Answers (2)

Alexander Pushkarev
Alexander Pushkarev

Reputation: 1145

As a matter of fact, it is something we did on one of our projects. As I cannot share specifics, I will give you overall architectural view of the project.

The core of all things was a service that could run JUnit tests on requests. It was a Soap web-service, but nothing stops you from making it REST. To implement this you need to implement your version of JUnit test runners (see for example: http://www.mscharhag.com/java/understanding-junits-runner-architecture or https://github.com/junit-team/junit4/wiki/Test-runners)

If you use JUnit as test framework for running your Selenuim tests this may be a great solution for you - JUnit will generate HTML reports for you if you configure it properly, it will hide actual test suite implementation from users and run test suite on demand. This solution is also great because it operates on JUnit level and does not care about what kind of tests it actually runs, so it can be also reused for any other kind of automated tests.

So to answer all your questions:

Can this implementation be accessed by any external automation framework ? -> yes, it can be accessed by anybody who able send http requests

Are there any limitations to this implementation? -> none that I am aware of

Is there a better way to implement this requirement? -> well, I didn't actually work with TestNG much so I don't know if it is easier or more difficult to do it on Junit level. You can use Jenkins or other CI tool as well to achieve same results - they can run JUnit tests for you and almost always have API ready for this, although those APIs may be not perfect.

So I'd say that if you need this only for one thing you can use CI tools for this purpose, if you don't have CI tools available then choice has been made for you. However, from our experience, having this kind of service was a great asset for a company and I really wonder why there's no such products available elsewhere yet.

Upvotes: 0

prithvi394
prithvi394

Reputation: 221

You can create a maven project and have your automated tests under maven test folder.Configure your tests to run through POM.xml(use maven surefire plugin).Configure a jenkins job to run the maven test.Anybody with access the jenkins can build/run this task!

Below link should give you a headstart http://learn-automation.com/selenium-integration-with-jenkins/

Upvotes: 1

Related Questions