title,body,link,tags,view_count,is_answered,score,answer_count,critical points
Cypress/Javascript Test Automation Condition Advice,"I am working on an automation in Cypress that goes through all my invoices (on invoce portal) and if the amount on the invoice is greater than 0, I want to click on the &quot;PAY&quot; button and continue the payment flow. But there are cases when the amount is zero and the &quot;PAY&quot; button is not displayed, in this case I need to change the next flow and instead of cashing the invoice I need to delete it.
So I would like to find a way to include the condition in the test and so basically branch the test into two possible scenarios. The condition should look something like this:
<ol>
<li>when &quot;PAY&quot; button exists -&gt; invoice reimbursement flow</li>
<li>when the &quot;PAY&quot; button does not exist or the displayed amount is 0 -&gt; invoice deletion flow</li>
</ol>
Thank you for any advice
",https://stackoverflow.com/questions/73810766/cypress-javascript-test-automation-condition-advice,"['javascript', 'testing', 'automation', 'cypress']",61,FALSE,0,1,"Edge case testing
Cypress
Conditional testing"
2 Important Testflight Advice Questions,"Hope you're well. Two quick guidance questions from the community. And I really value your advice. We're a fintech company and hoping to do an external tester effort of a few thousand folks in testflight. That said, had two questions:
<ol>
<li>I recall it's not possible to test actual transactions in testflight (commerce, banking, otherwise). Is that the case or am I mis-remembering?
</li>
<li>Irrespective of the above, one of the concerns is the transition from testflight to live app store. If I recall correctly, there's no way to port X number of people in your external tester effort to the live app and save their info, correct? You basically have to start fresh with those folks (i.e. have them go to the app store, download the released/consumer version, then set up all new accounts where it'd be hard to port to their new accounts their testflight account data)?
</li>
</ol>
Warmest thanks for the feedback! Hope the appreciation comes across.
Evan
",https://stackoverflow.com/questions/73787634/2-important-testflight-advice-questions,"['testing', 'testflight', 'beta']",7,FALSE,0,0,"User testing and user evaluation
Test cases for when the app is live
No answer provided"
Advice on testing MediatR controllers and handlers,"I have a very subjective question, and I would like some opinions. I know there is no right answer, and sorry if this is against the rules, but I'm posting it because it may help others.
In my project, 99% of the controllers follow the following model:
    [HttpPost]
    [Route(&quot;filter&quot;)]
    public async Task&lt;ActionResult&lt;MyDTO&gt;&gt; Filter([FromBody] MyCommand data)
    {
        var result = await Mediator.Send(data);

        return HttpResponse(result);
    }

I receive an object that is a command class and this object is then sent to Mediator. The response is sent to the HttpResponse method in my BaseController, and this method is responsible for interpreting the Mediator answer and return 200, 400, 500, etc and map the response to a DTO when needed.
The BaseController has its own tests, <strong>so is there any reason/advantage of testing these controllers?</strong> I see that if I do that, I'm just testing the MediatR library and I can not see the point of it.
Now let's talk about the MediatR handlers. Some of my handlers have a little bit of logic, so I really need to test them.  But some other handlers work only as a shortcut to a given service, like this:
MediatR handler
    public class Handler : BaseQueryHandler&lt;Command&gt;
    {
        private readonly IAnalyticModuleStore _context;

        public Handler(IHttpContextAccessor httpContextAccessor, IAnalyticModuleStore context)
            : base(httpContextAccessor)
        {
            _context = context;
        }

        protected override async Task&lt;object&gt; ExecuteAsync(Command request)
        {
            return await _context.FilterAsync(request.DateFrom, request.DateTo, request.Versions, request.Areas, request.Domains, request.Actions,
                request.Users, request.Agents, request.Responses, null, request.Duration, request.EntityId);
        }
    }

Don't worry about the BaseQueryHandler, it is properly tested.
This is how I would write a test for this handler: mock the IAnalyticModuleStore service and the FilterAsync method, then create a command and send it to the handler to assert the response values.
But assuming that the IAnalyticModuleStore.FilterAsync method is properly tested, in the end, what I'm testing is a fake object. <strong>Is there any reason/advantage of testing these handlers?</strong>
",https://stackoverflow.com/questions/66029052/advice-on-testing-mediatr-controllers-and-handlers,"['c#', 'unit-testing', 'testing']",953,TRUE,0,2,"What kind of tests should be written for particular modules?
Integration testing
MediatR"
API Testing / REST Assured Automation Testing Advice and or suggestions,"Really looking for some practical advice and general guidance. 
Below is the current scenario.
I have an excel document each row would be considered a test with inputs.
There would be hundreds if not thousands of rows.
Lets for example say Row1 would look like

Col1----------|Col2---------------|Col3<br>
TestingUser|TestingSurname|1980/01/01

This needs to me mapped to a JSON object then sent / POST to an API end point.
I then need to assert the data that is coming back to make sure it’s the correct values.
The tools I have looked at is:<br>
<br>
ReadyAPI<br>
rest-assured.io

Would you recommend any other tool or framework for this type of testing. 
If you have worked with something and you can provide an example that would be great.
",https://stackoverflow.com/questions/61095332/api-testing-rest-assured-automation-testing-advice-and-or-suggestions,"['json', 'testing', 'automated-tests', 'rest-assured', 'web-api-testing']",1847,FALSE,0,3,"API Testing
Technology looked at: ReadyAPI, rest-assured.io, TestNG
"
React - Advice for testing a NavBar Component,"I am a new user trying to understand testing of React components. I am using Enzyme with Jest in a Typescript environment. 

One of the components that I am trying to test is a NavBar component, implemented using material-ui buttons. 

<pre class=""lang-js prettyprint-override"">const NavBarLinks = (): JSX.Element =&gt; (
  &lt;&gt;
    &lt;Button
      color=""inherit""
      component={NavLink}
      activeClassName={navbar.highlighted}
      to=""/about""
    &gt;
      About
    &lt;/Button&gt;
    &lt;Button
      activeClassName={navbar.highlighted}
      color=""inherit""
      component={NavLink}
      to=""/courses""
    &gt;
      Courses
    &lt;/Button&gt;
    &lt;Button
      activeClassName={navbar.highlighted}
      color=""inherit""
      component={NavLink}
      exact={true}
      to=""/""
    &gt;
      Home
    &lt;/Button&gt;
  &lt;/&gt;
);


I have written a snapshot test to test that the component renders buttons with expected links and properties etc.

Is there a need to also test that the navbar component changes the route when a button has been clicked? I have started writing a test for this functionality <a href=""https://stackoverflow.com/questions/59554819/how-to-test-a-route-change-in-a-navbar-component-with-jest-and-enzyme-in-a-types"">here</a>.

Is it the view that the NavLink component provided by react-router already has tests for this functionality. Subsequently, it is unnecessary to write tests for changing each route on the navbar?
",https://stackoverflow.com/questions/59561729/react-advice-for-testing-a-navbar-component,"['reactjs', 'testing', 'enzyme']",4129,TRUE,1,1,"What type of test should be used for testing certain components?
React, Enzyme, Jest, TypeScript"
I had to solve before being invited for the technical interview. could you guys take a look and advice me the proper answer?,"Function takes two and only two characters as input. It returns 1 when each entered symbol is either letter or number and 0 in other cases.
Numbers are Hindu-Arabic numerals from 0 to 9. Letters are Latin, Cyrillic or Modern Greek alphabet.

The bug was found before, slogan is: ""Cyrillic letter can be treated as non-letter symbol""

Actions to reproduce:

Function input: ΑУ.

Expected output: 1. (Logic: only letters). 

Observed output: 0.

The bug was fixed. Existing  tests  were  already  ran  as  a  regression test  after  bugfix, here   is   the  test report:

Input   Expected output Status
ΑΑ  1   Passed

1Α  1   Passed

11  1   Passed

Α$  0   Passed

(1  0   Passed

What tests cases will you do for bug's verification?
What tests cases will you propose to enforce regression testing of the function?
Negative tests like input less than 2 symbols and input more than 2 symbols are out of scope for both bug verification and additional regression test cases.
We will be glad to see your reasoning and argumentation as an addition, but the main thing is to provide test cases for both bug verification and additional regression test cases.
",https://stackoverflow.com/questions/56953177/i-had-to-solve-before-being-invited-for-the-technical-interview-could-you-guys,"['testing', 'manual-testing']",215,FALSE,0,0,Technical interview question regarding bug verification and regression testing
Looking for an advice how to test if the currency shortcut is correct,"I am writing a program which converts the values of each currency to another using simple API. I had no trouble at all developing that simple program, but I am currently struggling in testing it.
I am a 3 month programmer so don't blame me for code quality - give me tips for the future.

I have already written a test which checks if the conversion from each currency to another is correct, now I am looking for a way to test if a currency shortcut(for ex. EUR, PLN, JPY, AUD..) is correct, what I mean is that test should provide to me an information when a name (AUR or JPU) is not correct. I got a class ""Rates"" which contains values of JSON Properties of each currency. 

<pre class=""lang-java prettyprint-override"">package pl.sda.CurrencyConverter_RZ.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rates {

    @JsonProperty(""BGN"")
    private Double BGN;

    @JsonProperty(""NZD"")
    private Double NZD;

    @JsonProperty(""ILS"")
    private Double ILS;

    @JsonProperty(""RUB"")
    private Double RUB;

    @JsonProperty(""CAD"")
    private Double CAD;

    @JsonProperty(""USD"")
    private Double USD;

    @JsonProperty(""PHP"")
    private Double PHP;

    @JsonProperty(""CHF"")
    private Double CHF;

    @JsonProperty(""AUD"")
    private Double AUD;

    @JsonProperty(""JPY"")
    private Double JPY;

    @JsonProperty(""TRY"")
    private Double TRY;

    @JsonProperty(""HKD"")
    private Double HKD;

    @JsonProperty(""MYR"")
    private Double MYR;

    @JsonProperty(""HRK"")
    private Double HRK;

    @JsonProperty(""CZK"")
    private Double CZK;

    @JsonProperty(""IDR"")
    private Double IDR;

    @JsonProperty(""DKK"")
    private Double DKK;

    @JsonProperty(""NOK"")
    private Double NOK;

    @JsonProperty(""HUF"")
    private Double HUF;

    @JsonProperty(""GBP"")
    private Double GBP;

    @JsonProperty(""MXN"")
    private Double MXN;

    @JsonProperty(""THB"")
    private Double THB;

    @JsonProperty(""ISK"")
    private Double ISK;

    @JsonProperty(""ZAR"")
    private Double ZAR;

    @JsonProperty(""BRL"")
    private Double BRL;

    @JsonProperty(""SGD"")
    private Double SGD;

    @JsonProperty(""PLN"")
    private Double PLN;

    @JsonProperty(""INR"")
    private Double INR;

    @JsonProperty(""KRW"")
    private Double KRW;

    @JsonProperty(""RON"")
    private Double RON;

    @JsonProperty(""CNY"")
    private Double CNY;

    @JsonProperty(""SEK"")
    private Double SEK;

    @JsonProperty(""EUR"")
    private Double EUR;


}


<pre class=""lang-java prettyprint-override"">package pl.sda.CurrencyConverter_RZ.service;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import pl.sda.CurrencyConverter_RZ.model.Currencies;

import java.math.BigDecimal;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
class CurrencyServiceTest {

    public static Currencies currencyValue = new Currencies();
    public static CurrencyService currencyService = new CurrencyService();

    @BeforeAll
    static void setUp() {

    }

    @Test
    @DisplayName(""If conversion is correct by multiplying values"")
    void shouldReturnTrueByMultiplying() {
        BigDecimal fromPLNtoEUR = currencyService
                .convertCurrencyValue(1, ""PLN"", ""EUR"", ""2019-04-20"", 4);
        BigDecimal fromEURtoPLN = currencyService
                .convertCurrencyValue(1, ""EUR"", ""PLN"", ""2019-04-20"", 4);
        assertAll(() -&gt; assertThat((fromPLNtoEUR.multiply(fromEURtoPLN)).setScale(0, BigDecimal.ROUND_HALF_DOWN))
                .isEqualTo(BigDecimal.valueOf(1)),
                () -&gt; assertThat((fromEURtoPLN.multiply(fromPLNtoEUR)).setScale(0, BigDecimal.ROUND_HALF_DOWN))
                        .isEqualTo(BigDecimal.valueOf(1)));
    }

//    @ParameterizedTest   // &lt;- to check if its needed
//    @CsvSource({""AUD"", ""JPY""})
    @DisplayName(""Tests if shortcut of currency is correct"")
    void shouldReturnTrueIfCurrencyShortcutIsCorrect(String currencyShortcut, String correctCurrencyShortcut) {
        //TODO
    }
}


I am now wondering if I can somehow get those names from a class (only names, not values from JSON), rather that testing them one by one. Hope that someone understand what I am trying to say. Also if someone wouldn't mind giving me tips how to improve my 1st test would be awesome. It returns a BigDecimal value from each currency to another.
",https://stackoverflow.com/questions/55785724/looking-for-an-advice-how-to-test-if-the-currency-shortcut-is-correct,"['java', 'testing']",42,FALSE,1,0,How to write unit tests in Java
Advice on a quicker way to debug EAR (Java web application)?,"Currently, I'm trying to debug a monster web application... and it's brutal

Here's the workflow:

<ol>
<li>Change a couple lines of code</li>
<li>Ant Build (Takes 25 minutes)</li>
<li>Delete  tags in JBOSS config file</li>
<li>Start JBOSS</li>
<li>Point JBOSS at the EAR</li>
<li>Open browser to <a href=""http://localohost:8080/app"" rel=""nofollow noreferrer"">http://localohost:8080/app</a></li>
<li>Find out the couple of lines of code didn't fix the bug</li>
<li>Cycle and repeat. </li>
</ol>

Anyone have advice to speed this up? 

It literally take me one hour to write a logger.log(statement);

And... we don't have the project properly configured with eclipse, hence the ANT builds and lack of breakpoints. 
",https://stackoverflow.com/questions/50052735/advice-on-a-quicker-way-to-debug-ear-java-web-application,"['java', 'eclipse', 'testing', 'build']",40,FALSE,0,0,How to test Java web applications (EAR) quicker?
Need advice for testing in php,"I'm very new to tests. I have a webapp that stores books and informations about books.

If i call my route /store/ it trigger my store methods and creating a new book into my database. This are the simplified methods:

Book.php class file:

public function __construct() {
  $this-&gt;bookService = new BookService();
}

public function store() {
    $input = /* get post input values */
    $this-&gt;createDatabaseEntry($input);
}

private function createDatabaseEntry($input) {
    // Creating database entry
    $book = /* bla bla */

    $languages = $this-&gt;bookService-&gt;fetchLanguages($book-&gt;goodreads_id);
    // And here i loop over the $languages and store them all in a extra table.
}


And here i have an other Service class BookService.php:

public function fetchLanguages($goodreads_id) {
    // Here i make an guzzle http call to a other service from goodreads.com
}


How do i test this without making a http request to goodreads? I need to verify the languages are in the database. I can work with fixtures for fetchLanguages(). But how can i stub/mock (i don't know the correct term) this function?

I using Laravel and PHPUnit.
",https://stackoverflow.com/questions/41345589/need-advice-for-testing-in-php,"['php', 'testing']",37,FALSE,1,1,How to stub/mock?
Need advice about testing using Chimp.js/Mocha in Meteor.js,"I'm trying to teach myself testing with Meteor but there is so much conflicting and outdated info online it's really difficult to work out what I need to do.

My current situation it that I have an application using the latest Meteor version (and the imports folder structure).

I've installed chimp globally and have created a /tests directory.

My first test is using chimp/mocha to fill in a form and try to insert something to the database. I'm also using the xolvio/backdoor package and running chimp like so 

chimp --ddp=http://localhost:3000 --mocha --path=tests

Here's my test code:

describe('Chimp Mocha', function() {
    describe( 'Create a Client', function() {

        it( 'should fill in add client form', function() {
            browser.setValue('#clientName', 'Test')
                    .setValue('#clientEmail', 'test@test.com')
                    .selectByValue('#numberTeamMembers', '25')
                    .submitForm('#createClient')
        });

        it( 'should check the collections for new client data', function() {
            let getClient = server.execute( function() {
              return Clients.findOne({ name: 'Test' });
            });

            expect( getClient.name ).to.equal( 'Test' );
        });

        after( function() {
            server.execute( function() {
              let client = Clients.findOne( { name: 'Test' } );
              if ( client ) {
                Clients.remove( client._id );
              }
            });
        });


    });
});


This is throwing an error that Clients is undefined

However, if I add

import { Clients } from '/imports/api/clients/clients.js';

I get this error Error: Cannot find module '/imports/api/clients/clients.js'

What am I doing wrong? Should I be using chimp? Any help would really be appreciated because I don't find the Meteor guide very clear about this!

Thanks
",https://stackoverflow.com/questions/40824956/need-advice-about-testing-using-chimp-js-mocha-in-meteor-js,"['testing', 'meteor', 'mocha.js', 'chimp.js']",264,TRUE,0,1,"Debugging the code.
Chimp.js, Mocha, Meteor"
Compile test and run? Can someone give any advice?,"This Java code should prompt the user to choose between Morse code and English, then prompt them to enter a string in the language they chose. It should then produce a translation to the other language. It compiles on my machine, though it sometimes doesn't work correctly. 

Can someone else try and run it for me and just tell me if it works? If not, can you point me to the error in my code that is producing the runtime error?

public class MorseCodeJavaProgram 
{
    public static void morse( String s3 )
    {
        int letters [ ] = new int [ 26 ];

        for ( int num = 0; num &lt; s3.length(); num++ )
        {
            switch ( s3.charAt( num ) )
            {
                case 'a':
                    System.out.print( "".- "");
                    break;
                case 'b':
                    System.out.print( ""-… "");
                    break;
                case 'c':
                    System.out.print( ""-.-. "");
                    break;
                case 'd':
                    System.out.print( ""-.. "");
                    break;
                case 'e':
                    System.out.print( "". "");
                    break;
                case 'f':
                    System.out.print( ""..-. "");
                    break;
                case 'g':
                    System.out.print( ""--. "");
                    break;
                case 'h':
                    System.out.print( ""…. "");
                    break;
                case 'i':
                    System.out.print( "".. "");
                    break;
                case 'j':
                    System.out.print( "".--- "");
                    break;
                case 'k':
                    System.out.print( ""-.- "");
                    break;
                case 'l':
                    System.out.print( "".-.. "");
                    break;
                case 'm':
                    System.out.print( ""-- "");
                    break;
                case 'n':
                    System.out.print( ""-. "");
                    break;
                case 'o':
                    System.out.print( ""--- "");
                    break;
                case 'p':
                    System.out.print( "".--. "");
                    break;
                case 'q':
                    System.out.print( ""--.- "");
                    break;  
                case 'r':
                    System.out.print( "".-. "");
                    break;  
                case 's':
                    System.out.print( ""... "");
                    break;
                case 't':
                    System.out.print( ""- "");
                    break;  
                case 'u':
                    System.out.print( ""..- "");
                    break;  
                case 'v':
                    System.out.print( ""...- "");
                    break;
                case 'w':
                    System.out.print( "".-- "");
                    break;
                case 'x':
                    System.out.print( ""-..- "");
                    break;
                case 'y':
                    System.out.print( ""-.-- "");
                    break;
                case 'z':
                    System.out.print( ""--.. "");
                    break;
                case ' ':
                    System.out.print( "" | "");
                    break;
            }

        }
    }

    public static void toEnglish( String s1 )
    {
        String english [ ] = { ""a"", ""b"", ""c"", ""d"", ""e"", ""f"", ""g"", ""h"", ""i"", ""j"", ""k"", ""l"", ""m"", ""n"", ""o"", ""p"", ""q"", ""r"", ""s"", ""t"", ""u"", ""v"", ""x"", ""y"", ""z"", "" "" };
        String morse [ ] = { "".- "", ""-... "", ""-.-. "", ""-.. "", "". "", ""..-. "", ""--. "", ""…. "", "".. "", "".--- "", ""-.- "", "".-.. "", ""-- "", ""-. "", ""--- "", "".--. "", ""--.- "", "".-. "", ""... "", ""- "", ""..- "", ""...- "", "".-- "", ""-..- "", ""-.-- "", ""--.. "", ""| "" };

        for ( int num = 0; num &lt; s1.length(); num++ )
        {
            if ( s1.charAt ( num ) == ' ')
            {
                for ( int num2 = num; num2 &lt; s1.length(); num2++ )
                {
                    if ( s1.charAt ( num2++ ) == ' ')
                    {
                        for ( int num3 = 0; num &lt; 26; num3++ )
                        {
                            if ( s1.substring( num++, num2 + 2 ) == ( morse [ num3 ] ))
                            {
                                System.out.print( english [ num3 ] );
                            }
                        }
                    }

                }


            }
        }
    }

    public static void main( String [] args)
    {
        System.out.println(""Begin Program"");

        String s2 = Input.getString( ""To Morse or From Morse"" );
        if (""From Morse"".equals(s2)  ){
            String s1 = Input.getString( ""Please type a phrase in English"" );
            toEnglish( "" "" + s1 + "" "" );
        }

        if (""To Morse"".equals(s2) )
        {
            String s3 = Input.getString( ""Please type a phrase in Morse Code"" );
            morse( s3 );
        }
    }
}


When I get an error it states ""Check console for possible error message, unable to be launched.""

Below I added the Input.java file to be compiled to Input.class

import javax.swing.*;


public class Input
{
    public static byte getByte( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Byte.parseByte( input );
    }

    public static short getShort( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Short.parseShort( input );
    }

    public static int getInt( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Integer.parseInt( input );
    }

    public static long getLong( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Long.parseLong( input );
    }

    public static float getFloat( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Float.parseFloat( input );
    }

    public static double getDouble( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Double.parseDouble( input );
    }

    public static boolean getBoolean( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return Boolean.parseBoolean( input );
    }

    public static char getChar( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return input.charAt(0);
    }

    public static String getString( String s )
    {
        String input = JOptionPane.showInputDialog( s );
        return input;
    }

}

",https://stackoverflow.com/questions/34570638/compile-test-and-run-can-someone-give-any-advice,"['java', 'testing', 'compilation', 'runtime-error']",81,TRUE,-3,1,Debugging the code and error is mentioned. Edge cases in unit testing is discussed
