TestProject Forum
Powered by leading experts in the test automation community

How do I package java file properly before uploading it to TestProject?

Hi Marat,

I have an issue with addon action file upload to TestProject. I tried to export this java file as an ordinary JAR file and as an runnable JAR file but both times when I try to upload this jar file to my newly created addon I get a an error message saying unable to upload file.

How do I package java file properly before uploading it to TestProject addon library?

Regards,

Nemanja

Are you using Gradle ? Create a JAR task in your Gradle file as described here:

Yes, I’m using Gradle. I can’t even upload CleraFields.java action in your web/adon after I export it as a jar file. I’m using your online example so build.gradle file is:

//==============================================
group ‘io.testproject’
version ‘0.1’

apply plugin: ‘java’

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

// Configurations
configurations {
tpsdk
compile.extendsFrom tpsdk
}

// JAR Task
jar {
archiveName “{rootProject.name}-{version}.jar”
dependsOn configurations.runtime
from {
// Removes TestProject SDK from the final jar file
(configurations.runtime - configurations.tpsdk).collect {
it.isDirectory() ? it : zipTree(it)
}
}
}

dependencies {
// Update the location of the sdk as required
tpsdk files(‘io.testproject.sdk.java.jar’)
}

//==============================================

Can you please attach you JAR file here?

Can you tell me how to upload? There is no upload file button available …

Can you please upload to a file sharing service such as Google Drive and share a link?

here it is:

https://drive.google.com/open?id=12e4ggk48ERHowkbj_Gb7aazlnEBhcLY7

You JAR file contains not only compiled classes but bin, build folders and Gradle configuration files…
Where from (IDE?) and how do you execute the Gradle task? Can you share the Gradle console output?

I unchecked all the binaries and created new jar file and still I’m not able to upload it:

I imported three separate Gradle projects: Addon,Runners and Test in eclipse and added project dependencies. I execute my gradle task locally by running runner class which then calls proper test class. This is an example of my run test console output:

23:29:58.520 [main] DEBUG io.testproject.java.sdk.v2.Runner - Starting development session…
23:30:03.590 [main] INFO io.testproject.java.sdk.v2.Runner - Development session initialized
23:30:03.597 [main] INFO io.testproject.java.sdk.v2.Runner - Development session connection established via local.rdr.tpagent.io:62943

  • word1Stats: ??? 16.300 ??? (0,37 ???/?)
  • Result1 Value: 16300
  • Time1 Value: 0.37
  • word1Stats: ??? 128.000 ??? (0,39 ???/?)
  • Result2 Value: 128000
  • Time2 Value: 0.39
  • Google TEST - PASS

It’s great that you can debug locally using Runner and the exported JAR looks much better, but still missing the manifest.json file.
When you bundle resources using Gradle you should put the file under src/main/resources, is that what you did ?
Attached extracted JAR file - there is no manifest.json file in it :’(