Is it possible to programmatically, in java, convert Selenium HTML file to JUnit test source code?
I need my own program which gets only resources of these html files, converts them to java code and automatically runs the JUnit test. Is there any way to do that?
In Selenium IDE, it is possible to export test cases to JUnit, I know that, but I don't want to use IDE, I need to do this programmatically as I said once before.
I believe that someone needed this before and someone can help me...
How about http://code.google.com/p/selenium4j/ ??
How does Selenium4j work? In short Selenium4j translates the HTML tests to Java JUnti tests.
UPDATE
Maven port of this project available through https://github.com/willwarren/selenium-maven-plugin:
<dependency>
<groupId>com.gbi.maven</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
Also it mirrored at warious MVN repos:
http://mojo.codehaus.org/selenium-maven-plugin/
There exists a Firefox plugin for the Selenium IDE called Test Suite Batch Converter which can convert batches of HTML files to any export format the IDE supports.
I took the selenium4j project and turned it into a maven plugin for those who want to take the html test cases and automatically have them run with your maven test phase. You can also separate the tests out using a profile override with surefire.
Readme is here: https://github.com/willwarren/selenium-maven-plugin
The short version of the readme:
Converts this folder structure:
./src/test/selenium
|-signin
|-TestLoginGoodPasswordSmoke.html
|-TestLoginBadPasswordSmoke.html
|-selenium4j.properties
Into
./src/test/java
|-signin
|-firefox
|-TestLoginGoodPasswordSmoke.java
|-TestLoginBadPasswordSmoke.java
This is only tested on windows with Firefox and Chrome.
I couldn't get the IE version to pass a test, but I'm new to selenium so hopefully, if you're a selenium guru, you can get past this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With