简体   繁体   中英

How to set up my groovy class so I can use it's instance in other groovy scripts

I am automation tester fighting this issue: on this project we are running automated tests from SoapUI tool, or via maven... so basically git testing repository includes just Soap's source XML, pom, some data and a bunch of support .groovy scripts(!!! these are not classes, they are just scripts doing some tasks, they are called from SoapUI tool to perform some action!!!). In the scripts there are multiple code repetitions, and I would like to clean them = create standalone classes with methods to substitute and simplify unnecessary code.

  1. For POC I've created few classes, compiled them with groovyc (I defined 'folderN' as a package - see the structure below), but I cannot import them from scripts - also I cannot edit them - they seem to be read only, but I want to modify them from time to time...(I am a newbie when it comes to the class compilation, creating packages etc.)

2.Repo structure:

-repo:
      -sourceSoapFile.xml
      -pom.xml
      -folderN-fewClasses.groovy
      -folderM-folder1-fewScripts.groovy
              |
              -folder2-fewScripts.groovy
              |
              ...
         
  1. What is my target: to be able to create instance of classes in scripts, the way that anyone downloading my repository can run scripts with class's instances without any further actions needed.

What am I doing wrong please? Thank you

我没有将我的 FolderN 标记为源文件,因为它是 Maven 项目......现在工作正常

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