DonN's avatar
DonN
Occasional Contributor
8 years ago
Status:
New Idea

Performance Graphs visible elsewhere.

The performance graph is excellent, but can only be seen in Test Complete itself. Please allow this graph to be exported to PDF or something so we can show this excellent graph in places management can see it. 

1 Comment

  • DonN's avatar
    DonN
    Occasional Contributor

    FYI: 

     

    Have written a little program to decode MHT files. This will pull out all the various packed sections and create unpacked (viewable) files instead.

     

    This means you can pull out the performance graphs and display the, in Confluence, where management can then relate to the work done. This reads log file SCW.mht and writes to several files in the Temp directory. 

     

    This post removes leading spaces so apologies for the format. Enjoy :-) 

     

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApplication1
    {
    class Program
    {


    static void Main(string[] args)
    {

    int counter = 0;
    string line;

    // Read the file and display it line by line.
    System.IO.StreamReader file =
    new System.IO.StreamReader("c:\\temp\\SCW.mht");
    while ((line = file.ReadLine()) != null)
    {
    var jpgLoc = line.LastIndexOf(".jpg");
    var gifLoc = line.LastIndexOf(".gif");
    var pngLoc = line.LastIndexOf(".png");
    var bmpLoc = line.LastIndexOf(".bmp");
    var htmLoc = line.LastIndexOf(".htm");
    var jsLoc = 0; // line.LastIndexOf(".js");

    if ((jpgLoc > 0) || (gifLoc > 0) || (pngLoc > 0) || (bmpLoc > 0) || (htmLoc > 0) || (jsLoc > 0))
    {

    var dashLoc = line.LastIndexOf("_");
    var revSlashLoc = line.LastIndexOf("\\");
    var slashLoc = line.LastIndexOf("/");
    if (revSlashLoc > dashLoc) dashLoc = revSlashLoc;
    if (slashLoc > dashLoc) dashLoc = slashLoc;
    // var fileName = SST(line);
    var fileName = line.Substring(dashLoc + 1);
    if (fileName != null)
    {
    Console.WriteLine(fileName);
    CreateEncodedFile(fileName, file);
    Zane(fileName);
    }
    }
    counter++;
    Console.WriteLine(counter);
    }

    file.Close();

    // Suspend the screen.
    Console.ReadLine();
    }

    static void CreateEncodedFile(string filename, System.IO.StreamReader file)
    {
    int counter = 0;
    string line;

    System.IO.StreamWriter outfile = new System.IO.StreamWriter("c:\\temp\\Zipped\\" + filename);

    line = file.ReadLine();
    line = "xxx";

    while (line != "")
    {
    line = file.ReadLine();
    // Console.WriteLine(line);
    outfile.WriteLine(line);
    }
    outfile.Close();
    }

    // outfile

    /* static string SST(string s)
    {

    int found = 0;
    string zzz = "";
    found = s.LastIndexOf("_");
    if (found > 0)
    {
    //Console.WriteLine("Found = " + found + " len = " + s.Length);
    zzz = s.Substring(found + 1);
    //Console.WriteLine(" {0}", zzz);

    }
    return zzz;
    }

    */
    static void Zane(string filename)
    {

    string encodedString = System.IO.File.ReadAllText("C:\\Temp\\Zipped\\" + filename);

    byte[] data = Convert.FromBase64String(encodedString);
    //string decodedString = Encoding.UTF8.GetString(data);
    //string[] lines = { data };
    System.IO.File.WriteAllBytes("c:\\temp\\unZipped\\" + filename, data);
    }
    }
    }