Skip to content

Commit 184ea19

Browse files
win: fix windows build tests and disable more cli tests
1 parent cd80338 commit 184ea19

6 files changed

Lines changed: 90 additions & 61 deletions

File tree

webtau-cli-groovy/src/test/groovy/org/testingisdocumenting/webtau/cli/CliBackgroundCommandOutputTest.groovy

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.testingisdocumenting.webtau.console.ConsoleOutputs
2323
import org.testingisdocumenting.webtau.console.ansi.IgnoreAnsiString
2424

2525
import static org.testingisdocumenting.webtau.cli.Cli.cli
26+
import static org.testingisdocumenting.webtau.cli.CliTestUtils.supportedPlatformOnly
2627

2728
class CliBackgroundCommandOutputTest implements ConsoleOutput {
2829
String output
@@ -40,31 +41,35 @@ class CliBackgroundCommandOutputTest implements ConsoleOutput {
4041

4142
@Test
4243
void "should not be killed twice at the end of test"() {
43-
def sleep = cli.runInBackground("scripts/long-sleep")
44-
sleep.stop()
44+
supportedPlatformOnly {
45+
def sleep = cli.runInBackground("scripts/long-sleep")
46+
sleep.stop()
4547

46-
CliBackgroundCommandManager.destroyActiveProcesses()
48+
CliBackgroundCommandManager.destroyActiveProcesses()
4749

48-
output = output.replaceAll(/\(\d+ms\)/, "(time)")
49-
def optionalLastLine = '. background cli command : scripts/long-sleep finished with exit code 143 (time)\n'
50-
output = output.replace(optionalLastLine, '')
50+
output = output.replaceAll(/\(\d+ms\)/, "(time)")
51+
def optionalLastLine = '. background cli command : scripts/long-sleep finished with exit code 143 (time)\n'
52+
output = output.replace(optionalLastLine, '')
5153

52-
output.should == '> running cli command in background scripts/long-sleep\n' +
53-
'. ran cli command in background scripts/long-sleep (time)\n' +
54-
'> stopping cli command in background scripts/long-sleep\n' +
55-
'. stopped cli command in background scripts/long-sleep (time)\n'
54+
output.should == '> running cli command in background scripts/long-sleep\n' +
55+
'. ran cli command in background scripts/long-sleep (time)\n' +
56+
'> stopping cli command in background scripts/long-sleep\n' +
57+
'. stopped cli command in background scripts/long-sleep (time)\n'
58+
}
5659
}
5760

5861
@Test
5962
void "should be killed at the end of test"() {
60-
cli.runInBackground("scripts/long-sleep")
61-
CliBackgroundCommandManager.destroyActiveProcesses()
63+
supportedPlatformOnly {
64+
cli.runInBackground("scripts/long-sleep")
65+
CliBackgroundCommandManager.destroyActiveProcesses()
6266

63-
output = output.replaceAll(/\(\d+ms\)/, "(time)")
64-
output.should == '> running cli command in background scripts/long-sleep\n' +
65-
'. ran cli command in background scripts/long-sleep (time)\n' +
66-
'> stopping cli command in background scripts/long-sleep\n' +
67-
'. stopped cli command in background scripts/long-sleep (time)\n'
67+
output = output.replaceAll(/\(\d+ms\)/, "(time)")
68+
output.should == '> running cli command in background scripts/long-sleep\n' +
69+
'. ran cli command in background scripts/long-sleep (time)\n' +
70+
'> stopping cli command in background scripts/long-sleep\n' +
71+
'. stopped cli command in background scripts/long-sleep (time)\n'
72+
}
6873
}
6974

7075
@Override

webtau-cli-testing/pom.xml

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,42 +38,53 @@
3838
</dependency>
3939
</dependencies>
4040

41-
<build>
42-
<plugins>
43-
<plugin>
44-
<groupId>org.testingisdocumenting.webtau</groupId>
45-
<artifactId>webtau-maven-plugin</artifactId>
46-
<version>${project.version}</version>
47-
<executions>
48-
<execution>
49-
<phase>test</phase>
50-
<goals>
51-
<goal>run</goal>
52-
</goals>
53-
<configuration>
54-
<workingDir>${project.basedir}/src/test/groovy</workingDir>
55-
<tests>
56-
<directory>${project.basedir}/src/test/groovy</directory>
57-
<includes>
58-
<include>scenarios/*.groovy</include>
59-
</includes>
60-
</tests>
61-
</configuration>
62-
</execution>
63-
</executions>
64-
</plugin>
41+
<profiles>
42+
<profile>
43+
<id>linux</id>
44+
<activation>
45+
<os>
46+
<family>linux</family>
47+
</os>
48+
</activation>
6549

66-
<plugin>
67-
<groupId>org.codehaus.gmavenplus</groupId>
68-
<artifactId>gmavenplus-plugin</artifactId>
69-
<executions>
70-
<execution>
71-
<goals>
72-
<goal>addTestSources</goal>
73-
</goals>
74-
</execution>
75-
</executions>
76-
</plugin>
77-
</plugins>
78-
</build>
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.testingisdocumenting.webtau</groupId>
54+
<artifactId>webtau-maven-plugin</artifactId>
55+
<version>${project.version}</version>
56+
<executions>
57+
<execution>
58+
<phase>test</phase>
59+
<goals>
60+
<goal>run</goal>
61+
</goals>
62+
<configuration>
63+
<workingDir>${project.basedir}/src/test/groovy</workingDir>
64+
<tests>
65+
<directory>${project.basedir}/src/test/groovy</directory>
66+
<includes>
67+
<include>scenarios/*.groovy</include>
68+
</includes>
69+
</tests>
70+
</configuration>
71+
</execution>
72+
</executions>
73+
</plugin>
74+
75+
<plugin>
76+
<groupId>org.codehaus.gmavenplus</groupId>
77+
<artifactId>gmavenplus-plugin</artifactId>
78+
<executions>
79+
<execution>
80+
<goals>
81+
<goal>addTestSources</goal>
82+
</goals>
83+
</execution>
84+
</executions>
85+
</plugin>
86+
</plugins>
87+
</build>
88+
</profile>
89+
</profiles>
7990
</project>

webtau-graphql/src/test/groovy/org/testingisdocumenting/webtau/graphql/GraphQLCoverageTest.groovy

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ import org.junit.Test
2020
import org.testingisdocumenting.webtau.utils.ResourceUtils
2121
import org.junit.Before
2222

23+
import java.nio.file.Paths
24+
2325
import static org.testingisdocumenting.webtau.graphql.TestUtils.validationResult
2426

2527
class GraphQLCoverageTest {
2628
private GraphQLCoverage coverage
2729

2830
@Before
2931
void setUp() {
30-
def schemaUrl = ResourceUtils.resourceUrl('test-schema.graphql')
31-
coverage = new GraphQLCoverage(new GraphQLSchema(schemaUrl.file))
32+
def schemaUrl = Paths.get(ResourceUtils.resourceUrl('test-schema.graphql').toURI()).toString()
33+
coverage = new GraphQLCoverage(new GraphQLSchema(schemaUrl))
3234
}
3335

3436
@Test
@@ -39,7 +41,6 @@ class GraphQLCoverageTest {
3941
coverage.nonCoveredOperations().should == ['*name' | '*type' ] {
4042
___________________________________________
4143
'taskById' | GraphQLOperationType.QUERY
42-
'uncomplete' | GraphQLOperationType.MUTATION
43-
}
44+
'uncomplete' | GraphQLOperationType.MUTATION }
4445
}
4546
}

webtau-graphql/src/test/groovy/org/testingisdocumenting/webtau/graphql/GraphQLReportDataProviderTest.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ import org.junit.Before
2020
import org.junit.Test
2121
import org.testingisdocumenting.webtau.utils.ResourceUtils
2222

23+
import java.nio.file.Paths
24+
2325
import static org.testingisdocumenting.webtau.graphql.TestUtils.validationResult
2426

2527
class GraphQLReportDataProviderTest {
2628
def schemaUrl = ResourceUtils.resourceUrl('test-schema.graphql')
27-
def coverage = new GraphQLCoverage(new GraphQLSchema(schemaUrl.file))
29+
def coverage = new GraphQLCoverage(new GraphQLSchema(Paths.get(schemaUrl.toURI()).toString()))
2830
def reportDataProvider = new GraphQLReportDataProvider({ coverage })
2931

3032
@Before

webtau-graphql/src/test/groovy/org/testingisdocumenting/webtau/graphql/GraphQLSchemaTest.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import org.junit.Test
55
import org.testingisdocumenting.webtau.http.json.JsonRequestBody
66
import org.testingisdocumenting.webtau.utils.ResourceUtils
77

8+
import java.nio.file.Paths
9+
810
class GraphQLSchemaTest {
911
private GraphQLSchema schema
1012

1113
@Before
1214
void setUp() {
13-
def schemaUrl = ResourceUtils.resourceUrl('test-schema.graphql')
14-
schema = new GraphQLSchema(schemaUrl.file)
15+
def schemaUrl = Paths.get(ResourceUtils.resourceUrl('test-schema.graphql').toURI()).toString()
16+
schema = new GraphQLSchema(schemaUrl)
1517
}
1618

1719
@Test

webtau-report-testing/src/test/groovy/scenarios/cliDetails.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import static org.testingisdocumenting.webtau.WebTauGroovyDsl.*
2020
import static pages.Pages.*
2121

2222
scenario('cli calls') {
23+
if (isWindows()) {
24+
return
25+
}
26+
2327
report.openGroovyStandaloneReport('cli/simpleRun-webtau-report.html')
2428
report.selectTest('simple cli run')
2529

@@ -29,4 +33,8 @@ scenario('cli calls') {
2933
report.standardCliOutput().should == ~/welcome to my script/
3034

3135
browser.doc.capture('cli-calls')
36+
}
37+
38+
static boolean isWindows() {
39+
return System.getProperty("os.name").startsWith("Windows")
3240
}

0 commit comments

Comments
 (0)