Skip to content

Commit a86dab1

Browse files
committed
added tests for nunit2 and robot
1 parent e479f19 commit a86dab1

File tree

14 files changed

+7890
-4
lines changed

14 files changed

+7890
-4
lines changed

src/test/java/tests/workers/imports/NUnit/ClassNameNUnit3HandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tests.workers.imports.IHandlerTest;
88
import utils.FileUtils;
99

10-
import static org.testng.Assert.assertNull;
10+
import static org.testng.Assert.fail;
1111

1212
public class ClassNameNUnit3HandlerTest implements IHandlerTest {
1313
private NUnitV3 nUnitV3;
@@ -32,7 +32,7 @@ public void tryParse(){
3232
try {
3333
nUnitV3 = new NUnitV3(FileUtils.getResourceFile(getFilePath("Nunit3.xml")), TestNameNodeType.className);
3434
} catch (Exception e){
35-
assertNull(e, String.format("Failed on Handler Creating: %s", e.getMessage()));
35+
fail(String.format("Failed on Handler Creating: %s", e.getMessage()), e);
3636
}
3737
}
3838
}

src/test/java/tests/workers/imports/NUnit/FeatureTestNameNUnit3HandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tests.workers.imports.IHandlerTest;
88
import utils.FileUtils;
99

10-
import static org.testng.Assert.assertNull;
10+
import static org.testng.Assert.fail;
1111

1212
public class FeatureTestNameNUnit3HandlerTest implements IHandlerTest {
1313
private NUnitV3 nUnitV3;
@@ -32,7 +32,7 @@ public void tryParse(){
3232
try {
3333
nUnitV3 = new NUnitV3(FileUtils.getResourceFile(getFilePath("Nunit3.xml")), TestNameNodeType.featureNameTestName);
3434
} catch (Exception e){
35-
assertNull(e, String.format("Failed on Handler Creating: %s", e.getMessage()));
35+
fail(String.format("Failed on Handler Creating: %s", e.getMessage()), e);
3636
}
3737
}
3838
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package tests.workers.imports.NUnit;
2+
3+
import main.model.db.imports.Handler;
4+
import main.model.db.imports.ImportHandlers.NUnitV2;
5+
import org.testng.annotations.BeforeMethod;
6+
import tests.workers.imports.IHandlerTest;
7+
import utils.FileUtils;
8+
9+
import static org.testng.Assert.fail;
10+
11+
public class NUnit2HandlerTest implements IHandlerTest {
12+
private NUnitV2 nUnitV2;
13+
14+
@Override
15+
public Handler getHandler() {
16+
return nUnitV2;
17+
}
18+
19+
@Override
20+
public String getReportPath() {
21+
return "reports/NUnit2/";
22+
}
23+
24+
@Override
25+
public String getTestFileName() {
26+
return "tests.json";
27+
}
28+
29+
@BeforeMethod
30+
public void tryParse(){
31+
try {
32+
nUnitV2 = new NUnitV2(FileUtils.getResourceFile(getFilePath("NUnit2.xml")));
33+
} catch (Exception e){
34+
fail(String.format("Failed on Handler Creating: %s", e.getMessage()), e);
35+
}
36+
}
37+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package tests.workers.imports.robot;
2+
3+
import main.model.db.imports.Handler;
4+
import main.model.db.imports.ImportHandlers.PHPCodeception;
5+
import main.model.db.imports.ImportHandlers.Robot;
6+
import org.testng.annotations.BeforeMethod;
7+
import tests.workers.imports.IHandlerTest;
8+
import utils.FileUtils;
9+
10+
import static org.testng.Assert.fail;
11+
12+
public class RobotHandlerTest implements IHandlerTest {
13+
14+
private Robot robot;
15+
16+
@Override
17+
public Handler getHandler() {
18+
return robot;
19+
}
20+
21+
@Override
22+
public String getReportPath() {
23+
return "reports/robot/";
24+
}
25+
26+
@Override
27+
public String getTestFileName() {
28+
return "tests.json";
29+
}
30+
31+
@BeforeMethod
32+
@Override
33+
public void tryParse() {
34+
try {
35+
robot = new Robot(FileUtils.getResourceFile(getFilePath("robot.xml")));
36+
} catch (Exception e){
37+
fail(String.format("Failed on Handler Creating: %s", e.getMessage()));
38+
}
39+
}
40+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<!--This file represents the results of running a test suite-->
3+
<test-results name="D:\framework\test\nunit\UnitTestProject1\UnitTestProject1\bin\Debug\UnitTestProject1.dll" total="4" errors="0" failures="2" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2020-03-17" time="09:56:36">
4+
<environment nunit-version="3.6.0.0" clr-version="4.0.30319.42000" os-version="Microsoft Windows NT 10.0.18363.0" platform="Win32NT" cwd="D:\framework\test\nunit\UnitTestProject1\UnitTestProject1\bin\Debug" machine-name="KNYSHS" user="s.knysh" user-domain="ITRANSITION" />
5+
<culture-info current-culture="ru-RU" current-uiculture="en-US" />
6+
<test-suite type="Assembly" name="D:\framework\test\nunit\UnitTestProject1\UnitTestProject1\bin\Debug\UnitTestProject1.dll" executed="True" result="Failure" success="False" time="0.086" asserts="0">
7+
<properties>
8+
<property name="_PID" value="21528" />
9+
<property name="_APPDOMAIN" value="domain-" />
10+
</properties>
11+
<failure>
12+
<message><![CDATA[One or more child tests had errors]]></message>
13+
<stack-trace />
14+
</failure>
15+
<results>
16+
<test-suite type="Namespace" name="UnitTestProject1" executed="True" result="Failure" success="False" time="0.079" asserts="0">
17+
<failure>
18+
<message><![CDATA[One or more child tests had errors]]></message>
19+
<stack-trace />
20+
</failure>
21+
<results>
22+
<test-suite type="TestFixture" name="UnitTest1" executed="True" result="Failure" success="False" time="0.059" asserts="0">
23+
<failure>
24+
<message><![CDATA[One or more child tests had errors]]></message>
25+
<stack-trace />
26+
</failure>
27+
<results>
28+
<test-case name="UnitTestProject1.UnitTest1.TestMethod1" executed="True" result="Success" success="True" time="0.018" asserts="0" />
29+
<test-case name="UnitTestProject1.UnitTest1.TestMethod2" executed="True" result="Failure" success="False" time="0.032" asserts="0">
30+
<failure>
31+
<message><![CDATA[TestMethod2]]></message>
32+
<stack-trace><![CDATA[ at NUnit.Framework.Assert.Fail(String message, Object[] args)
33+
at UnitTestProject1.UnitTest1.TestMethod2() in D:\framework\test\nunit\UnitTestProject1\UnitTestProject1\UnitTest1.cs:line 19]]></stack-trace>
34+
</failure>
35+
</test-case>
36+
</results>
37+
</test-suite>
38+
<test-suite type="TestFixture" name="UnitTest2" executed="True" result="Failure" success="False" time="0.017" asserts="0">
39+
<failure>
40+
<message><![CDATA[One or more child tests had errors]]></message>
41+
<stack-trace />
42+
</failure>
43+
<results>
44+
<test-case name="UnitTestProject1.UnitTest2.TestMethod3" executed="True" result="Success" success="True" time="0.010" asserts="0" />
45+
<test-case name="UnitTestProject1.UnitTest2.TestMethod4" executed="True" result="Failure" success="False" time="0.006" asserts="0">
46+
<failure>
47+
<message><![CDATA[TestMethod2]]></message>
48+
<stack-trace><![CDATA[ at NUnit.Framework.Assert.Fail(String message, Object[] args)
49+
at UnitTestProject1.UnitTest2.TestMethod4() in D:\framework\test\nunit\UnitTestProject1\UnitTestProject1\UnitTest2.cs:line 19]]></stack-trace>
50+
</failure>
51+
</test-case>
52+
</results>
53+
</test-suite>
54+
</results>
55+
</test-suite>
56+
</results>
57+
</test-suite>
58+
</test-results>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Setup exception."},{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Setup exception."},{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Setup exception."},{"final_result_id":3,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":"My ignore reason"},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":1,"log":" at Example.Tests.Class2.Test2() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class2.cs:line 26\n","start_date":1561543136000,"finish_date":1561543136000,"fail_reason":"Assertion:\r\nMy warn message"},{"final_result_id":1,"log":" at Example.Tests.Class2.Test3() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class2.cs:line 32\n at Example.Tests.Class2.Test3() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class2.cs:line 32\n","start_date":1561543136000,"finish_date":1561543136000,"fail_reason":"Assertion:\r\ntest failed."},{"final_result_id":1,"log":" at Example.Tests.Class2.Test3FailedWithoutMessage() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class2.cs:line 38\n at Example.Tests.Class2.Test3FailedWithoutMessage() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class2.cs:line 38\n","start_date":1561543136000,"finish_date":1561543136000,"fail_reason":"Failed without any message. Please see logs on result page."},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":2,"start_date":1561543136000,"finish_date":1561543136000,"fail_reason":""},{"final_result_id":1,"start_date":1561543136000,"finish_date":1561543137000,"fail_reason":"Test exceeded Timeout value of 1000ms"},{"final_result_id":1,"log":" at Example.Tests.Class1.Test4() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class1.cs:line 59\n at Example.Tests.Class1.Test4() in C:\\Users\\v.kostyukevich\\Downloads\\example-net-nunit-master\\src\\Example\\Tests\\Class1.cs:line 59\n","start_date":1561543137000,"finish_date":1561543152000,"fail_reason":"Assertion:\r\n Expected: True\n But was: False\n"},{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Here is OneTimeSetup exception."},{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Here is OneTimeSetup exception."},{"final_result_id":3,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: Ignore reason for suite"},{"final_result_id":3,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: Ignore reason for suite"},{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Assembly SetUpFixture exception."},{"final_result_id":1,"start_date":-62135769600000,"finish_date":-62135769600000,"fail_reason":"OneTimeSetUp: System.Exception : Assembly SetUpFixture exception."}]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"start_time":1561543135000,"execution_environment":"KOSTYUKEVICHV","finish_time":1561543152000,"author":"ITRANSITION\\v.kostyukevich"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"name":"Test Feature with all results: All passed","body":"Given passed step\r\nThen passed step"},{"name":"Test Feature with all results: step failed","body":"Given passed step\r\nThen failed step"},{"name":"Test Feature with all results: Step skipped","body":"Given passed step\r\nThen skipped step"}]

0 commit comments

Comments
 (0)