Skip to main content

I amI'm very new to using C#/SpecflowC#/Specflow to write tests so thank you for the patience. I have a test, that ends like this:

Then the Details page should display the rating zip code
    And the Details page should display the ID
    And the Details page should display the Eligible Employee count

And the code behind looks like this:

    [Then(@"the Details page should display the rating zip code")]
    public void ThenTheDetailsPageShouldDisplayTheRatingZipCode()

    {          
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(3) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));          
    }

    [Then(@"the Details page should display the ID")]
    public void ThenTheDetailsPageShouldDisplayTheID()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(1) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

    [Then(@"the Details page should display the Eligible Employee count")]
    public void ThenTheDetailsPageShouldDisplayTheEligibleEmployeeCount()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(4) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

I would rather it be displayed in a table format, but I'm not sure how to do it.

Thank you.

I am very new to using C#/Specflow to write tests so thank you for the patience. I have a test that ends like this:

Then the Details page should display the rating zip code
    And the Details page should display the ID
    And the Details page should display the Eligible Employee count

And the code behind looks like this:

    [Then(@"the Details page should display the rating zip code")]
    public void ThenTheDetailsPageShouldDisplayTheRatingZipCode()

    {          
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(3) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));          
    }

    [Then(@"the Details page should display the ID")]
    public void ThenTheDetailsPageShouldDisplayTheID()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(1) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

    [Then(@"the Details page should display the Eligible Employee count")]
    public void ThenTheDetailsPageShouldDisplayTheEligibleEmployeeCount()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(4) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

I would rather it be displayed in a table format but I'm not sure how to do it.

Thank you.

I'm very new to using C#/Specflow to write tests. I have a test, that ends like this:

Then the Details page should display the rating zip code
    And the Details page should display the ID
    And the Details page should display the Eligible Employee count

And the code behind looks like this:

    [Then(@"the Details page should display the rating zip code")]
    public void ThenTheDetailsPageShouldDisplayTheRatingZipCode()

    {          
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(3) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));          
    }

    [Then(@"the Details page should display the ID")]
    public void ThenTheDetailsPageShouldDisplayTheID()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(1) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

    [Then(@"the Details page should display the Eligible Employee count")]
    public void ThenTheDetailsPageShouldDisplayTheEligibleEmployeeCount()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(4) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

I would rather it be displayed in a table format, but I'm not sure how to do it.

Bumped by Community user
Source Link

How can I turn a list of assertions into a table? C#/Specflow Selenium

I am very new to using C#/Specflow to write tests so thank you for the patience. I have a test that ends like this:

Then the Details page should display the rating zip code
    And the Details page should display the ID
    And the Details page should display the Eligible Employee count

And the code behind looks like this:

    [Then(@"the Details page should display the rating zip code")]
    public void ThenTheDetailsPageShouldDisplayTheRatingZipCode()

    {          
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(3) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));          
    }

    [Then(@"the Details page should display the ID")]
    public void ThenTheDetailsPageShouldDisplayTheID()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(1) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

    [Then(@"the Details page should display the Eligible Employee count")]
    public void ThenTheDetailsPageShouldDisplayTheEligibleEmployeeCount()
    {
        string actualvalue = Driver.Instance.FindElement(By.CssSelector("div.GroupInfoRow:nth-child(4) > label:nth-child(2)")).Text;
        Assert.IsTrue(actualvalue.Equals(actualvalue));
    }

I would rather it be displayed in a table format but I'm not sure how to do it.

Thank you.