简体   繁体   中英

Selenium JUnit Tests failed

I am learning Selenium with the aim of exporting UI tests into JUnit tests and then running them in a CI build.

As a basic test I have a Suite.java and a BasicTest.java which is a test case.

I have used the Selenium export and saved the files to the same location.

When I try and compile the tests it fails.

1st Error - http://pastebin.com/0j37KZ08

To get past this error I add an import to the Suite.java for the BasicTest class, which then gives me the following error:

2nd Error - http://pastebin.com/PKxmdj3L

Source code:

Suite.java - http://pastebin.com/Q6HVNtqT
BasicTest.java - http://pastebin.com/fKCk6iN2
Ant build.xml - http://pastebin.com/x16zHKP0

Any help appreciated.

I don't know if you need a Suite here. The issue seems to be that you are calling addTestSuite() with your BasicTest.class which does not extend junit.framework.TestCase. You should see this if you scrutinize the second error message closely. Of course, you would not subclass junit.framework.TestCase for a JUnit4-style test, so there's a disconnect here as far as what the Suite/framework expects and what you are providing. Maybe just avoid using a suite altogether--personally, I haven't bothered much with suites for some time now. Or, if you are following an example that insists on a suite, you can switch over to the JUnit3-style for purposes of learning.

EDIT: This link should help with JUnit4-style suites if you decide you want to keep the suite.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM