简体   繁体   中英

Using SWTBot on a Maven Project

I am relatively new to SWTBot.

I have installed it through the "install new software" in eclipse.

I am trying to use it on an SWT application that was imported from an existing maven pom.xml . This application is not an eclipse plugin. Its just a standalone plain SWT application.

The problem is that I can't seem to be able to import any of SWTBot's classes in a test case.

I am wondering if there is a maven artefact I may need to add? I am not finding one.

If there is a more complex setup, how can I set it up?

if you installed the swtbot plugin/bundle via eclipse then you'll need an eclipse plugin project that depends on that bundle to hold your tests. Create a new plugin project and edit the manifest file to import the swtbot bundle.

You will then need a run configuration that will launch the application under test. I'm not sure how this can be achieved with a standalone maven project, but there's probably a way. If the project under test was an Eclipse application, you'd only need to right-click on your swtbot test and select run as swtbot test. I don't have an Eclipse with swtbot up and running atm so I can't give more detail, sry

[ EDIT ]

IMHO you should first try to test a dummy eclipse application. Put the plugin containing your test and the one containing your dummy app in your workspace, then run the test as described above. Once you have that running you should have a look at this post and the answer by the maintainer of SWTBot. A new instance of Eclipse will be launched with all UI contributions added by your dummy Eclipse application and the test will be run.

And have you already seen this similar post on SO? Sounds promising to me...

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