Custom Bug Control - XMLNodeStore

4 posts, 0 answers
  1. Krutin
    Krutin avatar
    1 posts
    Member since:
    Feb 2013

    Posted 28 Feb 2013 Link to this post

    Hi,

    I just installed Telerik Test Studio in my machine for create bugs in Bugzilla using custom bug control with C#.
    But while developing this control i got stuck at savings settings in settings.aiis file while saving settings using SaveTo method of "BugTrackerPersistableSettings" class of "ArtOfTest.WebAii.Design.Extensibility.BugTracking". In this method i did not know how to pass and store data in XMLStoreNode.

    So kindly help me in this matter and if you have any full Project regarding Custom bug control please share it with me.
  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 04 Mar 2013 Link to this post

    Hello Krutin,

    Please read this article on "How to Create a Custom Bug Tracking Plugin" first. Here's a sample code that we are using for our TeamPulse bug tracker:
    using ArtOfTest.WebAii.Design.Extensibility.BugTracking;
     
    // keep the old namespace for backwards compatibility
    namespace Telerik.TestStudio.TeamPulseBugTracker
    {   
        [System.Serializable]
        public class TeamPulseTrackerSettings : BugTrackerPersistableSettings
        {
            const string PROJECT_NAME_NODE = "ProjectName";
            const string SERVER_NAME_NODE = "SeverName";
            const string SEVERITY_NAME_NODE = "Severity";
            const string PRIORITY_NAME_NODE = "Priority";
            const string PROJECT_ID_NODE = "ProjectID";
     
            private string projectName;
            private string serverName;
            private string severityStatus;
            private string priorityStatus;
            private int projectId;
     
            #region Constructors
            public TeamPulseTrackerSettings()
            {
                 
            }
     
            public TeamPulseTrackerSettings(TeamPulseTrackerSettings other)
            {
                this.projectName = other.projectName;
                this.serverName = other.serverName;
                this.severityStatus = other.severityStatus;
                this.priorityStatus = other.priorityStatus;
                this.projectId = other.projectId;
            }
            #endregion
     
            public int ProjectId
            {
                get
                {
                    return this.projectId;
                }
                set
                {
                    this.projectId = value;
                }
            }
     
            public string PriorityStatus
            {
                get
                {
                    return this.priorityStatus;
                }
                set
                {
                    this.priorityStatus = value;
                }
            }
     
            public string SeverityStatus
            {
                get
                {
                    return this.severityStatus;
                }
                set
                {
                    this.severityStatus = value;
                }
            }
     
            public override string ProjectName
            {
                get
                {
                    return this.projectName;
                }
                set
                {
                    this.projectName = value;
                }
            }
     
            public override string ServerName
            {
                get
                {
                    return this.serverName;
                }
                set
                {
                    this.serverName = value;
                }
            }
     
            public override string RootName
            {
                get
                {
                    return "TeamPulseTrackerSettings";
                }
            }
     
            public override void SaveTo(ArtOfTest.Common.Serialization.XmlStoreNode store)
            {
                store.AddValue(PROJECT_NAME_NODE, this.projectName);
                store.AddValue(SERVER_NAME_NODE, this.serverName);
                store.AddValue(SEVERITY_NAME_NODE, this.severityStatus);
                store.AddValue(PRIORITY_NAME_NODE, this.priorityStatus);
                store.AddValue(PROJECT_ID_NODE, this.projectId);
            }
     
            public override void LoadFrom(ArtOfTest.Common.Serialization.XmlStoreNode store)
            {
                this.projectName = store.GetValue<string>(PROJECT_NAME_NODE);
                this.serverName = store.GetValue<string>(SERVER_NAME_NODE);
                this.severityStatus = store.GetValue<string>(SEVERITY_NAME_NODE);
                this.priorityStatus = store.GetValue<string>(PRIORITY_NAME_NODE);
                this.projectId = store.GetValue<int>(PROJECT_ID_NODE);
            }       
        }
    }

    Note that 'projectName' and 'serverName' are a mandatory fields.

    You will also need to implement the abstract BugTrackerPersistableSettings class:
    public abstract class BugTrackerPersistableSettings : IXmlPersistable
    {
        #region IXmlPersistable Members
     
        public virtual string RootName
        {
            get
            {
                return string.Empty;
            }
        }
     
        public Version CurrentVersion
        {
            get
            {
                return new Version(ArtOfTest.Common.Design.VersionConstants.DesignerVersion);
            }
        }
     
        /// <summary>
        /// Get the project name.
        /// </summary>
        public abstract string ProjectName { get; set; }
     
        /// <summary>
        /// Get the server name.
        /// </summary>
        public abstract string ServerName { get; set; }
     
        public abstract void SaveTo(XmlStoreNode store);
     
        public abstract void LoadFrom(XmlStoreNode store);
     
        public XmlBlob XmlBlob
        {
            get;
            set;
        }
     
        #endregion
    }

    If you manage to implement your custom bug control, I can also offer you some Telerik points if you'd like to share the solution with us with permissions to distribute it to other customers. 

    Let me know if we can assist you further with this.

    Kind regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Fullji
    Fullji avatar
    1 posts
    Member since:
    Apr 2013

    Posted 13 Jun 2013 Link to this post

    Hi Plamen,

    We have a requirement for creating a custom plug-in for test studio with a bug tracking system. We plan to use bug tracker Rest API.
    We have referred the telerik custom plugin article but are confused  as to how to implement it in class library project.
    How to get custom plugin option in Extension bug tracking, where do we specify the bug tracker login api and where to specify bug tracker create new defect apis.
    We would be grateful if you could help solve our queries.

    Thanks,
    FB 
  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 14 Jun 2013 Link to this post

    Hi FB,

    @How to get custom plugin option in Extension bug tracking?
    First you need to implement your Custom Bug Tracking Plugin in a Class Library project as seen in this article. Then compile the project and copy the dll from the "\Bin\Debug" folder of your class library project to the Test Studio's "Plugins" folder - %ProgramFiles%\Telerik\Test Studio\Bin\Plugins\. Once this is done, run Test Studio and you'll see your custom plugin when you click on the Extensions>Bug Tracking icon.

    @Where do we specify the bug tracker login api?

    For this you need to implement the IBugTrackerConnectionUI interface and then use the ConnectionUI property to access the connection UI:
    /// <summary>
    /// Get the connection settings UI.
    /// Each provider exposes its own specific settings and handles connection internally.
    /// </summary>
    IBugTrackerConnectionUI ConnectionUI { get; }

    IBugTrackerConnectionUI interface:
    /// <summary>
    /// Represents the connection UI to provide to the users on configuring the bug tracker.
    /// </summary>
    public interface IBugTrackerConnectionUI : INotifyPropertyChanged
    {
        /// <summary>
        /// The control to present to the users so that they can fill in the necessary connection data.
        /// </summary>
        System.Windows.Controls.Control SettingsControl { get; }
         
        /// <summary>
        /// Whether to allow the user to save the state (makes sense in addition to OnSave implementation).
        /// Optional, return 'true' so that the user can always click the respective button.
        /// </summary>
        bool CanSave { get; }
     
        /// <summary>
        /// Whether to let the user close the UI. Optional, return 'true' so that the user can click the respective button.
        /// </summary>
        bool CanClose { get; }
     
        /// <summary>
        /// Optional, enables customizing the close click handling.
        /// </summary>
        void OnClose();
     
        /// <summary>
        /// Optional, enables customizing the save click handling.
        /// </summary>
        void OnSave();
     
    }

    Where the SettingsControl is a UI control that you need to implement. This will contain the UI that will be presented to the users so they can fill in the connection data.  

    @Where to specify bug tracker create new defect apis?
    For this you need to implement the SubmitBug method from the IBugTracker interface: 
    /// <summary>
    /// Submits a bug to the bug tracking tool.
    /// </summary>
    int SubmitBug(IBug bug);

    IBug interface: 
    /// <summary>
    /// Represents the bug from the tracking system.
    /// </summary>
    public interface IBug
    {
        /// <summary>
        /// Get/set the bug assignee.
        /// </summary>
        string AssignedTo { get; set; }
     
        /// <summary>
        /// Get the bug attachments.
        /// </summary>
        List<IBugAttachment> Attachments { get; }
     
        /// <summary>
        /// Get the bug author.
        /// </summary>
        string Author { get; }
     
        /// <summary>
        /// Get the date the bug has been submitted.
        /// </summary>
        DateTime CreatedDate { get; }
     
        /// <summary>
        /// Get/set the bug description.
        /// </summary>
        string Description { get; set; }
     
        /// <summary>
        /// Get the Id of bug in the bug tracking system.
        /// </summary>
        int ID { get; }
     
        /// <summary>
        /// Get/set the bug priority.
        /// </summary>
        int Priority { get; set; }
     
        /// <summary>
        /// Get/set the bug title.
        /// </summary>
        string Title { get; set; }
    }

    Hope this helps! 
     
    Regards,
    Plamen
    Telerik
    Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
    Reserve your seat today!
Back to Top