-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Enables user friendly and powerful front end testing of web applications with minimum required effort to implement.
HTMLUnitGenerator is a compiler. It will translate a simple test-language into JUnit test cases. It is designed to simplify testing front end of web applications. This is achieved by writing front end tests in a small, clean and simple test language.
Complete documentation can be found at http://github.com/tomasbjerre/HTMLUnitGenerator/blob/master/doc/htmlunitgenerator.pdf?raw=true
A collection of test cases is available at http://github.com/tomasbjerre/HTMLUnitGenerator/tree/master/compiler/frontend/flowspec/testcases
An example of how you may want to work with this tool can be found at http://github.com/tomasbjerre/HTMLUnitGenerator/tree/master/eclipse/src/test/java/webtest
Test cases can include other test cases. URL:s, XPath:s and/or a common flows may be stored in separate test files.
Path campaignmodule is /html/body/div[2]/div/div[2]/div[2]/div/div[3]
Path searchpopup is //*[@id="modalbox-inner"]
Path _eventId_search is //*[@id="_eventId_search"]
Path campaignModuleChoose is /html/body/div[2]/div/div[2]/div[2]/div/div[3]/div/span/a/span
Path searchPopupChooseFoundOffer is /html/body/div[7]/div/div[9]/form[2]/div[2]/div/a[2]/img
Path orderCartArea is /html/body/div[2]/div/div/div/div[3]/form/div[2]/div[2]/div[3]
Path website is /html/body
Path checkoutOrder is /html/body/div[2]/div/div/div/div[3]/form/div[2]/div[2]/div[3]/div[6]/div/input
Url baspaket is http://www.bredbandsbolaget.se/tv/kanalpaket/baspaket.html
Using the defined XPath:s and URL:s, a test case can be configured like this.
See testcases/BBBSeePaths.flow
See testcases/BBBSeeUrls.flow
Go to baspaket and wait 2 seconds
Find a with attribute href set to /servlet/orderflow/search/search-flow?Id=tcm:142-23371 in campaignmodule
Click on campaignModuleChoose and wait 10 seconds
Find input with attribute id set to _eventId_search in searchpopup
Fill in locationForm with _eventId as search and phoneNumber.fullNumber as 0768966787
Click on _eventId_search and wait 10 seconds
Find input with attribute id set to _eventId_search in searchpopup
Fill in locationForm with address.floor as 3
Click on _eventId_search and wait 10 seconds
Find a with attribute href set to /orderflow/index.html?Id=tcm:142-23381&fromSearch&page=new in searchpopup
The above test case can be extended further if needed.
See testcases/BBBSeeSearchResults.flow
Click on searchPopupChooseFoundOffer and wait 10 seconds
Find option with attribute value set to dsl24 in orderCartArea
Click on checkoutOrder and wait 10 seconds
Find input with attribute src set to /res/img/button/tillbaka.png in website
Forms can also be populated and used in transitions. A more advanced test case using forms and AJAX is available at
Fill in locationForm with _eventId as search and phoneNumber.fullNumber as 0768966787
Click on _eventId_search and wait 10 seconds
See compile.sh and clean.sh
Make sure you have M2_REPO set if you are using Eclipse:
Project -> Properties -> Libraries -> Add Variable
M2_REPO = /home/yourusername/.m2/repository