Handling database in external tests
Posted: Mon Aug 11, 2014 4:28 am
Hello,
I want to perform some functional testing using Selenium. I have launched demo site and everything is well, but then I face one problem - I have no idea how to operate database so I can clean effects of test cases.
For example:
I have several test cases generated for register form. When I execute test case with valid data, user gets registered and therefore it might affect further cases.
Of course database it reset during every startup by defaul, but that is of no use - I want to be able to operate data freely, so I can delete exact entries rather than everything, not to mention doing full startup for every test case is silly.
My tests are in another project and I would like to just use jdbc driver there, but it is very hard to directly alter database - foreign keys, cascade dependencies and overall I feel like it is bruteforce solution.
I would be grateful if you could give me some hints about how to do it in more elegant way. Maybe creating test in external project is not good practice? If so, can you point some precise documentation that won't take ages to read and understand?
I am 100% newbie in webapp and JEE environment, so please have mercy, I won't be able to dig through complex stuff.
Thank you in advance.
I want to perform some functional testing using Selenium. I have launched demo site and everything is well, but then I face one problem - I have no idea how to operate database so I can clean effects of test cases.
For example:
I have several test cases generated for register form. When I execute test case with valid data, user gets registered and therefore it might affect further cases.
Of course database it reset during every startup by defaul, but that is of no use - I want to be able to operate data freely, so I can delete exact entries rather than everything, not to mention doing full startup for every test case is silly.
My tests are in another project and I would like to just use jdbc driver there, but it is very hard to directly alter database - foreign keys, cascade dependencies and overall I feel like it is bruteforce solution.
I would be grateful if you could give me some hints about how to do it in more elegant way. Maybe creating test in external project is not good practice? If so, can you point some precise documentation that won't take ages to read and understand?
I am 100% newbie in webapp and JEE environment, so please have mercy, I won't be able to dig through complex stuff.
Thank you in advance.