vendredi 29 janvier 2016

How can I split my Java Selenium tests into separate classes?

I'm currently working at my job to perform GUI testing of our web page using Selenium 2 via Java in Eclipse. I've been trying to program my tests in such a way that I maximize the amount of code I can reuse and as a consequence I now have a lot of helper methods that function almost like a framework. This has lead to my test class becoming fairly bloated with only one method used as the actual test and the rest being the implementation of the test.

Currently I just run the testing right from eclipse with all my methods being static.

From what I understand there are a couple different ways I could try to separate things out:

One way would be to put all the methods into a class I use as a framework and extend it when writing an actual test, but I don't know if having a framework in a framework (Selenium) makes sense.

Another way would possibly be making my helper methods into an object where I can have one of these objects for each test. I don't know if this is good practice though, or if it will cause problems down the road. It would also mean I'd have to type more to do the same amount of testing.

My main questions are:

What's the best way to split up my testing class into test classes and an implementation class? Is what I'm doing outside the intended usage of Selenium?

Aucun commentaire:

Enregistrer un commentaire