public void Test1() { const string logsFile = @"C:\JmeterLogs\logs.jtl"; const string jmeterBat = @"C:\apache-jmeter-2.12\bin\jmeter.bat"; const string jmeterTestPlan = @"C:\apache-jmeter-2.12\printable_docs\demos\ForEachTest2.jmx"; /* Build Jmeter Runner configuration */ var jmeterRunner = new JmeterRunner(jmeterBat, new ArgsBuilder()); jmeterRunner. ArgsBuilder .NonGui() //not Gui .CollectReportableData(logsFile) //Collect data .WithTestPlan(jmeterTestPlan); // use this test plan /* Execute Test Plan */ jmeterRunner.Start(); /* Create Report */ jmeterRunner.CreateSummaryReport(PluginTypeCsv.AggregateReport, string.Format(@"C:\JmeterLogs\Summary{0}.csv", DateTime.Now.ToString("yyyyMMddHHmmssfff")), logsFile); Console.WriteLine( jmeterRunner.CreateGraph(PluginTypeGraph.HitsPerSecond, string.Format(@"C:\JmeterLogs\Graph{0}.png", DateTime.Now.ToString("yyyyMMddHHmmssfff")), logsFile)); }
public void TestPlanExecution() { const string path = @"%jmeter%\bin\jmeter.bat"; var argsBuilder = new ArgsBuilder() .NonGui() .LogTo(@"LoopTestPlan.jtl") .WithTestPlan(@"LoopTestPlan.jmx") .WithFailedAssersionReport(); var jmeterRunner = new JmeterRunner(path,argsBuilder); jmeterRunner.Start(); var logPath = @"LoopTestPlan.jtl"; jmeterRunner.CreateSummaryReport(PluginTypeCsv.AggregateReport, @"LoopTestPlan.csv", logPath); var errorsRate = jmeterRunner.GetErrorsRate(logPath); Assert.AreEqual(errorsRate, 83.33d); var totalDuration = jmeterRunner.GetTotalDuration(logPath); Assert.AreNotEqual(totalDuration,0); }