Editing Packages for Jira Integration

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Editing Packages for Jira Integration

Post by VanessaS » Mon Aug 07, 2017 3:04 pm

Hello All,

I'm completely stumped. I edited the Ranorex-Jira Integration Code (downloaded from the Internet as per Ranorex Support) and now I'm trying to create a .dll to upload my changes to Ranorex 7.1 as a package.

But... um... it doesn't compile (csc C#). What do I do now? Am I even supposed to compile the code? Am I using the right compiler? Am I supposed to just cut-n-paste into a usercode module, or something? Am I going about this completely wrong?

All of the UserGuide stuff just says something like, "The whole project which contains the code for the JiraReporter is available on GitHub under the following link:... Please feel free to modify the code according to individual needs and/or upload new modules." But there's no explanation of how to upload new modules and what format they should have.

Or am I really the only tester out there who didn't figure this out on their own, so everyone is just face-palming reading this?

Cheers, Vanessa

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Tue Aug 08, 2017 12:32 pm

To clarify, I receive the following error messages (lots of them, all concerning TestVariable, Ranorex, Drawing, etc.):

Fehler CS0246 The type or namespace name 'ITestModule' could not be found (are you missing a using directive or an assembly reference?) RanorexJira C:\Users\sedlmeier\Documents\GitHub\Ranorex-Jira-Integration-master\JiraReporter\InitializeJiraReporter.cs 68 Aktiv

In Visual Studio, I added references to Ranorex.Core.dll, Ranorex.Core.dll, and TechTalk.JiraRestClient.dll, but it doesn't help anything.

Could this be related to my <TargetFrameworkVersion>? The .csproj contains v3.5.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Editing Packages for Jira Integration

Post by krstcs » Tue Aug 08, 2017 1:20 pm

Did you add using statements in all files where you are using Ranorex libraries? This is required for the compiler to know which namespaces to look for classes in. They will be at the very top/start of the file and will look like this:

Code: Select all

using System;        <--- These are using directives
using System.IO;
using Ranorex;

namespace MyProject.MyFolder1.MyFolder2
{
    class MyClass
    {
        public MyClass()
        {
        }
    }
}
Edit to add: It would be helpful if you posted your code/project or a sample, so we can see exactly what is going on. If you can't upload it due to size, you can put it up on a file sharing site and link that. If you can't put it up due to company restrictions, then you might try emailing support and letting them do a remote session.
Shortcuts usually aren't...

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Tue Aug 08, 2017 1:50 pm

I had all of the using statements and added references by hand, as well, so I was confused as to why it wasn't compiling. Spent all day hacking and searching online for hints, and it turns out that I just needed to change my .NET framework to 4.0 from 4.0 Client.

Now I get no compiler errors except:

"TestCase" is obselete. "Please use the TestCaseNode class instead."

Which I understand, but I'm using the git version for Ranorex 7.x and the corresponding Ranorex.Core.dll. Error links to code examples like:

Code: Select all

        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
          var tc = TestCase.Current;

          if (tc == null)
          {
            Report.Error("TestCase is 'null'; this usually happens when the module is used outside of testcases (e.g., global teardown).");
          }

          if(tc.Status == Ranorex.Core.Reporting.ActivityStatus.Failed)
          {
            try
            {
              var curIssue = JiraReporter.ReOpenIssue(JiraIssueKey);

              if (curIssue != null)
              {
                Report.Info("Jira issue reopened -- IssueKey: " + curIssue.Key + "; IssueID: " + curIssue.Id);
                Report.LogHtml(ReportLevel.Info, "<a href=\"" + JiraReporter.ServerURL + "/browse/" + curIssue.Key + "\">" + curIssue.Key + "</a>");
              }
              else
                Report.Warn("Could not re-open Jira issue -- IssueKey: " + curIssue.Key);
            }
            catch(Exception e)
            {
              var inner = e.InnerException;
              string str = "";
              if(inner != null)
              {
                var prop = inner.GetType().GetProperty("ErrorResponse");
                if(prop != null)
                  str = (string)prop.GetValue(e.InnerException, null);
              }

              Report.Error(e.Message + " (InnerException: " + e.InnerException + " -- " + str + ")");
            
            }
          }
        }
    }
}
If I just load the packages direct from the Ranorex Package Manager, I don't have this problem.

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Tue Aug 08, 2017 1:54 pm

Thanks for responding, by the way. I used to live near Austin. :D

I also had to delete the Project and reload it in VS as a class library, which got rid of the "main missing" error.

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Tue Aug 08, 2017 1:59 pm

Do I need to use an older Ranorex.Core.dll? Or do I have to edit all of the TestCase stuff?

Ugh, just noticed that the original source code from github hasn't been changed for two years, which means it's using an outdated Ranorex.Core.dll. Great.

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Editing Packages for Jira Integration

Post by krstcs » Tue Aug 08, 2017 2:11 pm

If you are using Ranorex 7.X, then you just need to change your code to use the new methods. Because of the new Smart Folders, they changed the API to better reflect the new paradigm.

API: https://www.ranorex.com/Documentation/Ranorex/



Yeah, we are just moving to the Austin area, I changed jobs a few months ago. We lived in San Antonio for almost 15 years and then DFW for 4, now we're back to central TX.
Shortcuts usually aren't...

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Tue Aug 08, 2017 4:08 pm

Thank you! It works well now.

Married a German guy who thinks Texas is "too darned hot". LOL Well, it's nice over here, too.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Editing Packages for Jira Integration

Post by Support Team » Tue Aug 08, 2017 6:10 pm

Ugh, just noticed that the original source code from github hasn't been changed for two years, which means it's using an outdated Ranorex.Core.dll. Great.
There are active branches of the Jira plugin for Ranorex 7.0+ here:
https://github.com/ranorex/Ranorex-Jira ... n/branches

Cheers,
Ned

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Wed Aug 09, 2017 9:25 am

Wow, they've changed a lot. I've got the older source working now, but I'll try the new one out and see how it goes.

Thanks!
Vanessa

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Wed Aug 09, 2017 4:28 pm

I had to change the .NET Framework everywhere, including in Ranorex, to 4.52 in order to get it to run at all.
Ranorex1.PNG
And now I get the following message:
Ranorex3.PNG
I think it's similar to this error, that Alain reported in the Jira blog post: https://www.ranorex.com/blog/integratin ... into-jira/
You do not have the required permissions to view the files attached to this post.

User avatar
VanessaS
Posts: 18
Joined: Mon Jul 24, 2017 9:18 am
Location: Bavaria, Germany

Re: Editing Packages for Jira Integration

Post by VanessaS » Fri Oct 06, 2017 8:28 am

Just updating this post to note that the newest "Ranorex Jira Reporter" package Version 7.1.2.1 finally works. Well, the automatic Jira generation works; they're still bugfixing the OnDemand part.