I
I
Ivan Petrov2017-07-21 18:39:15
Java
Ivan Petrov, 2017-07-21 18:39:15

How to pass parameters via command line to autotests in java?

Hello.
There is a project on java + maven + testNg + selenium.
Autotests for an online store.
The structure of the tests is such that each test is inherited from the base test class. And in the base test class, settings are set, such as

  • state - guest or authorized user
  • browser
  • site language.
  • server - dev or prod

I want to run a test suite through the command line and pass these options to each test class.
I've only been working with Java for a month. Tell me how this can be implemented?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mipan, 2017-07-21
@mipan

testNg allows you to create tests with parameters via xml, e.g.

A
Alexey, 2017-07-26
@TheKnight

QaTools Properties
You create a basic config, after which you can use Maven arguments to change the values. It turns out very convenient.
For local debugging, you can overwrite the current values ​​using the properties file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question