Reputation: 25
I wrote Selenium tests (which I run with TestNG) for the webpage and would like to make a basic GUI. So basically, I would like to have a GUI with few checkboxes (to determine which tests should I run), "start" button and results of the tests - quite simple.
My problem is that I would like to somehow run tests when I click start in my GUI app and I am not sure if that is possible to do with TestNG (or any other testing framework). I know that I should write that code in the listener for the "start" button but I have no idea how to call tests.
The alternative idea is not to use any testing tools, basically just calling many methods which would return a boolean value if some test passed or not - which I don't think it's a smart idea.
Upvotes: 1
Views: 94
Reputation: 25
From TestNG documentation:
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { Run2.class });
testng.addListener(tla);
testng.run();
Source: https://testng.org/doc/documentation-main.html#running-testng-programmatically
Upvotes: 0