Skip to content

Does not support composite projects with relative paths to files #84

Description

@gpaciga

When using composite projects, testengine-cli is unable to package the project files properly. When trying to resolve the paths to files to package into a zip file, testengine-cli will produce the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

It seems to be because when parsing the composite project files, testengine-cli does not set resourceRoot attribute, which is necessary for determining the path to any files.

This is in contrast to non-composite projects which do set resourceRoot and are able to locate and package external files correctly.

Smartbear advises exporting a .zip file manually from ReadyAPI to work around this, but this is impractical in CI environments where each commit expects tests to be run, and a committed zip file can easily become out of sync with the actual tests and interferes with normal git workflows.

Instead, we are working around this by adding the following patch to bin/readyapi_project.js, in the parseComposite method, to use the same logic the parse method uses to find the resourceRoot of the project:

diff --git a/bin/readyapi_project.js b/bin/readyapi_project.js
index 7af487f..0cbe5e1 100644
--- a/bin/readyapi_project.js
+++ b/bin/readyapi_project.js
@@ -71,6 +71,12 @@ module.exports.parseComposite = function (pathname) {
     jsonProject['con:soapui-project']['con:testSuite'] = getCompositeTestSuites(pathname, jsonProject);
     result = postProcessStructure(jsonProject);
     result['name'] = jsonProject['con:soapui-project']['attr']['@_name'];
+
+    let resourceRoot = path.dirname(pathname);
+    if ( ('@_resourceRoot' in jsonProject['con:soapui-project']['attr']) && (jsonProject['con:soapui-project']['attr']['@_resourceRoot'].length > 0))
+        resourceRoot = jsonProject['con:soapui-project']['attr']['@_resourceRoot'];
+    result['resourceRoot'] = resourceRoot;
+
     result['projectFiles'] = jsonProject['projectFiles'];
     return result
 };

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions