Selenium - programmatically convert html to junit

Is it possible to programmatically, in java, convert a Selenium HTML file into JUnit source code?

I need my own program, which receives only the resources of these html files, converts them to java code and automatically runs the JUnit test. Is there any way to do this?

In the Selenium IDE, you can export test cases to JUnit, I know this, but I do not want to use the IDE, I need to do this programmatically, as I said earlier.

I believe that someone needed this before, and someone can help me ...

+8
java junit selenium
source share
4 answers

What about http://code.google.com/p/selenium4j/ ??

 How does Selenium4j work?

 In short Selenium4j translates the HTML tests to Java JUnti tests.

UPDATE

The Maven port of this project is 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> 

It also affects random MVN repositories:

http://mojo.codehaus.org/selenium-maven-plugin/

+3
source share

There is a Firefox plugin for the Selenium IDE called Test Suite Batch Converter , which can convert batches of HTML files to any export format supported by the IDE.

+2
source share

I took the selenium4j project and turned it into a maven plugin for those who want to take html test cases and use them automatically, do your maven test phase. You can also separate tests using profile redefinition using surefire.

Readme here: https://github.com/willwarren/selenium-maven-plugin

Short version of readme:

Converts this folder structure:

 ./src/test/selenium |-signin |-TestLoginGoodPasswordSmoke.html |-TestLoginBadPasswordSmoke.html |-selenium4j.properties 

IN

 ./src/test/java |-signin |-firefox |-TestLoginGoodPasswordSmoke.java |-TestLoginBadPasswordSmoke.java 

This is only checked on windows with Firefox and Chrome.
I could not get the IE version to pass the test, but I am new to selenium, I hope if you are a selenium guru, you can pass this by.

+2
source share

Take a look at selenese4J-maven-plugin. Like selenium4j ( https://github.com/RaphC/selenese4j-maven-plugin ).

Provides many features: Selenium 1/2 conversion (WebDriver). Create a test suite. Internationalization of your html file. The ability to use a fragment in your html file for a specific test (for example: a working day of calculation, recording user-generated values, processing dynamic values ​​...) Using token properties

0
source share

All Articles