public void TestAllSitesThreadsTest()
        {
            SessionParser          parser       = new SessionParser();
            List <HttpRequestData> httpRequests = null;

            var tester = new StressTester();

            var swatch = new Stopwatch();

            swatch.Start();

            var results = tester.CheckAllSites(httpRequests, 40, 40);

            Assert.IsNotNull(results);

            swatch.Stop();

            long totalTime = swatch.ElapsedMilliseconds / 1000;

            Console.WriteLine(tester.ParseResults(results, (int)totalTime));

            int count = 0;

            foreach (var result in results.OrderByDescending(res => res.StatusCode))
            {
                count++;
                Console.WriteLine(count + ". " + result.Url);
                Console.WriteLine("\t" + result.StatusCode + "  " + result.TimeTakenMs.ToString("n0") + "ms " + result.ErrorMessage);
            }
        }
        public void TestParser()
        {
            SessionParser          parser       = new SessionParser();
            var                    options      = new StressTesterConfiguration();
            List <HttpRequestData> httpRequests = parser.ParseFile(STR_TestFile, ref options);

            Assert.IsNotNull(httpRequests);

            Console.WriteLine(httpRequests.Count);
            foreach (var req in httpRequests)
            {
                Console.WriteLine("--\r\n");
                Console.WriteLine(req.HttpVerb + " -- " + req.Url);
                Console.WriteLine(req.Host);
                foreach (var header in req.Headers)
                {
                    Console.WriteLine(" " + header.Name + ": " + header.Value);
                }

                if (!string.IsNullOrEmpty(req.RequestContent))
                {
                    Console.WriteLine("\r\n" + req.RequestContent);
                }
            }
        }
Exemplo n.º 3
0
        //Xac dinh dong du lieu noi dung
        public IActionResult XDDDLNDA()
        {
            List <ParserViewModel>           oldList = SessionParser.GetSession(this.HttpContext);
            List <CXacDinhDongDLNDViewModel> newList = new List <CXacDinhDongDLNDViewModel>();

            foreach (var item in oldList)
            {
                newList.Add(CRFSServices.KetNoiThanhCumDuLieuAsync(item));
            }
            SessionXacDinhDongDuLieuNoiDung.SetSession(newList, this.HttpContext);
            return(View(newList));
        }
Exemplo n.º 4
0
        public void ExportPostman()
        {
            SessionParser          parser       = new SessionParser();
            var                    options      = new StressTesterConfiguration();
            List <HttpRequestData> httpRequests = parser.ParseFile(STR_WebSurgeSampleFile, ref options);

            var postman = new PostmanIntegration();

            string result = postman.Export("Test", httpRequests, options);

            Assert.IsNotNull(result, "postman export failed: nothing returned");

            Console.WriteLine(result);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Parser()
        {
            List <SearchViewModel> listSearch = SessionGoogle.GetSessionGoogleSearch(this.HttpContext);
            List <ParserViewModel> listParser = new List <ParserViewModel>();

            if (ModelState.IsValid)
            {
                foreach (var item in listSearch)
                {
                    listParser.Add(await CRFSServices.getParserAsync(item));
                }
            }
            SessionParser.SetSession(listParser, this.HttpContext);
            return(View(listParser));
        }
        public void TestParserLf()
        {
            SessionParser parser  = new SessionParser();
            var           options = new StressTesterConfiguration();

            string reqs = @"POST http://localhost:5000/api/BodyTypes/JsonStringBody HTTP/1.1
Accept-Encoding: gzip,deflate
Content-type: application / json
Websurge-Request-Name: JsonStringBody

""Windy Rivers are the best!""

------------------------------------------------------------------

POST http://localhost:5000/api/BodyTypes/JsonPlainBody HTTP/1.1
Accept-Encoding: gzip,deflate
Content-type: text/plain
Websurge-Request-Name: JsonPlainBody

Windy Rivers are the best!
";

            reqs = reqs.Replace("\r\n", "\n");


            List <HttpRequestData> httpRequests = parser.Parse(reqs, ref options);

            Assert.IsNotNull(httpRequests);

            Console.WriteLine(httpRequests.Count);
            foreach (var req in httpRequests)
            {
                Console.WriteLine("--\r\n");
                Console.WriteLine(req.HttpVerb + " -- " + req.Url);
                Console.WriteLine(req.Host);
                foreach (var header in req.Headers)
                {
                    Console.WriteLine(" " + header.Name + ": " + header.Value);
                }
                if (!string.IsNullOrEmpty(req.RequestContent))
                {
                    Console.WriteLine("\r\n" + req.RequestContent);
                }
            }
        }
        public void CheckSiteSyncTest()
        {
            SessionParser          parser       = new SessionParser();
            List <HttpRequestData> httpRequests = null;

            Assert.IsNotNull(httpRequests);

            foreach (var req in httpRequests)
            {
                var tester = new StressTester();
                var res    = tester.CheckSite(req);

                Assert.IsNotNull(res, "No Result Returned.");
                Assert.IsNotNull(res.IsError, res.ErrorMessage);

                Console.WriteLine(res.StatusCode + " " + res.Url + " " + res.TimeTakenMs.ToString("n0") + " " + res.ErrorMessage);
                //Console.WriteLine(res.ResponseContent);
            }
        }