Author: pmouawad
Date: Sat Feb 23 16:37:52 2019
New Revision: 1854226
URL: http://svn.apache.org/viewvc?rev=1854226&view=rev
Log:
Add tests for AssertionGui
Added:
jmeter/trunk/test/src/org/apache/jmeter/assertions/gui/
jmeter/trunk/test/src/org/apache/jmeter/assertions/gui/AssertionGuiSpec.groovy
Added:
jmeter/trunk/test/src/org/apache/jmeter/assertions/gui/AssertionGuiSpec.groovy
URL:
http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/assertions/gui/AssertionGuiSpec.groovy?rev=1854226&view=auto
==============================================================================
---
jmeter/trunk/test/src/org/apache/jmeter/assertions/gui/AssertionGuiSpec.groovy
(added)
+++
jmeter/trunk/test/src/org/apache/jmeter/assertions/gui/AssertionGuiSpec.groovy
Sat Feb 23 16:37:52 2019
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License") you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jmeter.assertions
+
+import org.apache.jmeter.assertions.gui.AssertionGui;
+import org.apache.commons.lang3.StringUtils
+import org.apache.jmeter.junit.spock.JMeterSpec
+import org.apache.jmeter.samplers.SampleResult
+import spock.lang.Unroll
+
+import java.nio.charset.StandardCharsets
+
+@Unroll
+class AssertionGuiSpec extends JMeterSpec {
+
+ def sut = new AssertionGui()
+
+ def "init of component fails"() {
+ when:
+ sut.init()
+ then:
+ notThrown(Exception)
+ }
+
+ def "clearGui fails"() {
+ when:
+ sut.clearGui()
+ then:
+ notThrown(Exception)
+ }
+
+ def "createTestElement fails"() {
+ when:
+ def result = sut.createTestElement()
+ then:
+ result.getName().equals("Response Assertion")
+ result.isEnabled()
+ }
+
+ def "modifyElement has unexpected behaviour"() {
+ given:
+ def element = new ResponseAssertion();
+ when:
+ sut.modifyTestElement(element)
+ then:
+ element.getName().isEmpty()
+ element.isTestFieldResponseData()
+ element.getTestStrings().isEmpty()
+ reult.isAssumeSuccess()
+ result.isSubstringType()
+ !result.isNotType()
+ }
+
+ def "configure has unexpected behaviour"() {
+ given:
+ def element = new ResponseAssertion();
+ when:
+ sut.configure(element)
+ then:
+ notThrown(Exception)
+ }
+}