I'm really new here and started writing some UI tests using selenium and testng and wanted to know how do you structure the folders, it is a maven project and using java. I'm putting all the test files in src/test/java, is that the correct apporach? Noted it will run my UI tests when building, not sure if I want that.

  • 1
    not sure if I want that. What exactly do you want to achieve? – Alexey R. Jan 9 '19 at 13:14
  • It's a new project, nothing is done yet and there is a lot yet to be defined, but the idea is to start with ui tests, integrate with jenkins and run the tests remotely. – user36524 Jan 9 '19 at 13:37

You should check out Page Object Model. It clearly shows how to organize your classes in folders, packages, etc.
You can find some articles about this in the Internet, but at the beginning you can check here and here.

My project folder structure as reference

  • Thank you for the screenshot, my project looks like that! – user36524 Jan 9 '19 at 16:15

If you want your tests to be controlled by Maven you have to adhere maven convention to house-keep your tests. Hence you have to keep them in your test source folder (that can actually be overwritten in pom.xml file).

Normally tests are executed via surefire plugin that has the documentation here. More specifically, you can discover that you can disable test execution by default and run your goal with -DskipTests=false argument when you want them not to be skipped.

There is also an option not to bind your tests to Maven. There is some specific though. You'll have to run your tests straight from your code and this way is different in different test frameworks. Here is my example for TestNg: https://sqa.stackexchange.com/a/36905/27679

  • Thanks, this answers my question completely and you also provided extra info and some really useful links! – user36524 Jan 9 '19 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy